Giter Site home page Giter Site logo

scalr-cli's Introduction

"scalr" is a command-line tool that communicates directly with the Scalr API.

Beta Software

Please note that this is currently beta software and might not work as expected at all times. No guarantees are given. Use at your own risk. If you find something that is broken, please run it again with the "-verbose" flag and post the output as an issue.

Installation

Installing the Scalr cli tool is very straightforward as it's distributed as a single static binary. Simply download the binary from the "bin/" directory that corresponds to your architecture and (preferably) place it somewhere in your PATH. You probably want to set it as executable as well.

# linux 64bit example
wget -O /usr/bin/scalr https://github.com/Scalr/scalr-cli/raw/main/bin/scalr-linux-amd64
chmod +x /usr/bin/scalr

# macos 64bit example
wget -O /usr/bin/scalr https://github.com/Scalr/scalr-cli/raw/main/bin/scalr-darwin-arm64
chmod +x /usr/bin/scalr

binaries for other operating systems, including windows, can be found in bin/.

Basic usage

user@server ~$ scalr

Usage: scalr [OPTION] COMMAND [FLAGS]

  'scalr' is a command-line interface tool that communicates directly with the Scalr API

Examples:
  $ scalr -help
  $ scalr -help get-workspaces
  $ scalr get-foo-bar -flag=value
  $ scalr -verbose create-foo-bar -flag=value -flag2=value2
  $ scalr create-foo-bar < json-blob.txt

Environment variables:
  SCALR_URL    Valid Scalr URL, i.e https://example.scalr.io
  SCALR_TOKEN  Valid Scalr API Token

Options:
  -version    Shows current version of this binary
  -help       Shows documentation for all (or specified) command(s)
  -verbose    Shows complete request and response communication data
  -configure  Run configuration wizard

Configure:

Before the CLI can be used, you will need to configure what Scalr URL and Token to use. This can be done using environment variables (SCALR_URL and SCALR_TOKEN) or a configuration file. Run the CLI with the -configure flag to run the configuration wizard.

