-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #164 from amazeeio/activestandby
Add support for running active/standby switch
- v0.31.5
- v0.31.4
- v0.31.3
- v0.31.2
- v0.31.1
- v0.31.0
- v0.30.1
- v0.30.0
- v0.21.3
- v0.21.2
- v0.21.1
- v0.21.0
- v0.20.2
- v0.20.1
- v0.20.0
- v0.19.0
- v0.18.1
- v0.18.0
- v0.17.0
- v0.16.0
- v0.15.5
- v0.15.4
- v0.15.3
- v0.15.2
- v0.15.1
- v0.15.0
- v0.14.0
- v0.13.0
- v0.12.5
- v0.12.4
- v0.12.3
- v0.12.2
- v0.12.1
- v0.12.0
- v0.11.6
- v0.11.5
- 0.11.4
- 0.11.3
- 0.11.2
- 0.11.1
Showing
19 changed files
with
403 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
## lagoon get task-by-id | ||
|
||
Get information about a task by its ID | ||
|
||
### Synopsis | ||
|
||
Get information about a task by its ID | ||
|
||
``` | ||
lagoon get task-by-id [flags] | ||
``` | ||
|
||
### Options | ||
|
||
``` | ||
-h, --help help for task-by-id | ||
-I, --id int ID of the task | ||
-L, --logs Show the task logs if available | ||
``` | ||
|
||
### Options inherited from parent commands | ||
|
||
``` | ||
--config-file string Path to the config file to use (must be *.yml or *.yaml) | ||
--debug Enable debugging output (if supported) | ||
-e, --environment string Specify an environment to use | ||
--force Force yes on prompts (if supported) | ||
-l, --lagoon string The Lagoon instance to interact with | ||
--no-header No header on table (if supported) | ||
--output-csv Output as CSV (if supported) | ||
--output-json Output as JSON (if supported) | ||
--pretty Make JSON pretty (if supported) | ||
-p, --project string Specify a project to use | ||
--skip-update-check Skip checking for updates | ||
-i, --ssh-key string Specify path to a specific SSH key to use for lagoon authentication | ||
``` | ||
|
||
### SEE ALSO | ||
|
||
* [lagoon get](lagoon_get.md) - Get info on a resource | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
## lagoon run activestandby | ||
|
||
Run the active/standby switch for a project | ||
|
||
### Synopsis | ||
|
||
Run the active/standby switch for a project | ||
You should only run this once and then check the status of the task that gets created. | ||
If the task fails or fails to update, contact your Lagoon administrator for assistance. | ||
|
||
``` | ||
lagoon run activestandby [flags] | ||
``` | ||
|
||
### Options | ||
|
||
``` | ||
-h, --help help for activestandby | ||
``` | ||
|
||
### Options inherited from parent commands | ||
|
||
``` | ||
--config-file string Path to the config file to use (must be *.yml or *.yaml) | ||
--debug Enable debugging output (if supported) | ||
-e, --environment string Specify an environment to use | ||
--force Force yes on prompts (if supported) | ||
-l, --lagoon string The Lagoon instance to interact with | ||
--no-header No header on table (if supported) | ||
--output-csv Output as CSV (if supported) | ||
--output-json Output as JSON (if supported) | ||
--pretty Make JSON pretty (if supported) | ||
-p, --project string Specify a project to use | ||
--skip-update-check Skip checking for updates | ||
-i, --ssh-key string Specify path to a specific SSH key to use for lagoon authentication | ||
``` | ||
|
||
### SEE ALSO | ||
|
||
* [lagoon run](lagoon_run.md) - Run a task against an environment | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
internal/lagoon/client/_lgraphql/switchActiveStandby.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{{ if apiVerGreaterThanOrEqual . "1.9.0" }} | ||
mutation ( | ||
$project: String! | ||
) { | ||
switchActiveStandby( | ||
input: { | ||
project:{ | ||
name: $project | ||
} | ||
} | ||
) { | ||
id | ||
} | ||
} | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{{ if apiVerGreaterThanOrEqual . "1.9.0" }} | ||
query ( | ||
$id: Int! | ||
){ | ||
taskById(id: $id){ | ||
id | ||
name | ||
command | ||
status | ||
started | ||
completed | ||
created | ||
logs | ||
remoteId | ||
service | ||
} | ||
} | ||
{{ end }} |
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Package lagoon implements high-level functions for interacting with the | ||
// Lagoon API. | ||
package lagoon | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/amazeeio/lagoon-cli/internal/schema" | ||
) | ||
|
||
// Tasks interface contains methods for running tasks in projects and environments in lagoon. | ||
type Tasks interface { | ||
RunActiveStandbySwitch(ctx context.Context, project string, result *schema.Task) error | ||
GetTaskByID(ctx context.Context, id int, result *schema.Task) error | ||
} | ||
|
||
// ActiveStandbySwitch runs the activestandby switch. | ||
func ActiveStandbySwitch(ctx context.Context, project string, t Tasks) (*schema.Task, error) { | ||
result := schema.Task{} | ||
return &result, t.RunActiveStandbySwitch(ctx, project, &result) | ||
} | ||
|
||
func TaskByID(ctx context.Context, id int, t Tasks) (*schema.Task, error) { | ||
result := schema.Task{} | ||
return &result, t.GetTaskByID(ctx, id, &result) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package schema | ||
|
||
// Task is based on the Lagoon API type. | ||
type Task struct { | ||
ID uint `json:"id,omitempty"` | ||
Name string `json:"name,omitempty"` | ||
Status string `json:"status,omitempty"` | ||
Created string `json:"created,omitempty"` | ||
Started string `json:"started,omitempty"` | ||
Completed string `json:"completed,omitempty"` | ||
Service string `json:"service,omitempty"` | ||
Command string `json:"command,omitempty"` | ||
RemoteID string `json:"remoteId,omitempty"` | ||
Logs string `json:"logs,omitempty"` | ||
Environment Environment `json:"environment,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters