Giter Club home page Giter Club logo

astra-cli's Introduction

astra-cli

Apache 2.0 licensed Astra Cloud Management CLI

.github/workflows/go.yaml Go Report Card GitHub go.mod Go version of a Go module Latest Version Coverage Status

status

Ready for production

How to install - install script

How to install - Release Binaries

  • download a release
  • tar zxvf
  • cd
  • ./astra

How to install - From Source

  • Install Go 1.17
  • run git clone [email protected]:datastax-labs/astra-cli.git
  • run ./scripts/build or go build -o ./bin/astra .

How to use

  • login
  • execute commands on your database

login with token

After creating a token with rights to use the devops api

astra login --token "changed"
Login information saved

login service account

After creating a service account on the Astra page

astra login --id "changed" --name "changed" --secret "changed"
Login information saved

login service account with json

astra login --json '{"clientId":"changed","clientName":"[email protected]","clientSecret":"changed"}'
Login information saved

creating database

astra db create -v --keyspace myks --name mydb 
............
database 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b created

get secure connection bundle

astra db secBundle 3c577e51-4ff5-4551-86a4-41d475c61822 -d external -l external.zip            
file external.zip saved 12072 bytes written
astra db secBundle 3c577e51-4ff5-4551-86a4-41d475c61822 -d internal -l internal.zip            
file internal.zip saved 12066 bytes written
astra db secBundle 3c577e51-4ff5-4551-86a4-41d475c61822 -d proxy-internal -l proxy-internal.zip 
file proxy-internal.zip saved 348 bytes written
astra db secBundle 3c577e51-4ff5-4551-86a4-41d475c61822 -d proxy-external -l proxy-external.zip 
file proxy-external.zip saved 339 bytes written

get secure connection bundle URLs

astra db secBundle 3c577e51-4ff5-4551-86a4-41d475c61822 -o list         
  external bundle: changed
  internal bundle: changed
  external proxy: changed
  internal proxy: changed

listing databases

astra db list                                                             
name id                                   status
mydb 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b ACTIVE

listing databases in json

astra db list -o json
[
  {
    "id": "2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b",
    "orgId": "changed",
    "ownerId": "changed",
    "info": {
      "name": "mydb",
      "keyspace": "myks",
      "cloudProvider": "GCP",
      "tier": "developer",
      "capacityUnits": 1,
      "region": "us-east1",
      "user": "dbuser",
      "password": "",
      "additionalKeyspaces": null,
      "cost": null
    },
    "creationTime": "2021-02-24T17:23:19Z",
    "terminationTime": "0001-01-01T00:00:00Z",
    "status": "ACTIVE",
    "storage": {
      "nodeCount": 1,
      "replicationFactor": 1,
      "totalStorage": 5,
      "usedStorage": 0
    },
    "availableActions": [
      "park",
      "getCreds",
      "resetPassword",
      "terminate",
      "addKeyspace",
      "removeKeyspace",
      "addTable"
    ],
    "message": "",
    "studioUrl": "https://2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b-us-east1.studio.astra.datastax.com",
    "grafanaUrl": "https://2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b-us-east1.dashboard.astra.datastax.com/d/cloud/dse-cluster-condensed?refresh=30s\u0026orgId=1\u0026kiosk=tv",
    "cqlshUrl": "https://2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b-us-east1.apps.astra.datastax.com/cqlsh",
    "graphUrl": "",
    "dataEndpointUrl": "https://2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b-us-east1.apps.astra.datastax.com/api/rest"
  }
]

getting database by id

astra db get 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b
name id                                   status
mydb 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b ACTIVE

getting database by id in json

