Skip to content

Commit

Permalink
Merged main & generated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
CGoodwin90 committed Dec 4, 2023
2 parents 2d80446 + f1a8c0d commit b2ebedd
Show file tree
Hide file tree
Showing 34 changed files with 75 additions and 529 deletions.
23 changes: 16 additions & 7 deletions cmd/deploytargetconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ package cmd
import (
"context"
"fmt"
l "github.com/uselagoon/machinery/api/lagoon"
lclient "github.com/uselagoon/machinery/api/lagoon/client"
s "github.com/uselagoon/machinery/api/schema"

"github.com/spf13/cobra"
"github.com/uselagoon/lagoon-cli/internal/lagoon"
Expand Down Expand Up @@ -41,38 +44,44 @@ var addDeployTargetConfigCmd = &cobra.Command{
return err
}

if cmdProjectName == "" {
return fmt.Errorf("Missing arguments: project is a required flag")
}
if deploytarget == 0 {
return fmt.Errorf("Missing arguments: deploytarget id is a required flag")
}
if pullrequests == "" {
return fmt.Errorf("Missing arguments: pullrequests is a required flag")
}
if branches == "" {
return fmt.Errorf("Missing arguments: branches is a required flag")
}
current := lagoonCLIConfig.Current
lc := client.New(
token := lagoonCLIConfig.Lagoons[current].Token
lc := lclient.New(
lagoonCLIConfig.Lagoons[current].GraphQL,
lagoonCLIConfig.Lagoons[current].Token,
lagoonCLIConfig.Lagoons[current].Version,
lagoonCLIVersion,
&token,
debug)
project, err := lagoon.GetMinimalProjectByName(context.TODO(), cmdProjectName, lc)
project, err := l.GetMinimalProjectByName(context.TODO(), cmdProjectName, lc)
if err != nil {
return err
}
addDeployTargetConfig := &schema.AddDeployTargetConfigInput{
addDeployTargetConfig := &s.AddDeployTargetConfigInput{
Project: uint(project.ID),
Weight: weight,
}
if branches != "" {
addDeployTargetConfig.Branches = branches
}
if branches != "" {
if pullrequests != "" {
addDeployTargetConfig.Pullrequests = pullrequests
}
if deploytarget != 0 {
addDeployTargetConfig.DeployTarget = deploytarget
}
if yesNo(fmt.Sprintf("You are attempting to add a deploytarget configuration to project '%s', are you sure?", cmdProjectName)) {
deployTargetConfig, err := lagoon.AddDeployTargetConfiguration(context.TODO(), addDeployTargetConfig, lc)
deployTargetConfig, err := l.AddDeployTargetConfiguration(context.TODO(), addDeployTargetConfig, lc)
if err != nil {
return err
}
Expand Down
30 changes: 16 additions & 14 deletions cmd/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"context"
"encoding/json"
"fmt"
l "github.com/uselagoon/machinery/api/lagoon"
lclient "github.com/uselagoon/machinery/api/lagoon/client"
"os"

"github.com/spf13/cobra"
Expand Down Expand Up @@ -155,13 +157,13 @@ var listProjectByMetadata = &cobra.Command{
return fmt.Errorf("Missing arguments: key is not defined")
}
current := lagoonCLIConfig.Current
lc := client.New(
token := lagoonCLIConfig.Lagoons[current].Token
lc := lclient.New(
lagoonCLIConfig.Lagoons[current].GraphQL,
lagoonCLIConfig.Lagoons[current].Token,
lagoonCLIConfig.Lagoons[current].Version,
lagoonCLIVersion,
&token,
debug)
projects, err := lagoon.GetProjectsByMetadata(context.TODO(), key, value, lc)
projects, err := l.GetProjectsByMetadata(context.TODO(), key, value, lc)
if err != nil {
return err
}
Expand Down Expand Up @@ -275,17 +277,17 @@ var updateProjectMetadata = &cobra.Command{
}
if yesNo(fmt.Sprintf("You are attempting to update key '%s' for project '%s' metadata, are you sure?", key, cmdProjectName)) {
current := lagoonCLIConfig.Current
lc := client.New(
token := lagoonCLIConfig.Lagoons[current].Token
lc := lclient.New(
lagoonCLIConfig.Lagoons[current].GraphQL,
lagoonCLIConfig.Lagoons[current].Token,
lagoonCLIConfig.Lagoons[current].Version,
lagoonCLIVersion,
&token,
debug)
project, err := lagoon.GetMinimalProjectByName(context.TODO(), cmdProjectName, lc)
project, err := l.GetMinimalProjectByName(context.TODO(), cmdProjectName, lc)
if err != nil {
return err
}
projectResult, err := lagoon.UpdateProjectMetadata(context.TODO(), int(project.ID), key, value, lc)
projectResult, err := l.UpdateProjectMetadata(context.TODO(), int(project.ID), key, value, lc)
if err != nil {
return err
}
Expand Down Expand Up @@ -330,17 +332,17 @@ var deleteProjectMetadataByKey = &cobra.Command{
}
if yesNo(fmt.Sprintf("You are attempting to delete key '%s' from project '%s' metadata, are you sure?", key, cmdProjectName)) {
current := lagoonCLIConfig.Current
lc := client.New(
token := lagoonCLIConfig.Lagoons[current].Token
lc := lclient.New(
lagoonCLIConfig.Lagoons[current].GraphQL,
lagoonCLIConfig.Lagoons[current].Token,
lagoonCLIConfig.Lagoons[current].Version,
lagoonCLIVersion,
&token,
debug)
project, err := lagoon.GetMinimalProjectByName(context.TODO(), cmdProjectName, lc)
project, err := l.GetMinimalProjectByName(context.TODO(), cmdProjectName, lc)
if err != nil {
return err
}
projectResult, err := lagoon.RemoveProjectMetadataByKey(context.TODO(), int(project.ID), key, lc)
projectResult, err := l.RemoveProjectMetadataByKey(context.TODO(), int(project.ID), key, lc)
if err != nil {
return err
}
Expand Down
20 changes: 10 additions & 10 deletions cmd/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
"errors"
"fmt"
"github.com/spf13/cobra"
"github.com/uselagoon/lagoon-cli/internal/lagoon"
"github.com/uselagoon/lagoon-cli/internal/lagoon/client"
"github.com/uselagoon/lagoon-cli/pkg/api"
"github.com/uselagoon/lagoon-cli/pkg/output"
l "github.com/uselagoon/machinery/api/lagoon"
lclient "github.com/uselagoon/machinery/api/lagoon/client"
"io/ioutil"
"os"
)
Expand Down Expand Up @@ -41,13 +41,13 @@ var getTaskByID = &cobra.Command{
return fmt.Errorf("Missing arguments: ID is not defined")
}
current := lagoonCLIConfig.Current
lc := client.New(
token := lagoonCLIConfig.Lagoons[current].Token
lc := lclient.New(
lagoonCLIConfig.Lagoons[current].GraphQL,
lagoonCLIConfig.Lagoons[current].Token,
lagoonCLIConfig.Lagoons[current].Version,
lagoonCLIVersion,
&token,
debug)
result, err := lagoon.TaskByID(context.TODO(), taskID, lc)
result, err := l.TaskByID(context.TODO(), taskID, lc)
if err != nil {
return err
}
Expand Down Expand Up @@ -100,13 +100,13 @@ If the task fails or fails to update, contact your Lagoon administrator for assi
}
if yesNo(fmt.Sprintf("You are attempting to run the active/standby switch for project '%s', are you sure?", cmdProjectName)) {
current := lagoonCLIConfig.Current
lc := client.New(
token := lagoonCLIConfig.Lagoons[current].Token
lc := lclient.New(
lagoonCLIConfig.Lagoons[current].GraphQL,
lagoonCLIConfig.Lagoons[current].Token,
lagoonCLIConfig.Lagoons[current].Version,
lagoonCLIVersion,
&token,
debug)
result, err := lagoon.ActiveStandbySwitch(context.TODO(), cmdProjectName, lc)
result, err := l.ActiveStandbySwitch(context.TODO(), cmdProjectName, lc)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion docs/commands/lagoon.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ lagoon [flags]
* [lagoon get](lagoon_get.md) - Get info on a resource
* [lagoon import](lagoon_import.md) - Import a config from a yaml file
* [lagoon kibana](lagoon_kibana.md) - Launch the kibana interface
* [lagoon list](lagoon_list.md) - List projects, deployments, variables or notifications
* [lagoon list](lagoon_list.md) - List projects, environments, deployments, variables or notifications
* [lagoon login](lagoon_login.md) - Log into a Lagoon instance
* [lagoon retrieve](lagoon_retrieve.md) - Trigger a retrieval operation on backups
* [lagoon run](lagoon_run.md) - Run a task against an environment
Expand Down
4 changes: 2 additions & 2 deletions docs/commands/lagoon_delete_user-sshkey.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ lagoon delete user-sshkey [flags]
### Options

```
-h, --help help for user-sshkey
-N, --keyname string Name of the SSH key
-h, --help help for user-sshkey
--id uint ID of the SSH key
```

### Options inherited from parent commands
Expand Down
1 change: 0 additions & 1 deletion docs/commands/lagoon_get_user-sshkeys.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ lagoon get user-sshkeys [flags]
```
-E, --email string New email address of the user
-h, --help help for user-sshkeys
-N, --name string Name of the group to check users in (if not specified, will default to all groups)
```

### Options inherited from parent commands
Expand Down
4 changes: 2 additions & 2 deletions docs/commands/lagoon_list.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
## lagoon list

List projects, deployments, variables or notifications
List projects, environments, deployments, variables or notifications

### Synopsis

List projects, deployments, variables or notifications
List projects, environments, deployments, variables or notifications

### Options

Expand Down
2 changes: 1 addition & 1 deletion docs/commands/lagoon_list_backups.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ lagoon list backups [flags]

### SEE ALSO

* [lagoon list](lagoon_list.md) - List projects, deployments, variables or notifications
* [lagoon list](lagoon_list.md) - List projects, environments, deployments, variables or notifications

2 changes: 1 addition & 1 deletion docs/commands/lagoon_list_deployments.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ lagoon list deployments [flags]

### SEE ALSO

* [lagoon list](lagoon_list.md) - List projects, deployments, variables or notifications
* [lagoon list](lagoon_list.md) - List projects, environments, deployments, variables or notifications

2 changes: 1 addition & 1 deletion docs/commands/lagoon_list_deploytarget-configs.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ lagoon list deploytarget-configs [flags]

### SEE ALSO

* [lagoon list](lagoon_list.md) - List projects, deployments, variables or notifications
* [lagoon list](lagoon_list.md) - List projects, environments, deployments, variables or notifications

2 changes: 1 addition & 1 deletion docs/commands/lagoon_list_deploytargets.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ lagoon list deploytargets [flags]

### SEE ALSO

* [lagoon list](lagoon_list.md) - List projects, deployments, variables or notifications
* [lagoon list](lagoon_list.md) - List projects, environments, deployments, variables or notifications

2 changes: 1 addition & 1 deletion docs/commands/lagoon_list_environments.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ lagoon list environments [flags]

### SEE ALSO

* [lagoon list](lagoon_list.md) - List projects, deployments, variables or notifications
* [lagoon list](lagoon_list.md) - List projects, environments, deployments, variables or notifications

2 changes: 1 addition & 1 deletion docs/commands/lagoon_list_group-projects.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ lagoon list group-projects [flags]

### SEE ALSO

* [lagoon list](lagoon_list.md) - List projects, deployments, variables or notifications
* [lagoon list](lagoon_list.md) - List projects, environments, deployments, variables or notifications

2 changes: 1 addition & 1 deletion docs/commands/lagoon_list_groups.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ lagoon list groups [flags]

### SEE ALSO

* [lagoon list](lagoon_list.md) - List projects, deployments, variables or notifications
* [lagoon list](lagoon_list.md) - List projects, environments, deployments, variables or notifications

2 changes: 1 addition & 1 deletion docs/commands/lagoon_list_invokable-tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ lagoon list invokable-tasks [flags]

### SEE ALSO

* [lagoon list](lagoon_list.md) - List projects, deployments, variables or notifications
* [lagoon list](lagoon_list.md) - List projects, environments, deployments, variables or notifications

2 changes: 1 addition & 1 deletion docs/commands/lagoon_list_notification.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ List all notifications or notifications on projects

### SEE ALSO

* [lagoon list](lagoon_list.md) - List projects, deployments, variables or notifications
* [lagoon list](lagoon_list.md) - List projects, environments, deployments, variables or notifications
* [lagoon list notification email](lagoon_list_notification_email.md) - List all email notification details (alias: e)
* [lagoon list notification microsoftteams](lagoon_list_notification_microsoftteams.md) - List all Microsoft Teams notification details (alias: m)
* [lagoon list notification project-email](lagoon_list_notification_project-email.md) - List email details about a project (alias: pe)
Expand Down
2 changes: 1 addition & 1 deletion docs/commands/lagoon_list_projects-by-metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ lagoon list projects-by-metadata [flags]

### SEE ALSO

* [lagoon list](lagoon_list.md) - List projects, deployments, variables or notifications
* [lagoon list](lagoon_list.md) - List projects, environments, deployments, variables or notifications

2 changes: 1 addition & 1 deletion docs/commands/lagoon_list_projects.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ lagoon list projects [flags]

### SEE ALSO

* [lagoon list](lagoon_list.md) - List projects, deployments, variables or notifications
* [lagoon list](lagoon_list.md) - List projects, environments, deployments, variables or notifications

2 changes: 1 addition & 1 deletion docs/commands/lagoon_list_tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ lagoon list tasks [flags]

### SEE ALSO

* [lagoon list](lagoon_list.md) - List projects, deployments, variables or notifications
* [lagoon list](lagoon_list.md) - List projects, environments, deployments, variables or notifications

2 changes: 1 addition & 1 deletion docs/commands/lagoon_list_users.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ lagoon list users [flags]

### SEE ALSO

* [lagoon list](lagoon_list.md) - List projects, deployments, variables or notifications
* [lagoon list](lagoon_list.md) - List projects, environments, deployments, variables or notifications

2 changes: 1 addition & 1 deletion docs/commands/lagoon_list_variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ lagoon list variables [flags]

### SEE ALSO

* [lagoon list](lagoon_list.md) - List projects, deployments, variables or notifications
* [lagoon list](lagoon_list.md) - List projects, environments, deployments, variables or notifications

6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,8 @@ github.com/tsenart/deadcode v0.0.0-20160724212837-210d2dc333e9/go.mod h1:q+QjxYv
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
github.com/uselagoon/machinery v0.0.11 h1:s6EhyU/pj1+C4FdS0EqmR6C0dLsoeCd9n+5xHL1YDag=
github.com/uselagoon/machinery v0.0.11/go.mod h1:IXLxlkahEAEgpCmu9Xa/Wmjo6ja4Aoq7tf8G7VrileE=
github.com/uselagoon/machinery v0.0.13-0.20231116024123-c712ade42522 h1:6YU7GMpDL+3xwIbdtTwIYEOWJFbrKd20BeOXtAFEkyg=
github.com/uselagoon/machinery v0.0.13-0.20231116024123-c712ade42522/go.mod h1:h/qeMWQR4Qqu33x+8AulNDeolEwvb/G+aIsn/jyUtwk=
github.com/uselagoon/machinery v0.0.13-0.20231121033119-b49fba1fd1a8 h1:FaESz9DLg4644OxrMyNAhzfZiR4jaga8gR0FOPje/e4=
github.com/uselagoon/machinery v0.0.13-0.20231121033119-b49fba1fd1a8/go.mod h1:h/qeMWQR4Qqu33x+8AulNDeolEwvb/G+aIsn/jyUtwk=
github.com/uselagoon/machinery v0.0.12 h1:TJnA+FrL1uEhRTjJ6dExiL4G7SOQ+hUfGuWDmbW2HBA=
github.com/uselagoon/machinery v0.0.12/go.mod h1:h/qeMWQR4Qqu33x+8AulNDeolEwvb/G+aIsn/jyUtwk=
github.com/uselagoon/machinery v0.0.13 h1:ZCLBNWJmDr3wikaHs3pWhQ1j8MprhIqRuChgSqmLyZc=
github.com/uselagoon/machinery v0.0.13/go.mod h1:h/qeMWQR4Qqu33x+8AulNDeolEwvb/G+aIsn/jyUtwk=
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
Expand Down
Loading

0 comments on commit b2ebedd

Please sign in to comment.