user@server ~$ scalr -configure
Scalr URL [ex: https://example.scalr.io]: https://example.scalr.io
Scalr Token (not echoed!): 
Configuration saved in /home/user/.scalr/scalr.conf

List available flags for a specific command:

user@server ~$ scalr -help create-environment

Usage: scalr create-environment [FLAGS] [< json-blob.txt]

  Create a new environment in the account.

  Environment's are collections of related workspaces that correspond to functional areas, SDLC stages,
  projects or any grouping that is required.

  An account can have multiple environments.

  Workspaces within an environment are where Terraform configurations are run to deploy infrastructure,
  and where state files are stored.

  An Environment can have set of policy groups assigned that are applied to all workspaces in the environment.
  The Environment can also have variables, credentials, registry modules, and VCS providers
  that are available to every workspace.

Flags:
  -account-id=STRING                          The account that owns this environment. [*required]
  -cloud-credentials-id=STRING
  -cost-estimation-enabled=BOOLEAN            Indicates if the cost estimation should be performed for `runs` in the environment.
  -default-provider-configurations-id=STRING  Provider configurations used in the environment workspaces by default.
  -name=STRING                                The name of the environment. [*required]
  -policy-groups-id=STRING

For commands that CREATES or UPDATES something, you can chose to set the values using flags (-flag=value) OR use a raw JSON blob as you would do when communicating directly with the Scalr API.

Example using flags:

user@server ~$ scalr create-environment -name=development -account-id=acc-t2fcrq6h1v3nf0g

Examples using JSON blob:

user@server ~$ scalr create-environment < json-blob.txt

user@server ~$ echo '
> {
>      "data": {
>          "attributes": {
>              "name": "development"
>          },
>          "relationships": {
>              "account": {
>                  "data": {
>                      "id": "acc-t2fcrq6h1v3nf0g",
>                      "type": "accounts"
>                  }
>              }
>          },
>          "type": "environments"
>      }
> } 
> ' | scalr create-environment

List required flags:

The -help output will tell you which flags are required. However, it can be hard to find them if the flag list is long. Simply running the command without flags will tell you which required flags have missing values.

user@server ~$ scalr lock-workspace
Missing required flag(s): [workspace]

List available commands:

user@server ~$ scalr -help

Access Policy:
  create-access-policy  Create an Access Policy
  delete-access-policy  Delete Access Policy
  get-access-policies   List Access Policies
  get-access-policy     Get an Access Policy
  update-access-policy  Update an Access Policy

Access Token:
  create-access-token            Create an Access Token
  create-agent-pool-token        Create an Agent Pool Access Token
  delete-access-token            Delete an Access Token
  get-access-token               Get an Access Token
  list-agent-pool-access-tokens  List Agent Pool Access Tokens
  update-access-token            Update an Access Token

Account:
  get-account     Get an Account
  update-account  Update Account

Account Blob Settings:
  delete-account-blob-settings   Delete Blob Settings
  get-account-blob-settings      Get Blob Settings
  replace-account-blob-settings  Replace Blob Settings
  update-account-blob-settings   Update Blob Settings

Agent:
  delete-agent  Delete an Agent
  get-agent     Get an Agent
  get-agents    List Agents

Agent Pool:
  create-agent-pool  Create an Agent Pool
  delete-agent-pool  Delete an Agent Pool
  get-agent-pool     Get an Agent Pool
  get-agent-pools    List Agent Pools
  update-agent-pool  Update an Agent Pool

Apply:
  get-apply      Get an Apply
  get-apply-log  Apply Log

Configuration Version:
  create-configuration-version    Create a Configuration Version
  download-configuration-version  Download Configuration Version
  get-configuration-version       Get a Configuration Version
  get-configuration-versions      List Configuration Versions

Cost Estimate:
  get-cost-estimate            Get a Cost Estimate
  get-cost-estimate-breakdown  Cost breakdown JSON output
  get-cost-estimate-log        Cost Estimate log

Endpoint:
  create-endpoint  Create an Endpoint
  delete-endpoint  Delete an Endpoint
  get-endpoint     Get an Endpoint
  list-endpoints   List Endpoints
  update-endpoint  Update Endpoint

Environment:
  create-environment  Create an Environment
  delete-environment  Delete an Environment
  get-environment     Get an Environment
  list-environments   List Environments
  update-environment  Update Environment

Event Definition:
  list-event-definitions  List Event Definitions

Module:
  create-module          Publish a Module
  delete-module          Unpublish a Module
  get-module             Get a Module
  list-modules           List Modules
  resync-module          Resync a Module
  resync-module-version  Resync a Module Version

Module Version:
  get-module-version    Get a Module Version
  list-module-versions  List Module Versions

Permission:
  get-permission   Get a Permission
  get-permissions  List Permissions

Ping:
  ping  Ping

Plan:
  get-json-output            JSON Output
  get-plan                   Get a Plan
  get-plan-log               Plan Log
  get-sanitized-json-output  Sanitized JSON Output

Policy:
  get-policy  Get a Policy

Policy Check:
  get-policy-check       Get a Policy Check
  get-policy-checks-log  Policy Check Log
  list-policy-checks     List Policy Checks
  override-policy        Override Policy

Policy Group:
  create-policy-group               Create a Policy Group
  create-policy-group-environments  Create policy group environments relationships
  delete-policy-group               Delete a Policy Group
  delete-policy-group-environments  Delete policy group's environment relationship
  get-policy-group                  Get a Policy Group
  list-policy-groups                List Policy Groups
  update-policy-group               Update a Policy Group
  update-policy-group-environments  Update policy group environments relationships

Provider Configuration:
  create-provider-configuration  Create a Provider configuration
  delete-provider-configuration  Delete a Provider configuration
  get-provider-configuration     Get a Provider configuration
  list-provider-configurations   List Provider configurations
  update-provider-configuration  Update a Provider configuration

Provider Configuration Link:
  create-provider-configuration-link            Attach a Provider configuration to the workspace
  delete-provider-configuration-workspace-link  Delete a Provider configuration workspace link
  get-provider-configuration-link               Get a Provider configuration link
  list-provider-configuration-links             List Provider configuration workspace links
  update-provider-configuration-link            Update a Provider configuration link

Provider Configuration Parameter:
  create-provider-configuration-parameter  Create a Provider configuration parameter
  delete-provider-configuration-parameter  Delete a Provider configuration parameter
  get-provider-configuration-parameter     Get a Provider configuration parameter
  list-provider-configuration-parameters   List Provider configuration parameters for specific provider configurations
  update-provider-configuration-parameter  Update a Provider configuration parameter

Role:
  create-role  Create a Role
  delete-role  Delete a Role
  get-role     Get a Role
  get-roles    List Roles
  update-role  Update a Role

Run:
  cancel-run             Cancel a Run
  confirm-run            Apply a Run
  create-run             Create a Run
  discard-run            Discard a Run
  download-policy-input  Download a Policy Input
  get-run                Get a Run
  get-runs               List Runs
  get-runs-queue         List Runs Queue

Run Trigger:
  create-run-trigger  Create a Run Trigger.
  delete-run-trigger  Delete a Run Trigger
  get-run-trigger     Get a Run Trigger

Service Account:
  create-service-account  Create a Service Account
  delete-service-account  Delete a Service Account
  get-service-account     Get a Service Account
  get-service-accounts    List Service Accounts
  update-service-account  Update a Service Account

State Version:
  get-current-state-version   Get Workspace's Current State Version
  get-state-version           Get a State Version
  get-state-version-download  Download State Version
  list-state-versions         List Workspace's State Versions

Tag:
  create-tag  Create a Tag
  delete-tag  Delete a Tag
  get-tag     Get a Tag
  list-tags   List Tags
  update-tag  Update a Tag

Team:
  create-team  Create a Team
  delete-team  Delete a Team
  get-team     Get a Team
  get-teams    List Teams
  update-team  Update a Team

Usage Statistic:
  list-usage-statistics  List Scalr Usage Statistics

User:
  create-user               Create a User
  delete-user               Delete a User
  get-account-users         List Account to User relationships
  get-user                  Get a User
  get-users                 List Users
  invite-user-to-account    Invite a User to the Account
  remove-user-from-account  Remove a User from the Account
  update-user               Update a User

Variable:
  create-variable  Create a Variable
  delete-variable  Delete a Variable
  get-variable     Get a Variable
  get-variables    List Variables
  update-variable  Update a Variable

Vcs Provider:
  create-vcs-provider  Create a VCS Provider
  delete-vcs-provider  Delete a VCS Provider
  get-vcs-provider     Get a VCS Provider
  list-vcs-providers   List VCS Providers
  update-vcs-provider  Update a VCS Provider

Webhook:
  create-webhook  Create Webhook
  delete-webhook  Delete a Webhook
  get-webhook     Get a Webhook
  list-webhooks   List Webhooks
  update-webhook  Update Webhook

Workspace:
  add-remote-state-consumers      Add remote state consumers
  add-workspace-tags              Add tags to the workspace
  create-workspace                Create a Workspace
  delete-remote-state-consumers   Delete remote state consumers
  delete-workspace                Delete a Workspace
  delete-workspace-tags           Delete workspace's tags
  get-workspace                   Get a Workspace
  get-workspaces                  List Workspaces
  list-remote-state-consumers     List remote state consumers
  list-workspace-tags             List workspace's tags
  lock-workspace                  Lock a Workspace
  replace-remote-state-consumers  Replace remote state consumers
  replace-workspace-tags          Replace workspace's tags
  resync-workspace                Resync a Workspace
  set-schedule                    Set scheduled runs for the workspace
  unlock-workspace                Unlock a Workspace
  update-workspace                Update a Workspace

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.