Skip to content

Commit

Permalink
Add examples
Browse files Browse the repository at this point in the history
  • Loading branch information
bkircher committed Feb 19, 2021
1 parent caebce1 commit 61eec51
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ gscloud is written in Go, so everything you need is just the gscloud binary. Com

## Examples

*TODO*
See [examples](docs/examples.md) for some examples on how to use gscloud.

## Installation

Expand Down
2 changes: 1 addition & 1 deletion cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ func init() {
serverCreateCmd.Flags().MarkDeprecated("password", "a password will be created automatically")
serverCreateCmd.Flags().Lookup("password").Hidden = true
serverCreateCmd.Flags().StringVar(&serverFlags.profile, "profile", "q35", "Hardware profile")
serverCreateCmd.Flags().StringVar(&serverFlags.availabilityZone, "availability-zone", "", "Availability zone. One of \"a\", \"b\", \"c\". Default \"\"")
serverCreateCmd.Flags().StringVar(&serverFlags.availabilityZone, "availability-zone", "", "Availability zone. One of \"a\", \"b\", \"c\" (default \"\")")
serverCreateCmd.Flags().BoolVar(&serverFlags.autoRecovery, "auto-recovery", true, "Whether to restart in case of errors")

serverSetCmd.Flags().IntVar(&serverFlags.memory, "mem", 0, "Memory (GB)")
Expand Down
58 changes: 58 additions & 0 deletions docs/examples.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Examples

## Create a server object with storage

$ gscloud server create \
--name test-1 \
--cores=1 \
--mem=1 \
--with-template="CentOS 8 (x86_64)" \
--hostname test-1
Server created: f75a03d9-dcd8-4ffe-9d22-38481fc0f4cb
Storage created: ad1ec283-99a8-4d0a-a219-4f61e7b4a654
Password: l548F37u1c:^

## Pull an IP address and assign to a server

$ gscloud ip add -6
IP added: 2a06:2380:0:1::452

$ gscloud ip assign --to=f75a03d9-dcd8-4ffe-9d22-38481fc0f4cb 2a06:2380:0:1::452

## List servers

$ gscloud server ls
ID NAME CORE MEM CHANGED POWER
f75a03d9-dcd8-4ffe-9d22-38481fc0f4cb test-1 1 1 2021-02-19T20:07:59+01:00 off

## List storages

$ gscloud storage ls
ID NAME CAPACITY CHANGED STATUS
ad1ec283-99a8-4d0a-a219-4f61e7b4a654 test-1 10 2021-02-19T20:08:04+01:00 active

## List IPs

% gscloud ip ls
IP ASSIGNED FAILOVER FAMILY REVERSE DNS ID
2a06:2380:0:1::452 assigned no v6 static-2a06-2380-0-1-452.ipv6.gridserver.io 3917cff6-0f7d-408c-8918-dfe1eae498ea

## Remove a server along with assigned IPs and storages

$ gscloud server rm -i f75a03d9-dcd8-4ffe-9d22-38481fc0f4cb
ID TYPE NAME
f75a03d9-dcd8-4ffe-9d22-38481fc0f4cb Server test-1
ad1ec283-99a8-4d0a-a219-4f61e7b4a654 Storage test-1
816b9584-5a68-4cd3-a77c-a4fcc28ed717 IPv6 address 2a06:2380:0:1::452
This can destroy your data. Re-run with --force to remove above objects

And if you are really sure what you do:

$ % gscloud server rm -i -f 2090776c-f428-40b4-a97b-f61081516eb2
ID TYPE NAME
2090776c-f428-40b4-a97b-f61081516eb2 Server test-1
885537a6-a836-47bd-ad1a-0d872e2a2317 Storage test-1
3917cff6-0f7d-408c-8918-dfe1eae498ea IPv6 address 2a06:2380:0:1::452
Removed 2090776c-f428-40b4-a97b-f61081516eb2
Removed 885537a6-a836-47bd-ad1a-0d872e2a2317
Removed 3917cff6-0f7d-408c-8918-dfe1eae498ea

0 comments on commit 61eec51

Please sign in to comment.