astra db get 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b -o json 
{
  "id": "2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b",
  "orgId": "changed",
  "ownerId": "changed",
  "info": {
    "name": "mydb",
    "keyspace": "myks",
    "cloudProvider": "GCP",
    "tier": "developer",
    "capacityUnits": 1,
    "region": "us-east1",
    "user": "dbuser",
    "password": "",
    "additionalKeyspaces": null,
    "cost": null
  },
  "creationTime": "2021-02-24T17:23:19Z",
  "terminationTime": "0001-01-01T00:00:00Z",
  "status": "ACTIVE",
  "storage": {
    "nodeCount": 1,
    "replicationFactor": 1,
    "totalStorage": 5,
    "usedStorage": 0
  },
  "availableActions": [
    "park",
    "getCreds",
    "resetPassword",
    "terminate",
    "addKeyspace",
    "removeKeyspace",
    "addTable"
  ],
  "message": "",
  "studioUrl": "https://2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b-us-east1.studio.astra.datastax.com",
  "grafanaUrl": "https://2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b-us-east1.dashboard.astra.datastax.com/d/cloud/dse-cluster-condensed?refresh=30s\u0026orgId=1\u0026kiosk=tv",
  "cqlshUrl": "https://2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b-us-east1.apps.astra.datastax.com/cqlsh",
  "graphUrl": "",
  "dataEndpointUrl": "https://2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b-us-east1.apps.astra.datastax.com/api/rest"
}

parking database

NOTE: Does not work on serverless

astra db park -v 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b         
starting to park database 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b
...........
database 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b parked

unparking database

NOTE: Does not work on serverless

astra db unpark -v 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b
starting to unpark database 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b
...........
database 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b unparked

deleting database

astra db delete -v 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b
starting to delete database 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b
database 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b deleted

resizing

I did not have a paid account to verify this works, but you can see it succesfully starts the process

astra db resize -v 72c4d35b-1875-495a-b5f1-97329d90b6c5 2                    
unable to unpark '72c4d35b-1875-495a-b5f1-97329d90b6c5' with error expected status code 2xx but had: 400 error was [map[ID:2.000009e+06 message:resizing is not supported for this database tier]]

astra-cli's People

Contributors

rsds143 avatar weideng1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

astra-cli's Issues

add schema operations

need to add schema operations to the tooling and potentially some basic data commands (maybe executing CQL? hard to say)

create curl bash install script

With home-brew does the executable really go into ./bin?

Most people will have no idea which release they need. Please make a Mac/Linux/Win executable. On first run it should:

  • Install the binary into the path or add the binary path to the PATH
  • Run astra-setup, which guides you to get a token (which currently just populates .astrarc and .env but could pull the bundle)

error in help text for user and keyspace

-k, --keyspace string keyspace user to give to the Astra Database
-n, --name string name to give to the Astra Database

these two are actually reversed in meaning

display version support when running

  • need to update build to automatically change version to match the tag
  • all commands should display astra version
  • provide version subcommand to generate easily parsable version

Polish up command calls

We should never have ./bin/whatever. It is fragile (doesn't work everywhere) and looks immature.

We should get and put the bundle in a specific place (maybe ~/.config/astra/bundle?) or use the .astrarc/.env file

It should be called "astra" not "astra-cli" to match with other cli's out there.

WaitUntil doesn't wait long enough in Astra cluster creation

When creating a E-tier cluster in Astra, we often encounter the following error:

$ astra -e dev db create -l AWS -k testks -n clitest -r us-east-1 -t E60
..........................................................................................unable to create '{1 AWS testks clitest <nil> us-east-1 E60 <nil>}' with error waiting for status check on create db failed because 'unable to find db id aae7d687-1083-4c04-915c-fdf79a2cef84 with status [ACTIVE] after 2700 seconds'

This can be easily fixed by allowing it to wait for 1 hour instead of 2700 seconds.

"json" in output

Is there really an extra "json" in the output here? It should just be the json file, for piping to jq or whatever.

./bin/astra-cli db get 2c3bc0d6-5e3e-4d77-81c8-d95a35bdc58b -o json
json
{

support basic mutations

We should cover the whole range of common tasks - create a db, add a row, create a table, update a row, delete a row, delete a row, delete a table, delete a database.

We should allow for ingestion of a json file with operations to execute.

improve progress

the current progress leaves a lot to be desired and we just get
2021/09/28 15:32:04 waiting
2021/09/28 15:32:35 waiting

replace this with just simple dots I guess?

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.