diff --git a/cmd/add.go b/cmd/add.go index 9661829d..eeb2951e 100644 --- a/cmd/add.go +++ b/cmd/add.go @@ -13,15 +13,21 @@ var addCmd = &cobra.Command{ }, } +var addNotificationCmd = &cobra.Command{ + Use: "notification", + Aliases: []string{"n"}, + Short: "Add notifications or add notifications to projects", + PersistentPreRun: func(cmd *cobra.Command, args []string) { + validateToken(lagoonCLIConfig.Current) // get a new token if the current one is invalid + }, +} + func init() { addCmd.AddCommand(addDeployTargetCmd) addCmd.AddCommand(addGroupCmd) addCmd.AddCommand(addProjectCmd) addCmd.AddCommand(addProjectToGroupCmd) - addCmd.AddCommand(addProjectRocketChatNotificationCmd) - addCmd.AddCommand(addProjectSlackNotificationCmd) - addCmd.AddCommand(addRocketChatNotificationCmd) - addCmd.AddCommand(addSlackNotificationCmd) + addCmd.AddCommand(addNotificationCmd) addCmd.AddCommand(addUserCmd) addCmd.AddCommand(addUserToGroupCmd) addCmd.AddCommand(addUserSSHKeyCmd) diff --git a/cmd/delete.go b/cmd/delete.go index 531125d1..aa6288af 100644 --- a/cmd/delete.go +++ b/cmd/delete.go @@ -13,16 +13,22 @@ var deleteCmd = &cobra.Command{ }, } +var deleteNotificationCmd = &cobra.Command{ + Use: "notification", + Aliases: []string{"n"}, + Short: "Delete notifications or delete notifications from projects", + PersistentPreRun: func(cmd *cobra.Command, args []string) { + validateToken(lagoonCLIConfig.Current) // get a new token if the current one is invalid + }, +} + func init() { deleteCmd.AddCommand(deleteEnvCmd) deleteCmd.AddCommand(deleteGroupCmd) deleteCmd.AddCommand(deleteDeployTargetCmd) deleteCmd.AddCommand(deleteProjectCmd) deleteCmd.AddCommand(deleteProjectFromGroupCmd) - deleteCmd.AddCommand(deleteProjectRocketChatNotificationCmd) - deleteCmd.AddCommand(deleteProjectSlackNotificationCmd) - deleteCmd.AddCommand(deleteRocketChatNotificationCmd) - deleteCmd.AddCommand(deleteSlackNotificationCmd) + deleteCmd.AddCommand(deleteNotificationCmd) deleteCmd.AddCommand(deleteUserCmd) deleteCmd.AddCommand(deleteSSHKeyCmd) deleteCmd.AddCommand(deleteUserFromGroupCmd) diff --git a/cmd/list.go b/cmd/list.go index c68c9682..28f025ce 100644 --- a/cmd/list.go +++ b/cmd/list.go @@ -394,6 +394,15 @@ var listInvokableTasks = &cobra.Command{ }, } +var listNotificationCmd = &cobra.Command{ + Use: "notification", + Aliases: []string{"n"}, + Short: "List all notifications or notifications on projects", + PersistentPreRun: func(cmd *cobra.Command, args []string) { + validateToken(lagoonCLIConfig.Current) // get a new token if the current one is invalid + }, +} + func init() { listCmd.AddCommand(listDeployTargetsCmd) listCmd.AddCommand(listDeploymentsCmd) @@ -401,8 +410,7 @@ func init() { listCmd.AddCommand(listGroupProjectsCmd) listCmd.AddCommand(listProjectCmd) listCmd.AddCommand(listProjectsCmd) - listCmd.AddCommand(listRocketChatsCmd) - listCmd.AddCommand(listSlackCmd) + listCmd.AddCommand(listNotificationCmd) listCmd.AddCommand(listTasksCmd) listCmd.AddCommand(listUsersCmd) listCmd.AddCommand(listVariablesCmd) diff --git a/cmd/notifications.go b/cmd/notifications.go index 7bdcb423..77df6d7b 100644 --- a/cmd/notifications.go +++ b/cmd/notifications.go @@ -28,3 +28,47 @@ func parseNotificationFlags(flags pflag.FlagSet) NotificationFlags { json.Unmarshal(jsonStr, &parsedFlags) return parsedFlags } + +func init() { + addNotificationCmd.AddCommand(addProjectNotificationRocketChatCmd) + addNotificationCmd.AddCommand(addProjectNotificationSlackCmd) + addNotificationCmd.AddCommand(addProjectNotificationEmailCmd) + addNotificationCmd.AddCommand(addProjectNotificationMicrosoftTeamsCmd) + addNotificationCmd.AddCommand(addProjectNotificationWebhookCmd) + + addNotificationCmd.AddCommand(addNotificationRocketchatCmd) + addNotificationCmd.AddCommand(addNotificationSlackCmd) + addNotificationCmd.AddCommand(addNotificationEmailCmd) + addNotificationCmd.AddCommand(addNotificationMicrosoftTeamsCmd) + addNotificationCmd.AddCommand(addNotificationWebhookCmd) + + listNotificationCmd.AddCommand(listProjectSlacksCmd) + listNotificationCmd.AddCommand(listProjectRocketChatsCmd) + listNotificationCmd.AddCommand(listProjectEmailsCmd) + listNotificationCmd.AddCommand(listProjectMicrosoftTeamsCmd) + listNotificationCmd.AddCommand(listProjectWebhooksCmd) + + listNotificationCmd.AddCommand(listAllSlacksCmd) + listNotificationCmd.AddCommand(listAllRocketChatsCmd) + listNotificationCmd.AddCommand(listAllEmailsCmd) + listNotificationCmd.AddCommand(listAllMicrosoftTeamsCmd) + listNotificationCmd.AddCommand(listAllWebhooksCmd) + + deleteNotificationCmd.AddCommand(deleteProjectRocketChatNotificationCmd) + deleteNotificationCmd.AddCommand(deleteProjectSlackNotificationCmd) + deleteNotificationCmd.AddCommand(deleteProjectEmailNotificationCmd) + deleteNotificationCmd.AddCommand(deleteProjectMicrosoftTeamsNotificationCmd) + deleteNotificationCmd.AddCommand(deleteProjectWebhookNotificationCmd) + + deleteNotificationCmd.AddCommand(deleteRocketChatNotificationCmd) + deleteNotificationCmd.AddCommand(deleteSlackNotificationCmd) + deleteNotificationCmd.AddCommand(deleteEmailNotificationCmd) + deleteNotificationCmd.AddCommand(deleteMicrosoftTeamsNotificationCmd) + deleteNotificationCmd.AddCommand(deleteWebhookNotificationCmd) + + updateNotificationCmd.AddCommand(updateRocketChatNotificationCmd) + updateNotificationCmd.AddCommand(updateSlackNotificationCmd) + updateNotificationCmd.AddCommand(updateEmailNotificationCmd) + updateNotificationCmd.AddCommand(updateMicrosoftTeamsNotificationCmd) + updateNotificationCmd.AddCommand(updateWebhookNotificationCmd) +} diff --git a/cmd/notificationsemail.go b/cmd/notificationsemail.go new file mode 100644 index 00000000..88239fb2 --- /dev/null +++ b/cmd/notificationsemail.go @@ -0,0 +1,385 @@ +package cmd + +import ( + "bytes" + "context" + "encoding/json" + "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/internal/schema" + "github.com/uselagoon/lagoon-cli/pkg/api" + "github.com/uselagoon/lagoon-cli/pkg/output" +) + +var addNotificationEmailCmd = &cobra.Command{ + Use: "email", + Short: "Add a new email notification", + Long: `Add a new email notification +This command is used to set up a new email notification in Lagoon. This requires information to talk to the email address to send to. +It does not configure a project to send notifications to email though, you need to use project-email for that.`, + Aliases: []string{"e"}, + PreRunE: func(_ *cobra.Command, _ []string) error { + return validateTokenE(lagoonCLIConfig.Current) + }, + RunE: func(cmd *cobra.Command, args []string) error { + debug, err := cmd.Flags().GetBool("debug") + if err != nil { + return err + } + name, err := cmd.Flags().GetString("name") + if err != nil { + return err + } + email, err := cmd.Flags().GetString("email") + if err != nil { + return err + } + if name == "" || email == "" { + return fmt.Errorf("Missing arguments: name or email is not defined") + } + if yesNo(fmt.Sprintf("You are attempting to create an email notification '%s' with email address '%s', are you sure?", name, email)) { + current := lagoonCLIConfig.Current + lc := client.New( + lagoonCLIConfig.Lagoons[current].GraphQL, + lagoonCLIConfig.Lagoons[current].Token, + lagoonCLIConfig.Lagoons[current].Version, + lagoonCLIVersion, + debug) + notification := &schema.AddNotificationEmailInput{ + Name: name, + EmailAddress: email, + } + result, err := lagoon.AddNotificationEmail(context.TODO(), notification, lc) + if err != nil { + return err + } + data := []output.Data{ + []string{ + returnNonEmptyString(fmt.Sprintf("%v", result.ID)), + returnNonEmptyString(fmt.Sprintf("%v", result.Name)), + returnNonEmptyString(fmt.Sprintf("%v", result.EmailAddress)), + }, + } + output.RenderOutput(output.Table{ + Header: []string{ + "ID", + "Name", + "EmailAddress", + }, + Data: data, + }, outputOptions) + } + return nil + }, +} + +var addProjectNotificationEmailCmd = &cobra.Command{ + Use: "project-email", + Aliases: []string{"pe"}, + Short: "Add an email notification to a project", + Long: `Add an email notification to a project +This command is used to add an existing email notification in Lagoon to a project.`, + PreRunE: func(_ *cobra.Command, _ []string) error { + return validateTokenE(lagoonCLIConfig.Current) + }, + RunE: func(cmd *cobra.Command, args []string) error { + debug, err := cmd.Flags().GetBool("debug") + if err != nil { + return err + } + name, err := cmd.Flags().GetString("name") + if err != nil { + return err + } + if name == "" || cmdProjectName == "" { + return fmt.Errorf("Missing arguments: project name or notification name is not defined") + } + if yesNo(fmt.Sprintf("You are attempting to add email notification '%s' to project '%s', are you sure?", name, cmdProjectName)) { + current := lagoonCLIConfig.Current + lc := client.New( + lagoonCLIConfig.Lagoons[current].GraphQL, + lagoonCLIConfig.Lagoons[current].Token, + lagoonCLIConfig.Lagoons[current].Version, + lagoonCLIVersion, + debug) + notification := &schema.AddNotificationToProjectInput{ + NotificationType: api.EmailNotification, + NotificationName: name, + Project: cmdProjectName, + } + _, err := lagoon.AddNotificationToProject(context.TODO(), notification, lc) + if err != nil { + return err + } + resultData := output.Result{ + Result: "success", + } + output.RenderResult(resultData, outputOptions) + } + return nil + }, +} + +var listProjectEmailsCmd = &cobra.Command{ + Use: "project-email", + Aliases: []string{"pe"}, + Short: "List email details about a project (alias: pe)", + PreRunE: func(_ *cobra.Command, _ []string) error { + return validateTokenE(lagoonCLIConfig.Current) + }, + RunE: func(cmd *cobra.Command, args []string) error { + debug, err := cmd.Flags().GetBool("debug") + if err != nil { + return err + } + if cmdProjectName == "" { + return fmt.Errorf("Missing arguments: project name is not defined") + } + current := lagoonCLIConfig.Current + lc := client.New( + lagoonCLIConfig.Lagoons[current].GraphQL, + lagoonCLIConfig.Lagoons[current].Token, + lagoonCLIConfig.Lagoons[current].Version, + lagoonCLIVersion, + debug) + result, err := lagoon.GetProjectNotificationEmail(context.TODO(), cmdProjectName, lc) + if err != nil { + return err + } + data := []output.Data{} + for _, notification := range result.Notifications.Email { + data = append(data, []string{ + returnNonEmptyString(fmt.Sprintf("%v", notification.Name)), + returnNonEmptyString(fmt.Sprintf("%v", notification.EmailAddress)), + }) + } + output.RenderOutput(output.Table{ + Header: []string{ + "Name", + "EmailAddress", + }, + Data: data, + }, outputOptions) + return nil + }, +} + +var listAllEmailsCmd = &cobra.Command{ + Use: "email", + Aliases: []string{"e"}, + Short: "List all email notification details (alias: e)", + PreRunE: func(_ *cobra.Command, _ []string) error { + return validateTokenE(lagoonCLIConfig.Current) + }, + RunE: func(cmd *cobra.Command, args []string) error { + debug, err := cmd.Flags().GetBool("debug") + if err != nil { + return err + } + current := lagoonCLIConfig.Current + lc := client.New( + lagoonCLIConfig.Lagoons[current].GraphQL, + lagoonCLIConfig.Lagoons[current].Token, + lagoonCLIConfig.Lagoons[current].Version, + lagoonCLIVersion, + debug) + result, err := lagoon.GetAllNotificationEmail(context.TODO(), lc) + if err != nil { + return err + } + data := []output.Data{} + for _, res := range *result { + b, _ := json.Marshal(res.Notifications.Email) + if string(b) != "null" { + for _, notif := range res.Notifications.Email { + data = append(data, []string{ + returnNonEmptyString(fmt.Sprintf("%v", res.Name)), + returnNonEmptyString(fmt.Sprintf("%v", notif.Name)), + returnNonEmptyString(fmt.Sprintf("%v", notif.EmailAddress)), + }) + } + } + } + output.RenderOutput(output.Table{ + Header: []string{ + "Project", + "Name", + "EmailAddress", + }, + Data: data, + }, outputOptions) + return nil + }, +} + +var deleteProjectEmailNotificationCmd = &cobra.Command{ + Use: "project-email", + Aliases: []string{"pr"}, + Short: "Delete a email notification from a project", + PreRunE: func(_ *cobra.Command, _ []string) error { + return validateTokenE(lagoonCLIConfig.Current) + }, + RunE: func(cmd *cobra.Command, args []string) error { + debug, err := cmd.Flags().GetBool("debug") + if err != nil { + return err + } + name, err := cmd.Flags().GetString("name") + if err != nil { + return err + } + if name == "" || cmdProjectName == "" { + return fmt.Errorf("Missing arguments: project name or notification name is not defined") + } + if yesNo(fmt.Sprintf("You are attempting to delete email notification '%s' from project '%s', are you sure?", name, cmdProjectName)) { + current := lagoonCLIConfig.Current + lc := client.New( + lagoonCLIConfig.Lagoons[current].GraphQL, + lagoonCLIConfig.Lagoons[current].Token, + lagoonCLIConfig.Lagoons[current].Version, + lagoonCLIVersion, + debug) + notification := &schema.RemoveNotificationFromProjectInput{ + NotificationType: api.EmailNotification, + NotificationName: name, + Project: cmdProjectName, + } + _, err := lagoon.RemoveNotificationFromProject(context.TODO(), notification, lc) + if err != nil { + return err + } + resultData := output.Result{ + Result: "success", + } + output.RenderResult(resultData, outputOptions) + } + return nil + }, +} + +var deleteEmailNotificationCmd = &cobra.Command{ + Use: "webhook", + Aliases: []string{"w"}, + Short: "Delete a email notification from Lagoon", + PreRunE: func(_ *cobra.Command, _ []string) error { + return validateTokenE(lagoonCLIConfig.Current) + }, + RunE: func(cmd *cobra.Command, args []string) error { + debug, err := cmd.Flags().GetBool("debug") + if err != nil { + return err + } + name, err := cmd.Flags().GetString("name") + if err != nil { + return err + } + if name == "" { + return fmt.Errorf("Missing arguments: notification name is not defined") + } + if yesNo(fmt.Sprintf("You are attempting to delete email notification '%s', are you sure?", name)) { + current := lagoonCLIConfig.Current + lc := client.New( + lagoonCLIConfig.Lagoons[current].GraphQL, + lagoonCLIConfig.Lagoons[current].Token, + lagoonCLIConfig.Lagoons[current].Version, + lagoonCLIVersion, + debug) + result, err := lagoon.DeleteNotificationEmail(context.TODO(), name, lc) + if err != nil { + return err + } + resultData := output.Result{ + Result: result.DeleteNotification, + } + output.RenderResult(resultData, outputOptions) + } + return nil + }, +} + +var updateEmailNotificationCmd = &cobra.Command{ + Use: "email", + Aliases: []string{"e"}, + Short: "Update an existing email notification", + PreRunE: func(_ *cobra.Command, _ []string) error { + return validateTokenE(lagoonCLIConfig.Current) + }, + RunE: func(cmd *cobra.Command, args []string) error { + debug, err := cmd.Flags().GetBool("debug") + if err != nil { + return err + } + name, err := cmd.Flags().GetString("name") + if err != nil { + return err + } + newname, err := cmd.Flags().GetString("newname") + if err != nil { + return err + } + email, err := cmd.Flags().GetString("email") + if err != nil { + return err + } + if name == "" { + return fmt.Errorf("Missing arguments: notification name is not defined") + } + patch := schema.AddNotificationEmailInput{ + Name: newname, + EmailAddress: email, + } + b1, _ := json.Marshal(patch) + if bytes.Equal(b1, []byte("{}")) { + return fmt.Errorf("Missing arguments: either email or newname must be defined") + } + + if yesNo(fmt.Sprintf("You are attempting to update email notification '%s', are you sure?", name)) { + current := lagoonCLIConfig.Current + lc := client.New( + lagoonCLIConfig.Lagoons[current].GraphQL, + lagoonCLIConfig.Lagoons[current].Token, + lagoonCLIConfig.Lagoons[current].Version, + lagoonCLIVersion, + debug) + + notification := &schema.UpdateNotificationEmailInput{ + Name: name, + Patch: patch, + } + result, err := lagoon.UpdateNotificationEmail(context.TODO(), notification, lc) + if err != nil { + return err + } + data := []output.Data{ + []string{ + returnNonEmptyString(fmt.Sprintf("%v", result.ID)), + returnNonEmptyString(fmt.Sprintf("%v", result.Name)), + returnNonEmptyString(fmt.Sprintf("%v", result.EmailAddress)), + }, + } + output.RenderOutput(output.Table{ + Header: []string{ + "ID", + "Name", + "EmailAddress", + }, + Data: data, + }, outputOptions) + } + return nil + }, +} + +func init() { + addNotificationEmailCmd.Flags().StringP("name", "n", "", "The name of the notification") + addNotificationEmailCmd.Flags().StringP("email", "E", "", "The email address of the notification") + addProjectNotificationEmailCmd.Flags().StringP("name", "n", "", "The name of the notification") + deleteProjectEmailNotificationCmd.Flags().StringP("name", "n", "", "The name of the notification") + deleteEmailNotificationCmd.Flags().StringP("name", "n", "", "The name of the notification") + updateEmailNotificationCmd.Flags().StringP("name", "n", "", "The current name of the notification") + updateEmailNotificationCmd.Flags().StringP("newname", "N", "", "The name of the notification") + updateEmailNotificationCmd.Flags().StringP("email", "E", "", "The email address of the notification") +} diff --git a/cmd/notificationsrocketchat.go b/cmd/notificationsrocketchat.go index 25ec38b4..f7abdac0 100644 --- a/cmd/notificationsrocketchat.go +++ b/cmd/notificationsrocketchat.go @@ -1,199 +1,404 @@ package cmd import ( + "bytes" + "context" "encoding/json" "fmt" - "os" "github.com/spf13/cobra" + "github.com/uselagoon/lagoon-cli/internal/lagoon" + "github.com/uselagoon/lagoon-cli/internal/lagoon/client" + "github.com/uselagoon/lagoon-cli/internal/schema" "github.com/uselagoon/lagoon-cli/pkg/api" "github.com/uselagoon/lagoon-cli/pkg/output" ) -var listRocketChatsCmd = &cobra.Command{ +var addNotificationRocketchatCmd = &cobra.Command{ Use: "rocketchat", Aliases: []string{"r"}, - Short: "List Rocket.Chat details about a project (alias: r)", - Run: func(cmd *cobra.Command, args []string) { - var returnedJSON []byte - var err error - var notificationFlags NotificationFlags - if listAllProjects { - returnedJSON, err = pClient.ListAllRocketChats() - handleError(err) - } else { - notificationFlags = parseNotificationFlags(*cmd.Flags()) - if notificationFlags.Project == "" { - fmt.Println("Missing arguments: Project name is not defined") - cmd.Help() - os.Exit(1) + Short: "Add a new RocketChat notification", + Long: `Add a new RocketChat notification +This command is used to set up a new RocketChat notification in Lagoon. This requires information to talk to RocketChat like the webhook URL and the name of the channel. +It does not configure a project to send notifications to RocketChat though, you need to use project-rocketchat for that.`, + PreRunE: func(_ *cobra.Command, _ []string) error { + return validateTokenE(lagoonCLIConfig.Current) + }, + RunE: func(cmd *cobra.Command, args []string) error { + debug, err := cmd.Flags().GetBool("debug") + if err != nil { + return err + } + name, err := cmd.Flags().GetString("name") + if err != nil { + return err + } + channel, err := cmd.Flags().GetString("channel") + if err != nil { + return err + } + webhook, err := cmd.Flags().GetString("webhook") + if err != nil { + return err + } + if name == "" || channel == "" || webhook == "" { + return fmt.Errorf("Missing arguments: name, webhook, or email is not defined") + } + if yesNo(fmt.Sprintf("You are attempting to create an RocketChat notification '%s' with webhook '%s' channel '%s', are you sure?", name, webhook, channel)) { + current := lagoonCLIConfig.Current + lc := client.New( + lagoonCLIConfig.Lagoons[current].GraphQL, + lagoonCLIConfig.Lagoons[current].Token, + lagoonCLIConfig.Lagoons[current].Version, + lagoonCLIVersion, + debug) + notification := &schema.AddNotificationRocketChatInput{ + Name: name, + Webhook: webhook, + } + result, err := lagoon.AddNotificationRocketChat(context.TODO(), notification, lc) + if err != nil { + return err } - returnedJSON, err = pClient.ListProjectRocketChats(notificationFlags.Project) - handleError(err) - } - var dataMain output.Table - err = json.Unmarshal([]byte(returnedJSON), &dataMain) - handleError(err) - if len(dataMain.Data) == 0 { - if listAllProjects { - output.RenderInfo("No notifications for Rocket.Chat", outputOptions) - } else { - output.RenderInfo(fmt.Sprintf("No notifications for Rocket.Chat in project '%s'", notificationFlags.Project), outputOptions) + data := []output.Data{ + []string{ + returnNonEmptyString(fmt.Sprintf("%v", result.ID)), + returnNonEmptyString(fmt.Sprintf("%v", result.Name)), + returnNonEmptyString(fmt.Sprintf("%v", result.Webhook)), + returnNonEmptyString(fmt.Sprintf("%v", result.Channel)), + }, } + output.RenderOutput(output.Table{ + Header: []string{ + "ID", + "Name", + "Webhook", + "Channel", + }, + Data: data, + }, outputOptions) } - output.RenderOutput(dataMain, outputOptions) + return nil }, } -var addRocketChatNotificationCmd = &cobra.Command{ - Use: "rocketchat", - Aliases: []string{"r"}, - Short: "Add a new Rocket.Chat notification", - Long: `Add a new Rocket.Chat notification -This command is used to set up a new Rocket.Chat notification in Lagoon. This requires information to talk to Rocket.Chat like the webhook URL and the name of the channel. -It does not configure a project to send notifications to Rocket.Chat though, you need to use project-rocketchat for that.`, - Run: func(cmd *cobra.Command, args []string) { - notificationFlags := parseNotificationFlags(*cmd.Flags()) - if notificationFlags.NotificationName == "" || notificationFlags.NotificationChannel == "" || notificationFlags.NotificationWebhook == "" { - fmt.Println("Missing arguments: Notification name, channel, or webhook url are not defined") - cmd.Help() - os.Exit(1) - } - addResult, err := pClient.AddRocketChatNotification(notificationFlags.NotificationName, notificationFlags.NotificationChannel, notificationFlags.NotificationWebhook) - handleError(err) - var resultMap map[string]interface{} - err = json.Unmarshal([]byte(addResult), &resultMap) - handleError(err) - resultData := output.Result{ - Result: "success", - ResultData: resultMap, - } - output.RenderResult(resultData, outputOptions) +var addProjectNotificationRocketChatCmd = &cobra.Command{ + Use: "project-rocketchat", + Aliases: []string{"pr"}, + Short: "Add a RocketChat notification to a project", + Long: `Add a RocketChat notification to a project +This command is used to add an existing RocketChat notification in Lagoon to a project.`, + PreRunE: func(_ *cobra.Command, _ []string) error { + return validateTokenE(lagoonCLIConfig.Current) + }, + RunE: func(cmd *cobra.Command, args []string) error { + debug, err := cmd.Flags().GetBool("debug") + if err != nil { + return err + } + name, err := cmd.Flags().GetString("name") + if err != nil { + return err + } + if name == "" || cmdProjectName == "" { + return fmt.Errorf("Missing arguments: project name or notification name is not defined") + } + if yesNo(fmt.Sprintf("You are attempting to add RocketChat notification '%s' to project '%s', are you sure?", name, cmdProjectName)) { + current := lagoonCLIConfig.Current + lc := client.New( + lagoonCLIConfig.Lagoons[current].GraphQL, + lagoonCLIConfig.Lagoons[current].Token, + lagoonCLIConfig.Lagoons[current].Version, + lagoonCLIVersion, + debug) + notification := &schema.AddNotificationToProjectInput{ + NotificationType: api.RocketChatNotification, + NotificationName: name, + Project: cmdProjectName, + } + _, err := lagoon.AddNotificationToProject(context.TODO(), notification, lc) + if err != nil { + return err + } + resultData := output.Result{ + Result: "success", + } + output.RenderResult(resultData, outputOptions) + } + return nil }, } -var addProjectRocketChatNotificationCmd = &cobra.Command{ +var listProjectRocketChatsCmd = &cobra.Command{ Use: "project-rocketchat", Aliases: []string{"pr"}, - Short: "Add a Rocket.Chat notification to a project", - Long: `Add a Rocket.Chat notification to a project -This command is used to add an existing Rocket.Chat notification in Lagoon to a project.`, - Run: func(cmd *cobra.Command, args []string) { - notificationFlags := parseNotificationFlags(*cmd.Flags()) - if notificationFlags.Project == "" || notificationFlags.NotificationName == "" { - fmt.Println("Missing arguments: Project name or notification name are not defined") - cmd.Help() - os.Exit(1) - } - addResult, err := pClient.AddRocketChatNotificationToProject(notificationFlags.Project, notificationFlags.NotificationName) - handleError(err) - var resultMap map[string]interface{} - err = json.Unmarshal([]byte(addResult), &resultMap) - handleError(err) - resultData := output.Result{ - Result: "success", - ResultData: resultMap, - } - output.RenderResult(resultData, outputOptions) + Short: "List RocketChats details about a project (alias: pr)", + PreRunE: func(_ *cobra.Command, _ []string) error { + return validateTokenE(lagoonCLIConfig.Current) + }, + RunE: func(cmd *cobra.Command, args []string) error { + debug, err := cmd.Flags().GetBool("debug") + if err != nil { + return err + } + if cmdProjectName == "" { + return fmt.Errorf("Missing arguments: project name is not defined") + } + current := lagoonCLIConfig.Current + lc := client.New( + lagoonCLIConfig.Lagoons[current].GraphQL, + lagoonCLIConfig.Lagoons[current].Token, + lagoonCLIConfig.Lagoons[current].Version, + lagoonCLIVersion, + debug) + result, err := lagoon.GetProjectNotificationRocketChat(context.TODO(), cmdProjectName, lc) + if err != nil { + return err + } + data := []output.Data{} + for _, notification := range result.Notifications.RocketChat { + data = append(data, []string{ + returnNonEmptyString(fmt.Sprintf("%v", notification.Name)), + returnNonEmptyString(fmt.Sprintf("%v", notification.Webhook)), + returnNonEmptyString(fmt.Sprintf("%v", notification.Channel)), + }) + } + output.RenderOutput(output.Table{ + Header: []string{ + "Name", + "Webhook", + "Channel", + }, + Data: data, + }, outputOptions) + return nil + }, +} + +var listAllRocketChatsCmd = &cobra.Command{ + Use: "rocketchat", + Aliases: []string{"r"}, + Short: "List all RocketChats notification details (alias: r)", + PreRunE: func(_ *cobra.Command, _ []string) error { + return validateTokenE(lagoonCLIConfig.Current) + }, + RunE: func(cmd *cobra.Command, args []string) error { + debug, err := cmd.Flags().GetBool("debug") + if err != nil { + return err + } + current := lagoonCLIConfig.Current + lc := client.New( + lagoonCLIConfig.Lagoons[current].GraphQL, + lagoonCLIConfig.Lagoons[current].Token, + lagoonCLIConfig.Lagoons[current].Version, + lagoonCLIVersion, + debug) + result, err := lagoon.GetAllNotificationRocketChat(context.TODO(), lc) + if err != nil { + return err + } + data := []output.Data{} + for _, res := range *result { + b, _ := json.Marshal(res.Notifications.RocketChat) + if string(b) != "null" { + for _, notif := range res.Notifications.RocketChat { + data = append(data, []string{ + returnNonEmptyString(fmt.Sprintf("%v", res.Name)), + returnNonEmptyString(fmt.Sprintf("%v", notif.Name)), + returnNonEmptyString(fmt.Sprintf("%v", notif.Webhook)), + returnNonEmptyString(fmt.Sprintf("%v", notif.Channel)), + }) + } + } + } + output.RenderOutput(output.Table{ + Header: []string{ + "Project", + "Name", + "Webhook", + "Channel", + }, + Data: data, + }, outputOptions) + return nil }, } var deleteProjectRocketChatNotificationCmd = &cobra.Command{ Use: "project-rocketchat", Aliases: []string{"pr"}, - Short: "Delete a Rocket.Chat notification from a project", - Run: func(cmd *cobra.Command, args []string) { - notificationFlags := parseNotificationFlags(*cmd.Flags()) - if notificationFlags.Project == "" || notificationFlags.NotificationName == "" { - fmt.Println("Missing arguments: Project name or notification name are not defined") - cmd.Help() - os.Exit(1) - } - if yesNo(fmt.Sprintf("You are attempting to delete notification '%s' from project '%s', are you sure?", notificationFlags.NotificationName, notificationFlags.Project)) { - deleteResult, err := pClient.DeleteRocketChatNotificationFromProject(notificationFlags.Project, notificationFlags.NotificationName) - handleError(err) - var addedProject api.NotificationSlack - err = json.Unmarshal([]byte(deleteResult), &addedProject) - handleError(err) + Short: "Delete a RocketChat notification from a project", + PreRunE: func(_ *cobra.Command, _ []string) error { + return validateTokenE(lagoonCLIConfig.Current) + }, + RunE: func(cmd *cobra.Command, args []string) error { + debug, err := cmd.Flags().GetBool("debug") + if err != nil { + return err + } + name, err := cmd.Flags().GetString("name") + if err != nil { + return err + } + if name == "" || cmdProjectName == "" { + return fmt.Errorf("Missing arguments: project name or notification name is not defined") + } + if yesNo(fmt.Sprintf("You are attempting to delete RocketChat notification '%s' from project '%s', are you sure?", name, cmdProjectName)) { + current := lagoonCLIConfig.Current + lc := client.New( + lagoonCLIConfig.Lagoons[current].GraphQL, + lagoonCLIConfig.Lagoons[current].Token, + lagoonCLIConfig.Lagoons[current].Version, + lagoonCLIVersion, + debug) + notification := &schema.RemoveNotificationFromProjectInput{ + NotificationType: api.RocketChatNotification, + NotificationName: name, + Project: cmdProjectName, + } + _, err := lagoon.RemoveNotificationFromProject(context.TODO(), notification, lc) + if err != nil { + return err + } resultData := output.Result{ Result: "success", } output.RenderResult(resultData, outputOptions) } + return nil }, } + var deleteRocketChatNotificationCmd = &cobra.Command{ Use: "rocketchat", Aliases: []string{"r"}, - Short: "Delete a Rocket.Chat notification from Lagoon", - Run: func(cmd *cobra.Command, args []string) { - notificationFlags := parseNotificationFlags(*cmd.Flags()) - if notificationFlags.NotificationName == "" { - fmt.Println("Missing arguments: notification name is not defined") - cmd.Help() - os.Exit(1) - } - if yesNo(fmt.Sprintf("You are attempting to delete notification '%s' from Lagoon, are you sure?", notificationFlags.NotificationName)) { - deleteResult, err := pClient.DeleteRocketChatNotification(notificationFlags.NotificationName) - handleError(err) + Short: "Delete a RocketChat notification from Lagoon", + PreRunE: func(_ *cobra.Command, _ []string) error { + return validateTokenE(lagoonCLIConfig.Current) + }, + RunE: func(cmd *cobra.Command, args []string) error { + debug, err := cmd.Flags().GetBool("debug") + if err != nil { + return err + } + name, err := cmd.Flags().GetString("name") + if err != nil { + return err + } + if name == "" { + return fmt.Errorf("Missing arguments: notification name is not defined") + } + if yesNo(fmt.Sprintf("You are attempting to delete RocketChat notification '%s', are you sure?", name)) { + current := lagoonCLIConfig.Current + lc := client.New( + lagoonCLIConfig.Lagoons[current].GraphQL, + lagoonCLIConfig.Lagoons[current].Token, + lagoonCLIConfig.Lagoons[current].Version, + lagoonCLIVersion, + debug) + result, err := lagoon.DeleteNotificationRocketChat(context.TODO(), name, lc) + if err != nil { + return err + } resultData := output.Result{ - Result: string(deleteResult), + Result: result.DeleteNotification, } output.RenderResult(resultData, outputOptions) } + return nil }, } var updateRocketChatNotificationCmd = &cobra.Command{ Use: "rocketchat", Aliases: []string{"r"}, - Short: "Update an existing Rocket.Chat notification", - Run: func(cmd *cobra.Command, args []string) { - notificationFlags := parseNotificationFlags(*cmd.Flags()) - if notificationFlags.NotificationName == "" { - fmt.Println("Missing arguments: Current notification name is not defined") - cmd.Help() - os.Exit(1) - } - oldName := notificationFlags.NotificationName - // if we have a new name, shuffle around the name - if notificationFlags.NotificationNewName != "" { - newName := notificationFlags.NotificationNewName - notificationFlags.NotificationName = newName - } - notificationFlags.NotificationOldName = oldName - if jsonPatch == "" { - jsonPatchBytes, err := json.Marshal(notificationFlags) - handleError(err) - jsonPatch = string(jsonPatchBytes) - } - updateResult, err := pClient.UpdateRocketChatNotification(notificationFlags.NotificationOldName, jsonPatch) - handleError(err) - var resultMap map[string]interface{} - err = json.Unmarshal([]byte(updateResult), &resultMap) - handleError(err) - resultData := output.Result{ - Result: "success", - ResultData: resultMap, - } - output.RenderResult(resultData, outputOptions) + Short: "Update an existing RocketChat notification", + PreRunE: func(_ *cobra.Command, _ []string) error { + return validateTokenE(lagoonCLIConfig.Current) }, -} - -func init() { - addRocketChatNotificationCmd.Flags().StringVarP(¬ificationName, "name", "n", "", "The name of the notification") - addRocketChatNotificationCmd.Flags().StringVarP(¬ificationWebhook, "webhook", "w", "", "The webhook URL of the notification") - addRocketChatNotificationCmd.Flags().StringVarP(¬ificationChannel, "channel", "c", "", "The channel for the notification") - - addProjectRocketChatNotificationCmd.Flags().StringVarP(¬ificationName, "name", "n", "", "The name of the notification") + RunE: func(cmd *cobra.Command, args []string) error { + debug, err := cmd.Flags().GetBool("debug") + if err != nil { + return err + } + name, err := cmd.Flags().GetString("name") + if err != nil { + return err + } + newname, err := cmd.Flags().GetString("newname") + if err != nil { + return err + } + webhook, err := cmd.Flags().GetString("webhook") + if err != nil { + return err + } + channel, err := cmd.Flags().GetString("channel") + if err != nil { + return err + } + if name == "" { + return fmt.Errorf("Missing arguments: notification name is not defined") + } + patch := schema.AddNotificationRocketChatInput{ + Name: newname, + Webhook: webhook, + Channel: channel, + } + b1, _ := json.Marshal(patch) + if bytes.Equal(b1, []byte("{}")) { + return fmt.Errorf("Missing arguments: either channel, webhook, or newname must be defined") + } - deleteProjectRocketChatNotificationCmd.Flags().StringVarP(¬ificationName, "name", "n", "", "The name of the notification") - deleteRocketChatNotificationCmd.Flags().StringVarP(¬ificationName, "name", "n", "", "The name of the notification") + if yesNo(fmt.Sprintf("You are attempting to update RocketChat notification '%s', are you sure?", name)) { + current := lagoonCLIConfig.Current + lc := client.New( + lagoonCLIConfig.Lagoons[current].GraphQL, + lagoonCLIConfig.Lagoons[current].Token, + lagoonCLIConfig.Lagoons[current].Version, + lagoonCLIVersion, + debug) - updateRocketChatNotificationCmd.Flags().StringVarP(¬ificationName, "name", "n", "", "The current name of the notification") - updateRocketChatNotificationCmd.Flags().StringVarP(¬ificationNewName, "newname", "N", "", "The name of the notification") - updateRocketChatNotificationCmd.Flags().StringVarP(¬ificationWebhook, "webhook", "w", "", "The webhook URL of the notification") - updateRocketChatNotificationCmd.Flags().StringVarP(¬ificationChannel, "channel", "c", "", "The channel for the notification") + notification := &schema.UpdateNotificationRocketChatInput{ + Name: name, + Patch: patch, + } + result, err := lagoon.UpdateNotificationRocketChat(context.TODO(), notification, lc) + if err != nil { + return err + } + data := []output.Data{ + []string{ + returnNonEmptyString(fmt.Sprintf("%v", result.ID)), + returnNonEmptyString(fmt.Sprintf("%v", result.Name)), + returnNonEmptyString(fmt.Sprintf("%v", result.Webhook)), + returnNonEmptyString(fmt.Sprintf("%v", result.Channel)), + }, + } + output.RenderOutput(output.Table{ + Header: []string{ + "ID", + "Name", + "Webhook", + "Channel", + }, + Data: data, + }, outputOptions) + } + return nil + }, +} - updateRocketChatNotificationCmd.Flags().StringVarP(&jsonPatch, "json", "j", "", "JSON string to patch") +func init() { + addNotificationRocketchatCmd.Flags().StringP("name", "n", "", "The name of the notification") + addNotificationRocketchatCmd.Flags().StringP("webhook", "w", "", "The webhook URL of the notification") + addNotificationRocketchatCmd.Flags().StringP("channel", "c", "", "The channel for the notification") + addProjectNotificationRocketChatCmd.Flags().StringP("name", "n", "", "The name of the notification") + deleteProjectRocketChatNotificationCmd.Flags().StringP("name", "n", "", "The name of the notification") + deleteRocketChatNotificationCmd.Flags().StringP("name", "n", "", "The name of the notification") + updateRocketChatNotificationCmd.Flags().StringP("name", "n", "", "The current name of the notification") + updateRocketChatNotificationCmd.Flags().StringP("newname", "N", "", "The new name of the notification (if required)") + updateRocketChatNotificationCmd.Flags().StringP("webhook", "w", "", "The webhook URL of the notification") + updateRocketChatNotificationCmd.Flags().StringP("channel", "c", "", "The channel for the notification") } diff --git a/cmd/notificationsslack.go b/cmd/notificationsslack.go index cbb036a1..42edd7f2 100644 --- a/cmd/notificationsslack.go +++ b/cmd/notificationsslack.go @@ -1,103 +1,227 @@ package cmd import ( + "bytes" + "context" "encoding/json" "fmt" - "os" "github.com/spf13/cobra" + "github.com/uselagoon/lagoon-cli/internal/lagoon" + "github.com/uselagoon/lagoon-cli/internal/lagoon/client" + "github.com/uselagoon/lagoon-cli/internal/schema" "github.com/uselagoon/lagoon-cli/pkg/api" "github.com/uselagoon/lagoon-cli/pkg/output" ) -var listSlackCmd = &cobra.Command{ - Use: "slack", - Aliases: []string{"s"}, - Short: "List Slack details about a project (alias: s)", - Run: func(cmd *cobra.Command, args []string) { - var returnedJSON []byte - var err error - var notificationFlags NotificationFlags - if listAllProjects { - returnedJSON, err = pClient.ListAllSlacks() - handleError(err) - } else { - notificationFlags = parseNotificationFlags(*cmd.Flags()) - if notificationFlags.Project == "" { - fmt.Println("Missing arguments: Project name is not defined") - cmd.Help() - os.Exit(1) - } - - returnedJSON, err = pClient.ListProjectSlacks(notificationFlags.Project) - handleError(err) - } - var dataMain output.Table - err = json.Unmarshal([]byte(returnedJSON), &dataMain) - handleError(err) - if len(dataMain.Data) == 0 { - if listAllProjects { - output.RenderInfo("No notifications for Slack", outputOptions) - } else { - output.RenderInfo(fmt.Sprintf("No notifications for Slack in project '%s'", notificationFlags.Project), outputOptions) - } - os.Exit(0) - } - output.RenderOutput(dataMain, outputOptions) - - }, -} - -var addSlackNotificationCmd = &cobra.Command{ +var addNotificationSlackCmd = &cobra.Command{ Use: "slack", Aliases: []string{"s"}, Short: "Add a new Slack notification", Long: `Add a new Slack notification This command is used to set up a new Slack notification in Lagoon. This requires information to talk to Slack like the webhook URL and the name of the channel. It does not configure a project to send notifications to Slack though, you need to use project-slack for that.`, - Run: func(cmd *cobra.Command, args []string) { - notificationFlags := parseNotificationFlags(*cmd.Flags()) - if notificationFlags.NotificationName == "" || notificationFlags.NotificationChannel == "" || notificationFlags.NotificationWebhook == "" { - fmt.Println("Missing arguments: Notification name, channel, or webhook url are not defined") - cmd.Help() - os.Exit(1) - } - addResult, err := pClient.AddSlackNotification(notificationFlags.NotificationName, notificationFlags.NotificationChannel, notificationFlags.NotificationWebhook) - handleError(err) - var resultMap map[string]interface{} - err = json.Unmarshal([]byte(addResult), &resultMap) - handleError(err) - resultData := output.Result{ - Result: "success", - ResultData: resultMap, - } - output.RenderResult(resultData, outputOptions) + PreRunE: func(_ *cobra.Command, _ []string) error { + return validateTokenE(lagoonCLIConfig.Current) + }, + RunE: func(cmd *cobra.Command, args []string) error { + debug, err := cmd.Flags().GetBool("debug") + if err != nil { + return err + } + name, err := cmd.Flags().GetString("name") + if err != nil { + return err + } + channel, err := cmd.Flags().GetString("channel") + if err != nil { + return err + } + webhook, err := cmd.Flags().GetString("webhook") + if err != nil { + return err + } + if name == "" || channel == "" || webhook == "" { + return fmt.Errorf("Missing arguments: name, webhook, or email is not defined") + } + if yesNo(fmt.Sprintf("You are attempting to create an Slack notification '%s' with webhook '%s' channel '%s', are you sure?", name, webhook, channel)) { + current := lagoonCLIConfig.Current + lc := client.New( + lagoonCLIConfig.Lagoons[current].GraphQL, + lagoonCLIConfig.Lagoons[current].Token, + lagoonCLIConfig.Lagoons[current].Version, + lagoonCLIVersion, + debug) + notification := &schema.AddNotificationSlackInput{ + Name: name, + Webhook: webhook, + } + result, err := lagoon.AddNotificationSlack(context.TODO(), notification, lc) + if err != nil { + return err + } + data := []output.Data{ + []string{ + returnNonEmptyString(fmt.Sprintf("%v", result.ID)), + returnNonEmptyString(fmt.Sprintf("%v", result.Name)), + returnNonEmptyString(fmt.Sprintf("%v", result.Webhook)), + returnNonEmptyString(fmt.Sprintf("%v", result.Channel)), + }, + } + output.RenderOutput(output.Table{ + Header: []string{ + "ID", + "Name", + "Webhook", + "Channel", + }, + Data: data, + }, outputOptions) + } + return nil }, } -var addProjectSlackNotificationCmd = &cobra.Command{ +var addProjectNotificationSlackCmd = &cobra.Command{ Use: "project-slack", Aliases: []string{"ps"}, Short: "Add a Slack notification to a project", Long: `Add a Slack notification to a project This command is used to add an existing Slack notification in Lagoon to a project.`, - Run: func(cmd *cobra.Command, args []string) { - notificationFlags := parseNotificationFlags(*cmd.Flags()) - if notificationFlags.Project == "" || notificationFlags.NotificationName == "" { - fmt.Println("Missing arguments: Project name or notification name are not defined") - cmd.Help() - os.Exit(1) - } - addResult, err := pClient.AddSlackNotificationToProject(notificationFlags.Project, notificationFlags.NotificationName) - handleError(err) - var resultMap map[string]interface{} - err = json.Unmarshal([]byte(addResult), &resultMap) - handleError(err) - resultData := output.Result{ - Result: "success", - ResultData: resultMap, - } - output.RenderResult(resultData, outputOptions) + PreRunE: func(_ *cobra.Command, _ []string) error { + return validateTokenE(lagoonCLIConfig.Current) + }, + RunE: func(cmd *cobra.Command, args []string) error { + debug, err := cmd.Flags().GetBool("debug") + if err != nil { + return err + } + name, err := cmd.Flags().GetString("name") + if err != nil { + return err + } + if name == "" || cmdProjectName == "" { + return fmt.Errorf("Missing arguments: project name or notification name is not defined") + } + if yesNo(fmt.Sprintf("You are attempting to add Slack notification '%s' to project '%s', are you sure?", name, cmdProjectName)) { + current := lagoonCLIConfig.Current + lc := client.New( + lagoonCLIConfig.Lagoons[current].GraphQL, + lagoonCLIConfig.Lagoons[current].Token, + lagoonCLIConfig.Lagoons[current].Version, + lagoonCLIVersion, + debug) + notification := &schema.AddNotificationToProjectInput{ + NotificationType: api.SlackNotification, + NotificationName: name, + Project: cmdProjectName, + } + _, err := lagoon.AddNotificationToProject(context.TODO(), notification, lc) + if err != nil { + return err + } + resultData := output.Result{ + Result: "success", + } + output.RenderResult(resultData, outputOptions) + } + return nil + }, +} + +var listProjectSlacksCmd = &cobra.Command{ + Use: "project-slack", + Aliases: []string{"ps"}, + Short: "List Slacks details about a project (alias: ps)", + PreRunE: func(_ *cobra.Command, _ []string) error { + return validateTokenE(lagoonCLIConfig.Current) + }, + RunE: func(cmd *cobra.Command, args []string) error { + debug, err := cmd.Flags().GetBool("debug") + if err != nil { + return err + } + if cmdProjectName == "" { + return fmt.Errorf("Missing arguments: project name is not defined") + } + current := lagoonCLIConfig.Current + lc := client.New( + lagoonCLIConfig.Lagoons[current].GraphQL, + lagoonCLIConfig.Lagoons[current].Token, + lagoonCLIConfig.Lagoons[current].Version, + lagoonCLIVersion, + debug) + result, err := lagoon.GetProjectNotificationSlack(context.TODO(), cmdProjectName, lc) + if err != nil { + return err + } + data := []output.Data{} + for _, notification := range result.Notifications.Slack { + data = append(data, []string{ + returnNonEmptyString(fmt.Sprintf("%v", notification.Name)), + returnNonEmptyString(fmt.Sprintf("%v", notification.Webhook)), + returnNonEmptyString(fmt.Sprintf("%v", notification.Channel)), + }) + } + output.RenderOutput(output.Table{ + Header: []string{ + "Name", + "Webhook", + "Channel", + }, + Data: data, + }, outputOptions) + return nil + }, +} + +var listAllSlacksCmd = &cobra.Command{ + Use: "slack", + Aliases: []string{"s"}, + Short: "List all Slacks notification details (alias: s)", + PreRunE: func(_ *cobra.Command, _ []string) error { + return validateTokenE(lagoonCLIConfig.Current) + }, + RunE: func(cmd *cobra.Command, args []string) error { + debug, err := cmd.Flags().GetBool("debug") + if err != nil { + return err + } + current := lagoonCLIConfig.Current + lc := client.New( + lagoonCLIConfig.Lagoons[current].GraphQL, + lagoonCLIConfig.Lagoons[current].Token, + lagoonCLIConfig.Lagoons[current].Version, + lagoonCLIVersion, + debug) + result, err := lagoon.GetAllNotificationSlack(context.TODO(), lc) + if err != nil { + return err + } + data := []output.Data{} + for _, res := range *result { + b, _ := json.Marshal(res.Notifications.Slack) + if string(b) != "null" { + for _, notif := range res.Notifications.Slack { + data = append(data, []string{ + returnNonEmptyString(fmt.Sprintf("%v", res.Name)), + returnNonEmptyString(fmt.Sprintf("%v", notif.Name)), + returnNonEmptyString(fmt.Sprintf("%v", notif.Webhook)), + returnNonEmptyString(fmt.Sprintf("%v", notif.Channel)), + }) + } + } + } + output.RenderOutput(output.Table{ + Header: []string{ + "Project", + "Name", + "Webhook", + "Channel", + }, + Data: data, + }, outputOptions) + return nil }, } @@ -105,24 +229,44 @@ var deleteProjectSlackNotificationCmd = &cobra.Command{ Use: "project-slack", Aliases: []string{"ps"}, Short: "Delete a Slack notification from a project", - Run: func(cmd *cobra.Command, args []string) { - notificationFlags := parseNotificationFlags(*cmd.Flags()) - if notificationFlags.Project == "" || notificationFlags.NotificationName == "" { - fmt.Println("Missing arguments: Project name or notification name are not defined") - cmd.Help() - os.Exit(1) - } - if yesNo(fmt.Sprintf("You are attempting to delete notification '%s' from project '%s', are you sure?", notificationFlags.NotificationName, notificationFlags.Project)) { - deleteResult, err := pClient.DeleteSlackNotificationFromProject(notificationFlags.Project, notificationFlags.NotificationName) - handleError(err) - var addedProject api.NotificationSlack - err = json.Unmarshal([]byte(deleteResult), &addedProject) - handleError(err) + PreRunE: func(_ *cobra.Command, _ []string) error { + return validateTokenE(lagoonCLIConfig.Current) + }, + RunE: func(cmd *cobra.Command, args []string) error { + debug, err := cmd.Flags().GetBool("debug") + if err != nil { + return err + } + name, err := cmd.Flags().GetString("name") + if err != nil { + return err + } + if name == "" || cmdProjectName == "" { + return fmt.Errorf("Missing arguments: project name or notification name is not defined") + } + if yesNo(fmt.Sprintf("You are attempting to delete Slack notification '%s' from project '%s', are you sure?", name, cmdProjectName)) { + current := lagoonCLIConfig.Current + lc := client.New( + lagoonCLIConfig.Lagoons[current].GraphQL, + lagoonCLIConfig.Lagoons[current].Token, + lagoonCLIConfig.Lagoons[current].Version, + lagoonCLIVersion, + debug) + notification := &schema.RemoveNotificationFromProjectInput{ + NotificationType: api.SlackNotification, + NotificationName: name, + Project: cmdProjectName, + } + _, err := lagoon.RemoveNotificationFromProject(context.TODO(), notification, lc) + if err != nil { + return err + } resultData := output.Result{ Result: "success", } output.RenderResult(resultData, outputOptions) } + return nil }, } @@ -130,23 +274,39 @@ var deleteSlackNotificationCmd = &cobra.Command{ Use: "slack", Aliases: []string{"s"}, Short: "Delete a Slack notification from Lagoon", - Run: func(cmd *cobra.Command, args []string) { - notificationFlags := parseNotificationFlags(*cmd.Flags()) - if notificationFlags.NotificationName == "" { - fmt.Println("Missing arguments: Notification name is not defined") - cmd.Help() - os.Exit(1) - } - fmt.Println(fmt.Sprintf("Deleting notification %s", notificationFlags.NotificationName)) - - if yesNo(fmt.Sprintf("You are attempting to delete notification '%s' from Lagoon, are you sure?", notificationFlags.NotificationName)) { - deleteResult, err := pClient.DeleteSlackNotification(notificationFlags.NotificationName) - handleError(err) + PreRunE: func(_ *cobra.Command, _ []string) error { + return validateTokenE(lagoonCLIConfig.Current) + }, + RunE: func(cmd *cobra.Command, args []string) error { + debug, err := cmd.Flags().GetBool("debug") + if err != nil { + return err + } + name, err := cmd.Flags().GetString("name") + if err != nil { + return err + } + if name == "" { + return fmt.Errorf("Missing arguments: notification name is not defined") + } + if yesNo(fmt.Sprintf("You are attempting to delete Slack notification '%s', are you sure?", name)) { + current := lagoonCLIConfig.Current + lc := client.New( + lagoonCLIConfig.Lagoons[current].GraphQL, + lagoonCLIConfig.Lagoons[current].Token, + lagoonCLIConfig.Lagoons[current].Version, + lagoonCLIVersion, + debug) + result, err := lagoon.DeleteNotificationSlack(context.TODO(), name, lc) + if err != nil { + return err + } resultData := output.Result{ - Result: string(deleteResult), + Result: result.DeleteNotification, } output.RenderResult(resultData, outputOptions) } + return nil }, } @@ -154,52 +314,92 @@ var updateSlackNotificationCmd = &cobra.Command{ Use: "slack", Aliases: []string{"s"}, Short: "Update an existing Slack notification", - Run: func(cmd *cobra.Command, args []string) { - notificationFlags := parseNotificationFlags(*cmd.Flags()) - if notificationFlags.NotificationName == "" { - fmt.Println("Missing arguments: Current notification name is not defined") - cmd.Help() - os.Exit(1) - } - oldName := notificationFlags.NotificationName - // if we have a new name, shuffle around the name - if notificationFlags.NotificationNewName != "" { - newName := notificationFlags.NotificationNewName - notificationFlags.NotificationName = newName - } - notificationFlags.NotificationOldName = oldName - if jsonPatch == "" { - jsonPatchBytes, err := json.Marshal(notificationFlags) - handleError(err) - jsonPatch = string(jsonPatchBytes) - } - updateResult, err := pClient.UpdateSlackNotification(notificationFlags.NotificationOldName, jsonPatch) - handleError(err) - var resultMap map[string]interface{} - err = json.Unmarshal([]byte(updateResult), &resultMap) - handleError(err) - resultData := output.Result{ - Result: "success", - ResultData: resultMap, - } - output.RenderResult(resultData, outputOptions) + PreRunE: func(_ *cobra.Command, _ []string) error { + return validateTokenE(lagoonCLIConfig.Current) }, -} - -func init() { - addSlackNotificationCmd.Flags().StringVarP(¬ificationName, "name", "n", "", "The name of the notification") - addSlackNotificationCmd.Flags().StringVarP(¬ificationWebhook, "webhook", "w", "", "The webhook URL of the notification") - addSlackNotificationCmd.Flags().StringVarP(¬ificationChannel, "channel", "c", "", "The channel for the notification") + RunE: func(cmd *cobra.Command, args []string) error { + debug, err := cmd.Flags().GetBool("debug") + if err != nil { + return err + } + name, err := cmd.Flags().GetString("name") + if err != nil { + return err + } + newname, err := cmd.Flags().GetString("newname") + if err != nil { + return err + } + webhook, err := cmd.Flags().GetString("webhook") + if err != nil { + return err + } + channel, err := cmd.Flags().GetString("channel") + if err != nil { + return err + } + if name == "" { + return fmt.Errorf("Missing arguments: notification name is not defined") + } + patch := schema.AddNotificationSlackInput{ + Name: newname, + Webhook: webhook, + Channel: channel, + } + b1, _ := json.Marshal(patch) + if bytes.Equal(b1, []byte("{}")) { + return fmt.Errorf("Missing arguments: either channel, webhook, or newname must be defined") + } - addProjectSlackNotificationCmd.Flags().StringVarP(¬ificationName, "name", "n", "", "The name of the notification") + if yesNo(fmt.Sprintf("You are attempting to update Slack notification '%s', are you sure?", name)) { + current := lagoonCLIConfig.Current + lc := client.New( + lagoonCLIConfig.Lagoons[current].GraphQL, + lagoonCLIConfig.Lagoons[current].Token, + lagoonCLIConfig.Lagoons[current].Version, + lagoonCLIVersion, + debug) - deleteProjectSlackNotificationCmd.Flags().StringVarP(¬ificationName, "name", "n", "", "The name of the notification") - deleteSlackNotificationCmd.Flags().StringVarP(¬ificationName, "name", "n", "", "The name of the notification") + notification := &schema.UpdateNotificationSlackInput{ + Name: name, + Patch: patch, + } + result, err := lagoon.UpdateNotificationSlack(context.TODO(), notification, lc) + if err != nil { + return err + } + data := []output.Data{ + []string{ + returnNonEmptyString(fmt.Sprintf("%v", result.ID)), + returnNonEmptyString(fmt.Sprintf("%v", result.Name)), + returnNonEmptyString(fmt.Sprintf("%v", result.Webhook)), + returnNonEmptyString(fmt.Sprintf("%v", result.Channel)), + }, + } + output.RenderOutput(output.Table{ + Header: []string{ + "ID", + "Name", + "Webhook", + "Channel", + }, + Data: data, + }, outputOptions) + } + return nil + }, +} - updateSlackNotificationCmd.Flags().StringVarP(¬ificationName, "name", "n", "", "The current name of the notification") - updateSlackNotificationCmd.Flags().StringVarP(¬ificationNewName, "newname", "N", "", "The name of the notification") - updateSlackNotificationCmd.Flags().StringVarP(¬ificationWebhook, "webhook", "w", "", "The webhook URL of the notification") - updateSlackNotificationCmd.Flags().StringVarP(¬ificationChannel, "channel", "c", "", "The channel for the notification") +func init() { + addNotificationSlackCmd.Flags().StringP("name", "n", "", "The name of the notification") + addNotificationSlackCmd.Flags().StringP("webhook", "w", "", "The webhook URL of the notification") + addNotificationSlackCmd.Flags().StringP("channel", "c", "", "The channel for the notification") + addProjectNotificationSlackCmd.Flags().StringP("name", "n", "", "The name of the notification") + deleteProjectSlackNotificationCmd.Flags().StringP("name", "n", "", "The name of the notification") + deleteSlackNotificationCmd.Flags().StringP("name", "n", "", "The name of the notification") + updateSlackNotificationCmd.Flags().StringP("name", "n", "", "The current name of the notification") + updateSlackNotificationCmd.Flags().StringP("newname", "N", "", "The name of the notification") + updateSlackNotificationCmd.Flags().StringP("webhook", "w", "", "The webhook URL of the notification") + updateSlackNotificationCmd.Flags().StringP("channel", "c", "", "The channel for the notification") - updateSlackNotificationCmd.Flags().StringVarP(&jsonPatch, "json", "j", "", "JSON string to patch") } diff --git a/cmd/notificationsteams.go b/cmd/notificationsteams.go new file mode 100644 index 00000000..3f7281ad --- /dev/null +++ b/cmd/notificationsteams.go @@ -0,0 +1,385 @@ +package cmd + +import ( + "bytes" + "context" + "encoding/json" + "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/internal/schema" + "github.com/uselagoon/lagoon-cli/pkg/api" + "github.com/uselagoon/lagoon-cli/pkg/output" +) + +var addNotificationMicrosoftTeamsCmd = &cobra.Command{ + Use: "microsoftteams", + Short: "Add a new Microsoft Teams notification", + Long: `Add a new Microsoft Teams notification +This command is used to set up a new Microsoft Teams notification in Lagoon. This requires information to talk to the webhook like the webhook URL. +It does not configure a project to send notifications to Microsoft Teams though, you need to use project-microsoftteams for that.`, + Aliases: []string{"m"}, + PreRunE: func(_ *cobra.Command, _ []string) error { + return validateTokenE(lagoonCLIConfig.Current) + }, + RunE: func(cmd *cobra.Command, args []string) error { + debug, err := cmd.Flags().GetBool("debug") + if err != nil { + return err + } + name, err := cmd.Flags().GetString("name") + if err != nil { + return err + } + webhook, err := cmd.Flags().GetString("webhook") + if err != nil { + return err + } + if name == "" || webhook == "" { + return fmt.Errorf("Missing arguments: name or webhook is not defined") + } + if yesNo(fmt.Sprintf("You are attempting to create a Microsoft Teams notification '%s' with webhook url '%s', are you sure?", name, webhook)) { + current := lagoonCLIConfig.Current + lc := client.New( + lagoonCLIConfig.Lagoons[current].GraphQL, + lagoonCLIConfig.Lagoons[current].Token, + lagoonCLIConfig.Lagoons[current].Version, + lagoonCLIVersion, + debug) + notification := &schema.AddNotificationMicrosoftTeamsInput{ + Name: name, + Webhook: webhook, + } + result, err := lagoon.AddNotificationMicrosoftTeams(context.TODO(), notification, lc) + if err != nil { + return err + } + data := []output.Data{ + []string{ + returnNonEmptyString(fmt.Sprintf("%v", result.ID)), + returnNonEmptyString(fmt.Sprintf("%v", result.Name)), + returnNonEmptyString(fmt.Sprintf("%v", result.Webhook)), + }, + } + output.RenderOutput(output.Table{ + Header: []string{ + "ID", + "Name", + "Webhook", + }, + Data: data, + }, outputOptions) + } + return nil + }, +} + +var addProjectNotificationMicrosoftTeamsCmd = &cobra.Command{ + Use: "project-microsoftteams", + Aliases: []string{"pm"}, + Short: "Add a Microsoft Teams notification to a project", + Long: `Add a Microsoft Teams notification to a project +This command is used to add an existing Microsoft Teams notification in Lagoon to a project.`, + PreRunE: func(_ *cobra.Command, _ []string) error { + return validateTokenE(lagoonCLIConfig.Current) + }, + RunE: func(cmd *cobra.Command, args []string) error { + debug, err := cmd.Flags().GetBool("debug") + if err != nil { + return err + } + name, err := cmd.Flags().GetString("name") + if err != nil { + return err + } + if name == "" || cmdProjectName == "" { + return fmt.Errorf("Missing arguments: project name or notification name is not defined") + } + if yesNo(fmt.Sprintf("You are attempting to add Microsoft Teams notification '%s' to project '%s', are you sure?", name, cmdProjectName)) { + current := lagoonCLIConfig.Current + lc := client.New( + lagoonCLIConfig.Lagoons[current].GraphQL, + lagoonCLIConfig.Lagoons[current].Token, + lagoonCLIConfig.Lagoons[current].Version, + lagoonCLIVersion, + debug) + notification := &schema.AddNotificationToProjectInput{ + NotificationType: api.MicrosoftTeamsNotification, + NotificationName: name, + Project: cmdProjectName, + } + _, err := lagoon.AddNotificationToProject(context.TODO(), notification, lc) + if err != nil { + return err + } + resultData := output.Result{ + Result: "success", + } + output.RenderResult(resultData, outputOptions) + } + return nil + }, +} + +var listProjectMicrosoftTeamsCmd = &cobra.Command{ + Use: "project-microsoftteams", + Aliases: []string{"pm"}, + Short: "List Microsoft Teams details about a project (alias: pm)", + PreRunE: func(_ *cobra.Command, _ []string) error { + return validateTokenE(lagoonCLIConfig.Current) + }, + RunE: func(cmd *cobra.Command, args []string) error { + debug, err := cmd.Flags().GetBool("debug") + if err != nil { + return err + } + if cmdProjectName == "" { + return fmt.Errorf("Missing arguments: project name is not defined") + } + current := lagoonCLIConfig.Current + lc := client.New( + lagoonCLIConfig.Lagoons[current].GraphQL, + lagoonCLIConfig.Lagoons[current].Token, + lagoonCLIConfig.Lagoons[current].Version, + lagoonCLIVersion, + debug) + result, err := lagoon.GetProjectNotificationMicrosoftTeams(context.TODO(), cmdProjectName, lc) + if err != nil { + return err + } + data := []output.Data{} + for _, notification := range result.Notifications.MicrosoftTeams { + data = append(data, []string{ + returnNonEmptyString(fmt.Sprintf("%v", notification.Name)), + returnNonEmptyString(fmt.Sprintf("%v", notification.Webhook)), + }) + } + output.RenderOutput(output.Table{ + Header: []string{ + "Name", + "Webhook", + }, + Data: data, + }, outputOptions) + return nil + }, +} + +var listAllMicrosoftTeamsCmd = &cobra.Command{ + Use: "microsoftteams", + Aliases: []string{"m"}, + Short: "List all Microsoft Teams notification details (alias: m)", + PreRunE: func(_ *cobra.Command, _ []string) error { + return validateTokenE(lagoonCLIConfig.Current) + }, + RunE: func(cmd *cobra.Command, args []string) error { + debug, err := cmd.Flags().GetBool("debug") + if err != nil { + return err + } + current := lagoonCLIConfig.Current + lc := client.New( + lagoonCLIConfig.Lagoons[current].GraphQL, + lagoonCLIConfig.Lagoons[current].Token, + lagoonCLIConfig.Lagoons[current].Version, + lagoonCLIVersion, + debug) + result, err := lagoon.GetAllNotificationMicrosoftTeams(context.TODO(), lc) + if err != nil { + return err + } + data := []output.Data{} + for _, res := range *result { + b, _ := json.Marshal(res.Notifications.MicrosoftTeams) + if string(b) != "null" { + for _, notif := range res.Notifications.MicrosoftTeams { + data = append(data, []string{ + returnNonEmptyString(fmt.Sprintf("%v", res.Name)), + returnNonEmptyString(fmt.Sprintf("%v", notif.Name)), + returnNonEmptyString(fmt.Sprintf("%v", notif.Webhook)), + }) + } + } + } + output.RenderOutput(output.Table{ + Header: []string{ + "Project", + "Name", + "Webhook", + }, + Data: data, + }, outputOptions) + return nil + }, +} + +var deleteProjectMicrosoftTeamsNotificationCmd = &cobra.Command{ + Use: "project-microsoftteams", + Aliases: []string{"pr"}, + Short: "Delete a Microsoft Teams notification from a project", + PreRunE: func(_ *cobra.Command, _ []string) error { + return validateTokenE(lagoonCLIConfig.Current) + }, + RunE: func(cmd *cobra.Command, args []string) error { + debug, err := cmd.Flags().GetBool("debug") + if err != nil { + return err + } + name, err := cmd.Flags().GetString("name") + if err != nil { + return err + } + if name == "" || cmdProjectName == "" { + return fmt.Errorf("Missing arguments: project name or notification name is not defined") + } + if yesNo(fmt.Sprintf("You are attempting to delete Microsoft Teams notification '%s' from project '%s', are you sure?", name, cmdProjectName)) { + current := lagoonCLIConfig.Current + lc := client.New( + lagoonCLIConfig.Lagoons[current].GraphQL, + lagoonCLIConfig.Lagoons[current].Token, + lagoonCLIConfig.Lagoons[current].Version, + lagoonCLIVersion, + debug) + notification := &schema.RemoveNotificationFromProjectInput{ + NotificationType: api.MicrosoftTeamsNotification, + NotificationName: name, + Project: cmdProjectName, + } + _, err := lagoon.RemoveNotificationFromProject(context.TODO(), notification, lc) + if err != nil { + return err + } + resultData := output.Result{ + Result: "success", + } + output.RenderResult(resultData, outputOptions) + } + return nil + }, +} + +var deleteMicrosoftTeamsNotificationCmd = &cobra.Command{ + Use: "microsoftteams", + Aliases: []string{"m"}, + Short: "Delete a Microsoft Teams notification from Lagoon", + PreRunE: func(_ *cobra.Command, _ []string) error { + return validateTokenE(lagoonCLIConfig.Current) + }, + RunE: func(cmd *cobra.Command, args []string) error { + debug, err := cmd.Flags().GetBool("debug") + if err != nil { + return err + } + name, err := cmd.Flags().GetString("name") + if err != nil { + return err + } + if name == "" { + return fmt.Errorf("Missing arguments: notification name is not defined") + } + if yesNo(fmt.Sprintf("You are attempting to delete Microsoft Teams notification '%s', are you sure?", name)) { + current := lagoonCLIConfig.Current + lc := client.New( + lagoonCLIConfig.Lagoons[current].GraphQL, + lagoonCLIConfig.Lagoons[current].Token, + lagoonCLIConfig.Lagoons[current].Version, + lagoonCLIVersion, + debug) + result, err := lagoon.DeleteNotificationMicrosoftTeams(context.TODO(), name, lc) + if err != nil { + return err + } + resultData := output.Result{ + Result: result.DeleteNotification, + } + output.RenderResult(resultData, outputOptions) + } + return nil + }, +} + +var updateMicrosoftTeamsNotificationCmd = &cobra.Command{ + Use: "microsoftteams", + Aliases: []string{"m"}, + Short: "Update an existing Microsoft Teams notification", + PreRunE: func(_ *cobra.Command, _ []string) error { + return validateTokenE(lagoonCLIConfig.Current) + }, + RunE: func(cmd *cobra.Command, args []string) error { + debug, err := cmd.Flags().GetBool("debug") + if err != nil { + return err + } + name, err := cmd.Flags().GetString("name") + if err != nil { + return err + } + newname, err := cmd.Flags().GetString("newname") + if err != nil { + return err + } + webhook, err := cmd.Flags().GetString("webhook") + if err != nil { + return err + } + if name == "" { + return fmt.Errorf("Missing arguments: notification name is not defined") + } + patch := schema.AddNotificationMicrosoftTeamsInput{ + Name: newname, + Webhook: webhook, + } + b1, _ := json.Marshal(patch) + if bytes.Equal(b1, []byte("{}")) { + return fmt.Errorf("Missing arguments: either webhook or newname must be defined") + } + + if yesNo(fmt.Sprintf("You are attempting to update Microsoft Teams notification '%s', are you sure?", name)) { + current := lagoonCLIConfig.Current + lc := client.New( + lagoonCLIConfig.Lagoons[current].GraphQL, + lagoonCLIConfig.Lagoons[current].Token, + lagoonCLIConfig.Lagoons[current].Version, + lagoonCLIVersion, + debug) + + notification := &schema.UpdateNotificationMicrosoftTeamsInput{ + Name: name, + Patch: patch, + } + result, err := lagoon.UpdateNotificationMicrosoftTeams(context.TODO(), notification, lc) + if err != nil { + return err + } + data := []output.Data{ + []string{ + returnNonEmptyString(fmt.Sprintf("%v", result.ID)), + returnNonEmptyString(fmt.Sprintf("%v", result.Name)), + returnNonEmptyString(fmt.Sprintf("%v", result.Webhook)), + }, + } + output.RenderOutput(output.Table{ + Header: []string{ + "ID", + "Name", + "Webhook", + }, + Data: data, + }, outputOptions) + } + return nil + }, +} + +func init() { + addNotificationMicrosoftTeamsCmd.Flags().StringP("name", "n", "", "The name of the notification") + addNotificationMicrosoftTeamsCmd.Flags().StringP("webhook", "w", "", "The webhook URL of the notification") + addProjectNotificationMicrosoftTeamsCmd.Flags().StringP("name", "n", "", "The name of the notification") + deleteProjectMicrosoftTeamsNotificationCmd.Flags().StringP("name", "n", "", "The name of the notification") + deleteMicrosoftTeamsNotificationCmd.Flags().StringP("name", "n", "", "The name of the notification") + updateMicrosoftTeamsNotificationCmd.Flags().StringP("name", "n", "", "The name of the notification") + updateMicrosoftTeamsNotificationCmd.Flags().StringP("newname", "N", "", "The name of the notification") + updateMicrosoftTeamsNotificationCmd.Flags().StringP("webhook", "w", "", "The webhook URL of the notification") +} diff --git a/cmd/notificationswebhook.go b/cmd/notificationswebhook.go new file mode 100644 index 00000000..f6703417 --- /dev/null +++ b/cmd/notificationswebhook.go @@ -0,0 +1,385 @@ +package cmd + +import ( + "bytes" + "context" + "encoding/json" + "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/internal/schema" + "github.com/uselagoon/lagoon-cli/pkg/api" + "github.com/uselagoon/lagoon-cli/pkg/output" +) + +var addNotificationWebhookCmd = &cobra.Command{ + Use: "webhook", + Short: "Add a new webhook notification", + Long: `Add a new webhook notification +This command is used to set up a new webhook notification in Lagoon. This requires information to talk to the webhook like the webhook URL. +It does not configure a project to send notifications to webhook though, you need to use project-webhook for that.`, + Aliases: []string{"w"}, + PreRunE: func(_ *cobra.Command, _ []string) error { + return validateTokenE(lagoonCLIConfig.Current) + }, + RunE: func(cmd *cobra.Command, args []string) error { + debug, err := cmd.Flags().GetBool("debug") + if err != nil { + return err + } + name, err := cmd.Flags().GetString("name") + if err != nil { + return err + } + webhook, err := cmd.Flags().GetString("webhook") + if err != nil { + return err + } + if name == "" || webhook == "" { + return fmt.Errorf("Missing arguments: name or webhook is not defined") + } + if yesNo(fmt.Sprintf("You are attempting to create a webhook notification '%s' with webhook url '%s', are you sure?", name, webhook)) { + current := lagoonCLIConfig.Current + lc := client.New( + lagoonCLIConfig.Lagoons[current].GraphQL, + lagoonCLIConfig.Lagoons[current].Token, + lagoonCLIConfig.Lagoons[current].Version, + lagoonCLIVersion, + debug) + notification := &schema.AddNotificationWebhookInput{ + Name: name, + Webhook: webhook, + } + result, err := lagoon.AddNotificationWebhook(context.TODO(), notification, lc) + if err != nil { + return err + } + data := []output.Data{ + []string{ + returnNonEmptyString(fmt.Sprintf("%v", result.ID)), + returnNonEmptyString(fmt.Sprintf("%v", result.Name)), + returnNonEmptyString(fmt.Sprintf("%v", result.Webhook)), + }, + } + output.RenderOutput(output.Table{ + Header: []string{ + "ID", + "Name", + "Webhook", + }, + Data: data, + }, outputOptions) + } + return nil + }, +} + +var addProjectNotificationWebhookCmd = &cobra.Command{ + Use: "project-webhook", + Aliases: []string{"pe"}, + Short: "Add a webhook notification to a project", + Long: `Add a webhook notification to a project +This command is used to add an existing webhook notification in Lagoon to a project.`, + PreRunE: func(_ *cobra.Command, _ []string) error { + return validateTokenE(lagoonCLIConfig.Current) + }, + RunE: func(cmd *cobra.Command, args []string) error { + debug, err := cmd.Flags().GetBool("debug") + if err != nil { + return err + } + name, err := cmd.Flags().GetString("name") + if err != nil { + return err + } + if name == "" || cmdProjectName == "" { + return fmt.Errorf("Missing arguments: project name or notification name is not defined") + } + if yesNo(fmt.Sprintf("You are attempting to add webhook notification '%s' to project '%s', are you sure?", name, cmdProjectName)) { + current := lagoonCLIConfig.Current + lc := client.New( + lagoonCLIConfig.Lagoons[current].GraphQL, + lagoonCLIConfig.Lagoons[current].Token, + lagoonCLIConfig.Lagoons[current].Version, + lagoonCLIVersion, + debug) + notification := &schema.AddNotificationToProjectInput{ + NotificationType: api.WebhookNotification, + NotificationName: name, + Project: cmdProjectName, + } + _, err := lagoon.AddNotificationToProject(context.TODO(), notification, lc) + if err != nil { + return err + } + resultData := output.Result{ + Result: "success", + } + output.RenderResult(resultData, outputOptions) + } + return nil + }, +} + +var listProjectWebhooksCmd = &cobra.Command{ + Use: "project-webhook", + Aliases: []string{"pw"}, + Short: "List webhook details about a project (alias: pw)", + PreRunE: func(_ *cobra.Command, _ []string) error { + return validateTokenE(lagoonCLIConfig.Current) + }, + RunE: func(cmd *cobra.Command, args []string) error { + debug, err := cmd.Flags().GetBool("debug") + if err != nil { + return err + } + if cmdProjectName == "" { + return fmt.Errorf("Missing arguments: project name is not defined") + } + current := lagoonCLIConfig.Current + lc := client.New( + lagoonCLIConfig.Lagoons[current].GraphQL, + lagoonCLIConfig.Lagoons[current].Token, + lagoonCLIConfig.Lagoons[current].Version, + lagoonCLIVersion, + debug) + result, err := lagoon.GetProjectNotificationWebhook(context.TODO(), cmdProjectName, lc) + if err != nil { + return err + } + data := []output.Data{} + for _, notification := range result.Notifications.Webhook { + data = append(data, []string{ + returnNonEmptyString(fmt.Sprintf("%v", notification.Name)), + returnNonEmptyString(fmt.Sprintf("%v", notification.Webhook)), + }) + } + output.RenderOutput(output.Table{ + Header: []string{ + "Name", + "Webhook", + }, + Data: data, + }, outputOptions) + return nil + }, +} + +var listAllWebhooksCmd = &cobra.Command{ + Use: "webhook", + Aliases: []string{"w"}, + Short: "List all webhook notification details (alias: w)", + PreRunE: func(_ *cobra.Command, _ []string) error { + return validateTokenE(lagoonCLIConfig.Current) + }, + RunE: func(cmd *cobra.Command, args []string) error { + debug, err := cmd.Flags().GetBool("debug") + if err != nil { + return err + } + current := lagoonCLIConfig.Current + lc := client.New( + lagoonCLIConfig.Lagoons[current].GraphQL, + lagoonCLIConfig.Lagoons[current].Token, + lagoonCLIConfig.Lagoons[current].Version, + lagoonCLIVersion, + debug) + result, err := lagoon.GetAllNotificationWebhook(context.TODO(), lc) + if err != nil { + return err + } + data := []output.Data{} + for _, res := range *result { + b, _ := json.Marshal(res.Notifications.Webhook) + if string(b) != "null" { + for _, notif := range res.Notifications.Webhook { + data = append(data, []string{ + returnNonEmptyString(fmt.Sprintf("%v", res.Name)), + returnNonEmptyString(fmt.Sprintf("%v", notif.Name)), + returnNonEmptyString(fmt.Sprintf("%v", notif.Webhook)), + }) + } + } + } + output.RenderOutput(output.Table{ + Header: []string{ + "Project", + "Name", + "Webhook", + }, + Data: data, + }, outputOptions) + return nil + }, +} + +var deleteProjectWebhookNotificationCmd = &cobra.Command{ + Use: "project-webhook", + Aliases: []string{"pr"}, + Short: "Delete a webhook notification from a project", + PreRunE: func(_ *cobra.Command, _ []string) error { + return validateTokenE(lagoonCLIConfig.Current) + }, + RunE: func(cmd *cobra.Command, args []string) error { + debug, err := cmd.Flags().GetBool("debug") + if err != nil { + return err + } + name, err := cmd.Flags().GetString("name") + if err != nil { + return err + } + if name == "" || cmdProjectName == "" { + return fmt.Errorf("Missing arguments: project name or notification name is not defined") + } + if yesNo(fmt.Sprintf("You are attempting to delete webhook notification '%s' from project '%s', are you sure?", name, cmdProjectName)) { + current := lagoonCLIConfig.Current + lc := client.New( + lagoonCLIConfig.Lagoons[current].GraphQL, + lagoonCLIConfig.Lagoons[current].Token, + lagoonCLIConfig.Lagoons[current].Version, + lagoonCLIVersion, + debug) + notification := &schema.RemoveNotificationFromProjectInput{ + NotificationType: api.WebhookNotification, + NotificationName: name, + Project: cmdProjectName, + } + _, err := lagoon.RemoveNotificationFromProject(context.TODO(), notification, lc) + if err != nil { + return err + } + resultData := output.Result{ + Result: "success", + } + output.RenderResult(resultData, outputOptions) + } + return nil + }, +} + +var deleteWebhookNotificationCmd = &cobra.Command{ + Use: "webhook", + Aliases: []string{"w"}, + Short: "Delete a webhook notification from Lagoon", + PreRunE: func(_ *cobra.Command, _ []string) error { + return validateTokenE(lagoonCLIConfig.Current) + }, + RunE: func(cmd *cobra.Command, args []string) error { + debug, err := cmd.Flags().GetBool("debug") + if err != nil { + return err + } + name, err := cmd.Flags().GetString("name") + if err != nil { + return err + } + if name == "" { + return fmt.Errorf("Missing arguments: notification name is not defined") + } + if yesNo(fmt.Sprintf("You are attempting to delete webhook notification '%s', are you sure?", name)) { + current := lagoonCLIConfig.Current + lc := client.New( + lagoonCLIConfig.Lagoons[current].GraphQL, + lagoonCLIConfig.Lagoons[current].Token, + lagoonCLIConfig.Lagoons[current].Version, + lagoonCLIVersion, + debug) + result, err := lagoon.DeleteNotificationWebhook(context.TODO(), name, lc) + if err != nil { + return err + } + resultData := output.Result{ + Result: result.DeleteNotification, + } + output.RenderResult(resultData, outputOptions) + } + return nil + }, +} + +var updateWebhookNotificationCmd = &cobra.Command{ + Use: "webhook", + Aliases: []string{"w"}, + Short: "Update an existing webhook notification", + PreRunE: func(_ *cobra.Command, _ []string) error { + return validateTokenE(lagoonCLIConfig.Current) + }, + RunE: func(cmd *cobra.Command, args []string) error { + debug, err := cmd.Flags().GetBool("debug") + if err != nil { + return err + } + name, err := cmd.Flags().GetString("name") + if err != nil { + return err + } + newname, err := cmd.Flags().GetString("newname") + if err != nil { + return err + } + webhook, err := cmd.Flags().GetString("webhook") + if err != nil { + return err + } + if name == "" { + return fmt.Errorf("Missing arguments: notification name is not defined") + } + patch := schema.AddNotificationWebhookInput{ + Name: newname, + Webhook: webhook, + } + b1, _ := json.Marshal(patch) + if bytes.Equal(b1, []byte("{}")) { + return fmt.Errorf("Missing arguments: either webhook or newname must be defined") + } + + if yesNo(fmt.Sprintf("You are attempting to update webhook notification '%s', are you sure?", name)) { + current := lagoonCLIConfig.Current + lc := client.New( + lagoonCLIConfig.Lagoons[current].GraphQL, + lagoonCLIConfig.Lagoons[current].Token, + lagoonCLIConfig.Lagoons[current].Version, + lagoonCLIVersion, + debug) + + notification := &schema.UpdateNotificationWebhookInput{ + Name: name, + Patch: patch, + } + result, err := lagoon.UpdateNotificationWebhook(context.TODO(), notification, lc) + if err != nil { + return err + } + data := []output.Data{ + []string{ + returnNonEmptyString(fmt.Sprintf("%v", result.ID)), + returnNonEmptyString(fmt.Sprintf("%v", result.Name)), + returnNonEmptyString(fmt.Sprintf("%v", result.Webhook)), + }, + } + output.RenderOutput(output.Table{ + Header: []string{ + "ID", + "Name", + "Webhook", + }, + Data: data, + }, outputOptions) + } + return nil + }, +} + +func init() { + addNotificationWebhookCmd.Flags().StringP("name", "n", "", "The name of the notification") + addNotificationWebhookCmd.Flags().StringP("webhook", "w", "", "The webhook URL of the notification") + addProjectNotificationWebhookCmd.Flags().StringP("name", "n", "", "The name of the notification") + deleteProjectWebhookNotificationCmd.Flags().StringP("name", "n", "", "The name of the notification") + deleteWebhookNotificationCmd.Flags().StringP("name", "n", "", "The name of the notification") + updateWebhookNotificationCmd.Flags().StringP("name", "n", "", "The name of the notification") + updateWebhookNotificationCmd.Flags().StringP("newname", "N", "", "The name of the notification") + updateWebhookNotificationCmd.Flags().StringP("webhook", "w", "", "The webhook URL of the notification") +} diff --git a/cmd/update.go b/cmd/update.go index 64496636..4add661a 100644 --- a/cmd/update.go +++ b/cmd/update.go @@ -13,10 +13,18 @@ var updateCmd = &cobra.Command{ }, } +var updateNotificationCmd = &cobra.Command{ + Use: "notification", + Aliases: []string{"n"}, + Short: "List all notifications or notifications on projects", + PersistentPreRun: func(cmd *cobra.Command, args []string) { + validateToken(lagoonCLIConfig.Current) // get a new token if the current one is invalid + }, +} + func init() { updateCmd.AddCommand(updateProjectCmd) - updateCmd.AddCommand(updateRocketChatNotificationCmd) - updateCmd.AddCommand(updateSlackNotificationCmd) + updateCmd.AddCommand(updateNotificationCmd) updateCmd.AddCommand(updateUserCmd) updateCmd.AddCommand(updateDeployTargetConfigCmd) updateCmd.AddCommand(updateDeployTargetCmd) diff --git a/docs/commands/lagoon_add.md b/docs/commands/lagoon_add.md index 7e48601b..e54917c5 100644 --- a/docs/commands/lagoon_add.md +++ b/docs/commands/lagoon_add.md @@ -35,12 +35,9 @@ Add a project, or add notifications and variables to projects or environments * [lagoon add deploytarget](lagoon_add_deploytarget.md) - Add a DeployTarget to lagoon * [lagoon add deploytarget-config](lagoon_add_deploytarget-config.md) - Add deploytarget config to a project * [lagoon add group](lagoon_add_group.md) - Add a group to lagoon +* [lagoon add notification](lagoon_add_notification.md) - Add notifications or add notifications to projects * [lagoon add project](lagoon_add_project.md) - Add a new project to Lagoon * [lagoon add project-group](lagoon_add_project-group.md) - Add a project to a group in lagoon -* [lagoon add project-rocketchat](lagoon_add_project-rocketchat.md) - Add a Rocket.Chat notification to a project -* [lagoon add project-slack](lagoon_add_project-slack.md) - Add a Slack notification to a project -* [lagoon add rocketchat](lagoon_add_rocketchat.md) - Add a new Rocket.Chat notification -* [lagoon add slack](lagoon_add_slack.md) - Add a new Slack notification * [lagoon add user](lagoon_add_user.md) - Add a user to lagoon * [lagoon add user-group](lagoon_add_user-group.md) - Add a user to a group in lagoon * [lagoon add user-sshkey](lagoon_add_user-sshkey.md) - Add an SSH key to a user diff --git a/docs/commands/lagoon_add_notification.md b/docs/commands/lagoon_add_notification.md new file mode 100644 index 00000000..44828fc8 --- /dev/null +++ b/docs/commands/lagoon_add_notification.md @@ -0,0 +1,45 @@ +## lagoon add notification + +Add notifications or add notifications to projects + +### Synopsis + +Add notifications or add notifications to projects + +### Options + +``` + -h, --help help for notification +``` + +### 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 add](lagoon_add.md) - Add a project, or add notifications and variables to projects or environments +* [lagoon add notification email](lagoon_add_notification_email.md) - Add a new email notification +* [lagoon add notification microsoftteams](lagoon_add_notification_microsoftteams.md) - Add a new Microsoft Teams notification +* [lagoon add notification project-email](lagoon_add_notification_project-email.md) - Add an email notification to a project +* [lagoon add notification project-microsoftteams](lagoon_add_notification_project-microsoftteams.md) - Add a Microsoft Teams notification to a project +* [lagoon add notification project-rocketchat](lagoon_add_notification_project-rocketchat.md) - Add a RocketChat notification to a project +* [lagoon add notification project-slack](lagoon_add_notification_project-slack.md) - Add a Slack notification to a project +* [lagoon add notification project-webhook](lagoon_add_notification_project-webhook.md) - Add a webhook notification to a project +* [lagoon add notification rocketchat](lagoon_add_notification_rocketchat.md) - Add a new RocketChat notification +* [lagoon add notification slack](lagoon_add_notification_slack.md) - Add a new Slack notification +* [lagoon add notification webhook](lagoon_add_notification_webhook.md) - Add a new webhook notification + diff --git a/docs/commands/lagoon_add_notification_email.md b/docs/commands/lagoon_add_notification_email.md new file mode 100644 index 00000000..e27c0904 --- /dev/null +++ b/docs/commands/lagoon_add_notification_email.md @@ -0,0 +1,43 @@ +## lagoon add notification email + +Add a new email notification + +### Synopsis + +Add a new email notification +This command is used to set up a new email notification in Lagoon. This requires information to talk to the email address to send to. +It does not configure a project to send notifications to email though, you need to use project-email for that. + +``` +lagoon add notification email [flags] +``` + +### Options + +``` + -E, --email string The email address of the notification + -h, --help help for email + -n, --name string The name of the notification +``` + +### 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 add notification](lagoon_add_notification.md) - Add notifications or add notifications to projects + diff --git a/docs/commands/lagoon_add_notification_microsoftteams.md b/docs/commands/lagoon_add_notification_microsoftteams.md new file mode 100644 index 00000000..9d999962 --- /dev/null +++ b/docs/commands/lagoon_add_notification_microsoftteams.md @@ -0,0 +1,43 @@ +## lagoon add notification microsoftteams + +Add a new Microsoft Teams notification + +### Synopsis + +Add a new Microsoft Teams notification +This command is used to set up a new Microsoft Teams notification in Lagoon. This requires information to talk to the webhook like the webhook URL. +It does not configure a project to send notifications to Microsoft Teams though, you need to use project-microsoftteams for that. + +``` +lagoon add notification microsoftteams [flags] +``` + +### Options + +``` + -h, --help help for microsoftteams + -n, --name string The name of the notification + -w, --webhook string The webhook URL of the notification +``` + +### 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 add notification](lagoon_add_notification.md) - Add notifications or add notifications to projects + diff --git a/docs/commands/lagoon_add_notification_project-email.md b/docs/commands/lagoon_add_notification_project-email.md new file mode 100644 index 00000000..ca3922b6 --- /dev/null +++ b/docs/commands/lagoon_add_notification_project-email.md @@ -0,0 +1,41 @@ +## lagoon add notification project-email + +Add an email notification to a project + +### Synopsis + +Add an email notification to a project +This command is used to add an existing email notification in Lagoon to a project. + +``` +lagoon add notification project-email [flags] +``` + +### Options + +``` + -h, --help help for project-email + -n, --name string The name of the notification +``` + +### 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 add notification](lagoon_add_notification.md) - Add notifications or add notifications to projects + diff --git a/docs/commands/lagoon_add_notification_project-microsoftteams.md b/docs/commands/lagoon_add_notification_project-microsoftteams.md new file mode 100644 index 00000000..591edbab --- /dev/null +++ b/docs/commands/lagoon_add_notification_project-microsoftteams.md @@ -0,0 +1,41 @@ +## lagoon add notification project-microsoftteams + +Add a Microsoft Teams notification to a project + +### Synopsis + +Add a Microsoft Teams notification to a project +This command is used to add an existing Microsoft Teams notification in Lagoon to a project. + +``` +lagoon add notification project-microsoftteams [flags] +``` + +### Options + +``` + -h, --help help for project-microsoftteams + -n, --name string The name of the notification +``` + +### 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 add notification](lagoon_add_notification.md) - Add notifications or add notifications to projects + diff --git a/docs/commands/lagoon_add_notification_project-rocketchat.md b/docs/commands/lagoon_add_notification_project-rocketchat.md new file mode 100644 index 00000000..9053205f --- /dev/null +++ b/docs/commands/lagoon_add_notification_project-rocketchat.md @@ -0,0 +1,41 @@ +## lagoon add notification project-rocketchat + +Add a RocketChat notification to a project + +### Synopsis + +Add a RocketChat notification to a project +This command is used to add an existing RocketChat notification in Lagoon to a project. + +``` +lagoon add notification project-rocketchat [flags] +``` + +### Options + +``` + -h, --help help for project-rocketchat + -n, --name string The name of the notification +``` + +### 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 add notification](lagoon_add_notification.md) - Add notifications or add notifications to projects + diff --git a/docs/commands/lagoon_add_notification_project-slack.md b/docs/commands/lagoon_add_notification_project-slack.md new file mode 100644 index 00000000..85a43fef --- /dev/null +++ b/docs/commands/lagoon_add_notification_project-slack.md @@ -0,0 +1,41 @@ +## lagoon add notification project-slack + +Add a Slack notification to a project + +### Synopsis + +Add a Slack notification to a project +This command is used to add an existing Slack notification in Lagoon to a project. + +``` +lagoon add notification project-slack [flags] +``` + +### Options + +``` + -h, --help help for project-slack + -n, --name string The name of the notification +``` + +### 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 add notification](lagoon_add_notification.md) - Add notifications or add notifications to projects + diff --git a/docs/commands/lagoon_add_notification_project-webhook.md b/docs/commands/lagoon_add_notification_project-webhook.md new file mode 100644 index 00000000..648df1d6 --- /dev/null +++ b/docs/commands/lagoon_add_notification_project-webhook.md @@ -0,0 +1,41 @@ +## lagoon add notification project-webhook + +Add a webhook notification to a project + +### Synopsis + +Add a webhook notification to a project +This command is used to add an existing webhook notification in Lagoon to a project. + +``` +lagoon add notification project-webhook [flags] +``` + +### Options + +``` + -h, --help help for project-webhook + -n, --name string The name of the notification +``` + +### 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 add notification](lagoon_add_notification.md) - Add notifications or add notifications to projects + diff --git a/docs/commands/lagoon_add_notification_rocketchat.md b/docs/commands/lagoon_add_notification_rocketchat.md new file mode 100644 index 00000000..a40cda6a --- /dev/null +++ b/docs/commands/lagoon_add_notification_rocketchat.md @@ -0,0 +1,44 @@ +## lagoon add notification rocketchat + +Add a new RocketChat notification + +### Synopsis + +Add a new RocketChat notification +This command is used to set up a new RocketChat notification in Lagoon. This requires information to talk to RocketChat like the webhook URL and the name of the channel. +It does not configure a project to send notifications to RocketChat though, you need to use project-rocketchat for that. + +``` +lagoon add notification rocketchat [flags] +``` + +### Options + +``` + -c, --channel string The channel for the notification + -h, --help help for rocketchat + -n, --name string The name of the notification + -w, --webhook string The webhook URL of the notification +``` + +### 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 add notification](lagoon_add_notification.md) - Add notifications or add notifications to projects + diff --git a/docs/commands/lagoon_add_notification_slack.md b/docs/commands/lagoon_add_notification_slack.md new file mode 100644 index 00000000..c438b850 --- /dev/null +++ b/docs/commands/lagoon_add_notification_slack.md @@ -0,0 +1,44 @@ +## lagoon add notification slack + +Add a new Slack notification + +### Synopsis + +Add a new Slack notification +This command is used to set up a new Slack notification in Lagoon. This requires information to talk to Slack like the webhook URL and the name of the channel. +It does not configure a project to send notifications to Slack though, you need to use project-slack for that. + +``` +lagoon add notification slack [flags] +``` + +### Options + +``` + -c, --channel string The channel for the notification + -h, --help help for slack + -n, --name string The name of the notification + -w, --webhook string The webhook URL of the notification +``` + +### 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 add notification](lagoon_add_notification.md) - Add notifications or add notifications to projects + diff --git a/docs/commands/lagoon_add_notification_webhook.md b/docs/commands/lagoon_add_notification_webhook.md new file mode 100644 index 00000000..95690c58 --- /dev/null +++ b/docs/commands/lagoon_add_notification_webhook.md @@ -0,0 +1,43 @@ +## lagoon add notification webhook + +Add a new webhook notification + +### Synopsis + +Add a new webhook notification +This command is used to set up a new webhook notification in Lagoon. This requires information to talk to the webhook like the webhook URL. +It does not configure a project to send notifications to webhook though, you need to use project-webhook for that. + +``` +lagoon add notification webhook [flags] +``` + +### Options + +``` + -h, --help help for webhook + -n, --name string The name of the notification + -w, --webhook string The webhook URL of the notification +``` + +### 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 add notification](lagoon_add_notification.md) - Add notifications or add notifications to projects + diff --git a/docs/commands/lagoon_delete.md b/docs/commands/lagoon_delete.md index dffd8883..b8b4e8e6 100644 --- a/docs/commands/lagoon_delete.md +++ b/docs/commands/lagoon_delete.md @@ -36,13 +36,10 @@ Delete a project, or delete notifications and variables from projects or environ * [lagoon delete deploytarget-config](lagoon_delete_deploytarget-config.md) - Delete a deploytarget config * [lagoon delete environment](lagoon_delete_environment.md) - Delete an environment * [lagoon delete group](lagoon_delete_group.md) - Delete a group from lagoon +* [lagoon delete notification](lagoon_delete_notification.md) - Delete notifications or delete notifications from projects * [lagoon delete project](lagoon_delete_project.md) - Delete a project * [lagoon delete project-group](lagoon_delete_project-group.md) - Delete a project from a group in lagoon * [lagoon delete project-metadata](lagoon_delete_project-metadata.md) - Delete a key from a projects metadata -* [lagoon delete project-rocketchat](lagoon_delete_project-rocketchat.md) - Delete a Rocket.Chat notification from a project -* [lagoon delete project-slack](lagoon_delete_project-slack.md) - Delete a Slack notification from a project -* [lagoon delete rocketchat](lagoon_delete_rocketchat.md) - Delete a Rocket.Chat notification from Lagoon -* [lagoon delete slack](lagoon_delete_slack.md) - Delete a Slack notification from Lagoon * [lagoon delete user](lagoon_delete_user.md) - Delete a user from Lagoon * [lagoon delete user-group](lagoon_delete_user-group.md) - Delete a user from a group in lagoon * [lagoon delete user-sshkey](lagoon_delete_user-sshkey.md) - Delete an SSH key from Lagoon diff --git a/docs/commands/lagoon_delete_notification.md b/docs/commands/lagoon_delete_notification.md new file mode 100644 index 00000000..3360c4ca --- /dev/null +++ b/docs/commands/lagoon_delete_notification.md @@ -0,0 +1,45 @@ +## lagoon delete notification + +Delete notifications or delete notifications from projects + +### Synopsis + +Delete notifications or delete notifications from projects + +### Options + +``` + -h, --help help for notification +``` + +### 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 delete](lagoon_delete.md) - Delete a project, or delete notifications and variables from projects or environments +* [lagoon delete notification microsoftteams](lagoon_delete_notification_microsoftteams.md) - Delete a Microsoft Teams notification from Lagoon +* [lagoon delete notification project-email](lagoon_delete_notification_project-email.md) - Delete a email notification from a project +* [lagoon delete notification project-microsoftteams](lagoon_delete_notification_project-microsoftteams.md) - Delete a Microsoft Teams notification from a project +* [lagoon delete notification project-rocketchat](lagoon_delete_notification_project-rocketchat.md) - Delete a RocketChat notification from a project +* [lagoon delete notification project-slack](lagoon_delete_notification_project-slack.md) - Delete a Slack notification from a project +* [lagoon delete notification project-webhook](lagoon_delete_notification_project-webhook.md) - Delete a webhook notification from a project +* [lagoon delete notification rocketchat](lagoon_delete_notification_rocketchat.md) - Delete a RocketChat notification from Lagoon +* [lagoon delete notification slack](lagoon_delete_notification_slack.md) - Delete a Slack notification from Lagoon +* [lagoon delete notification webhook](lagoon_delete_notification_webhook.md) - Delete a email notification from Lagoon +* [lagoon delete notification webhook](lagoon_delete_notification_webhook.md) - Delete a webhook notification from Lagoon + diff --git a/docs/commands/lagoon_delete_notification_microsoftteams.md b/docs/commands/lagoon_delete_notification_microsoftteams.md new file mode 100644 index 00000000..8392d601 --- /dev/null +++ b/docs/commands/lagoon_delete_notification_microsoftteams.md @@ -0,0 +1,40 @@ +## lagoon delete notification microsoftteams + +Delete a Microsoft Teams notification from Lagoon + +### Synopsis + +Delete a Microsoft Teams notification from Lagoon + +``` +lagoon delete notification microsoftteams [flags] +``` + +### Options + +``` + -h, --help help for microsoftteams + -n, --name string The name of the notification +``` + +### 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 delete notification](lagoon_delete_notification.md) - Delete notifications or delete notifications from projects + diff --git a/docs/commands/lagoon_delete_notification_project-email.md b/docs/commands/lagoon_delete_notification_project-email.md new file mode 100644 index 00000000..c073f0e2 --- /dev/null +++ b/docs/commands/lagoon_delete_notification_project-email.md @@ -0,0 +1,40 @@ +## lagoon delete notification project-email + +Delete a email notification from a project + +### Synopsis + +Delete a email notification from a project + +``` +lagoon delete notification project-email [flags] +``` + +### Options + +``` + -h, --help help for project-email + -n, --name string The name of the notification +``` + +### 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 delete notification](lagoon_delete_notification.md) - Delete notifications or delete notifications from projects + diff --git a/docs/commands/lagoon_delete_notification_project-microsoftteams.md b/docs/commands/lagoon_delete_notification_project-microsoftteams.md new file mode 100644 index 00000000..64cba095 --- /dev/null +++ b/docs/commands/lagoon_delete_notification_project-microsoftteams.md @@ -0,0 +1,40 @@ +## lagoon delete notification project-microsoftteams + +Delete a Microsoft Teams notification from a project + +### Synopsis + +Delete a Microsoft Teams notification from a project + +``` +lagoon delete notification project-microsoftteams [flags] +``` + +### Options + +``` + -h, --help help for project-microsoftteams + -n, --name string The name of the notification +``` + +### 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 delete notification](lagoon_delete_notification.md) - Delete notifications or delete notifications from projects + diff --git a/docs/commands/lagoon_delete_notification_project-rocketchat.md b/docs/commands/lagoon_delete_notification_project-rocketchat.md new file mode 100644 index 00000000..59bc55b9 --- /dev/null +++ b/docs/commands/lagoon_delete_notification_project-rocketchat.md @@ -0,0 +1,40 @@ +## lagoon delete notification project-rocketchat + +Delete a RocketChat notification from a project + +### Synopsis + +Delete a RocketChat notification from a project + +``` +lagoon delete notification project-rocketchat [flags] +``` + +### Options + +``` + -h, --help help for project-rocketchat + -n, --name string The name of the notification +``` + +### 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 delete notification](lagoon_delete_notification.md) - Delete notifications or delete notifications from projects + diff --git a/docs/commands/lagoon_delete_notification_project-slack.md b/docs/commands/lagoon_delete_notification_project-slack.md new file mode 100644 index 00000000..562502f0 --- /dev/null +++ b/docs/commands/lagoon_delete_notification_project-slack.md @@ -0,0 +1,40 @@ +## lagoon delete notification project-slack + +Delete a Slack notification from a project + +### Synopsis + +Delete a Slack notification from a project + +``` +lagoon delete notification project-slack [flags] +``` + +### Options + +``` + -h, --help help for project-slack + -n, --name string The name of the notification +``` + +### 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 delete notification](lagoon_delete_notification.md) - Delete notifications or delete notifications from projects + diff --git a/docs/commands/lagoon_delete_notification_project-webhook.md b/docs/commands/lagoon_delete_notification_project-webhook.md new file mode 100644 index 00000000..87856c0b --- /dev/null +++ b/docs/commands/lagoon_delete_notification_project-webhook.md @@ -0,0 +1,40 @@ +## lagoon delete notification project-webhook + +Delete a webhook notification from a project + +### Synopsis + +Delete a webhook notification from a project + +``` +lagoon delete notification project-webhook [flags] +``` + +### Options + +``` + -h, --help help for project-webhook + -n, --name string The name of the notification +``` + +### 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 delete notification](lagoon_delete_notification.md) - Delete notifications or delete notifications from projects + diff --git a/docs/commands/lagoon_delete_notification_rocketchat.md b/docs/commands/lagoon_delete_notification_rocketchat.md new file mode 100644 index 00000000..39d9c581 --- /dev/null +++ b/docs/commands/lagoon_delete_notification_rocketchat.md @@ -0,0 +1,40 @@ +## lagoon delete notification rocketchat + +Delete a RocketChat notification from Lagoon + +### Synopsis + +Delete a RocketChat notification from Lagoon + +``` +lagoon delete notification rocketchat [flags] +``` + +### Options + +``` + -h, --help help for rocketchat + -n, --name string The name of the notification +``` + +### 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 delete notification](lagoon_delete_notification.md) - Delete notifications or delete notifications from projects + diff --git a/docs/commands/lagoon_delete_notification_slack.md b/docs/commands/lagoon_delete_notification_slack.md new file mode 100644 index 00000000..56fee875 --- /dev/null +++ b/docs/commands/lagoon_delete_notification_slack.md @@ -0,0 +1,40 @@ +## lagoon delete notification slack + +Delete a Slack notification from Lagoon + +### Synopsis + +Delete a Slack notification from Lagoon + +``` +lagoon delete notification slack [flags] +``` + +### Options + +``` + -h, --help help for slack + -n, --name string The name of the notification +``` + +### 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 delete notification](lagoon_delete_notification.md) - Delete notifications or delete notifications from projects + diff --git a/docs/commands/lagoon_delete_notification_webhook.md b/docs/commands/lagoon_delete_notification_webhook.md new file mode 100644 index 00000000..a37f2bac --- /dev/null +++ b/docs/commands/lagoon_delete_notification_webhook.md @@ -0,0 +1,40 @@ +## lagoon delete notification webhook + +Delete a webhook notification from Lagoon + +### Synopsis + +Delete a webhook notification from Lagoon + +``` +lagoon delete notification webhook [flags] +``` + +### Options + +``` + -h, --help help for webhook + -n, --name string The name of the notification +``` + +### 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 delete notification](lagoon_delete_notification.md) - Delete notifications or delete notifications from projects + diff --git a/docs/commands/lagoon_delete_project-email.md b/docs/commands/lagoon_delete_project-email.md new file mode 100644 index 00000000..030d9eec --- /dev/null +++ b/docs/commands/lagoon_delete_project-email.md @@ -0,0 +1,40 @@ +## lagoon delete project-email + +Delete a Email notification from a project + +### Synopsis + +Delete a Email notification from a project + +``` +lagoon delete project-email [flags] +``` + +### Options + +``` + -h, --help help for project-email + -n, --name string The name of the notification +``` + +### 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 delete](lagoon_delete.md) - Delete a project, or delete notifications and variables from projects or environments + diff --git a/docs/commands/lagoon_delete_project-microsoftteams.md b/docs/commands/lagoon_delete_project-microsoftteams.md new file mode 100644 index 00000000..d593daa0 --- /dev/null +++ b/docs/commands/lagoon_delete_project-microsoftteams.md @@ -0,0 +1,40 @@ +## lagoon delete project-microsoftteams + +Delete a MicrosoftTeams notification from a project + +### Synopsis + +Delete a MicrosoftTeams notification from a project + +``` +lagoon delete project-microsoftteams [flags] +``` + +### Options + +``` + -h, --help help for project-microsoftteams + -n, --name string The name of the notification +``` + +### 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 delete](lagoon_delete.md) - Delete a project, or delete notifications and variables from projects or environments + diff --git a/docs/commands/lagoon_delete_project-webhook.md b/docs/commands/lagoon_delete_project-webhook.md new file mode 100644 index 00000000..a0f34f36 --- /dev/null +++ b/docs/commands/lagoon_delete_project-webhook.md @@ -0,0 +1,40 @@ +## lagoon delete project-webhook + +Delete a Webhook notification from a project + +### Synopsis + +Delete a Webhook notification from a project + +``` +lagoon delete project-webhook [flags] +``` + +### Options + +``` + -h, --help help for project-webhook + -n, --name string The name of the notification +``` + +### 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 delete](lagoon_delete.md) - Delete a project, or delete notifications and variables from projects or environments + diff --git a/docs/commands/lagoon_list.md b/docs/commands/lagoon_list.md index 0483f363..2b48e078 100644 --- a/docs/commands/lagoon_list.md +++ b/docs/commands/lagoon_list.md @@ -41,10 +41,9 @@ List projects, deployments, variables or notifications * [lagoon list group-projects](lagoon_list_group-projects.md) - List projects in a group (alias: gp) * [lagoon list groups](lagoon_list_groups.md) - List groups you have access to (alias: g) * [lagoon list invokable-tasks](lagoon_list_invokable-tasks.md) - Print a list of invokable tasks +* [lagoon list notification](lagoon_list_notification.md) - List all notifications or notifications on projects * [lagoon list projects](lagoon_list_projects.md) - List all projects you have access to (alias: p) * [lagoon list projects-by-metadata](lagoon_list_projects-by-metadata.md) - List projects by a given metadata key or key:value -* [lagoon list rocketchat](lagoon_list_rocketchat.md) - List Rocket.Chat details about a project (alias: r) -* [lagoon list slack](lagoon_list_slack.md) - List Slack details about a project (alias: s) * [lagoon list tasks](lagoon_list_tasks.md) - List tasks for an environment (alias: t) * [lagoon list users](lagoon_list_users.md) - List all users in groups (alias: u) * [lagoon list variables](lagoon_list_variables.md) - List variables for a project or environment (alias: v) diff --git a/docs/commands/lagoon_list_notification.md b/docs/commands/lagoon_list_notification.md new file mode 100644 index 00000000..5b4f86b5 --- /dev/null +++ b/docs/commands/lagoon_list_notification.md @@ -0,0 +1,45 @@ +## lagoon list notification + +List all notifications or notifications on projects + +### Synopsis + +List all notifications or notifications on projects + +### Options + +``` + -h, --help help for notification +``` + +### 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 list](lagoon_list.md) - List projects, 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) +* [lagoon list notification project-microsoftteams](lagoon_list_notification_project-microsoftteams.md) - List Microsoft Teams details about a project (alias: pm) +* [lagoon list notification project-rocketchat](lagoon_list_notification_project-rocketchat.md) - List RocketChats details about a project (alias: pr) +* [lagoon list notification project-slack](lagoon_list_notification_project-slack.md) - List Slacks details about a project (alias: ps) +* [lagoon list notification project-webhook](lagoon_list_notification_project-webhook.md) - List webhook details about a project (alias: pw) +* [lagoon list notification rocketchat](lagoon_list_notification_rocketchat.md) - List all RocketChats notification details (alias: r) +* [lagoon list notification slack](lagoon_list_notification_slack.md) - List all Slacks notification details (alias: s) +* [lagoon list notification webhook](lagoon_list_notification_webhook.md) - List all webhook notification details (alias: w) + diff --git a/docs/commands/lagoon_list_notification_email.md b/docs/commands/lagoon_list_notification_email.md new file mode 100644 index 00000000..08b60a1a --- /dev/null +++ b/docs/commands/lagoon_list_notification_email.md @@ -0,0 +1,39 @@ +## lagoon list notification email + +List all email notification details (alias: e) + +### Synopsis + +List all email notification details (alias: e) + +``` +lagoon list notification email [flags] +``` + +### Options + +``` + -h, --help help for email +``` + +### 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 list notification](lagoon_list_notification.md) - List all notifications or notifications on projects + diff --git a/docs/commands/lagoon_list_notification_microsoftteams.md b/docs/commands/lagoon_list_notification_microsoftteams.md new file mode 100644 index 00000000..f825f363 --- /dev/null +++ b/docs/commands/lagoon_list_notification_microsoftteams.md @@ -0,0 +1,39 @@ +## lagoon list notification microsoftteams + +List all Microsoft Teams notification details (alias: m) + +### Synopsis + +List all Microsoft Teams notification details (alias: m) + +``` +lagoon list notification microsoftteams [flags] +``` + +### Options + +``` + -h, --help help for microsoftteams +``` + +### 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 list notification](lagoon_list_notification.md) - List all notifications or notifications on projects + diff --git a/docs/commands/lagoon_list_notification_project-email.md b/docs/commands/lagoon_list_notification_project-email.md new file mode 100644 index 00000000..f5c22691 --- /dev/null +++ b/docs/commands/lagoon_list_notification_project-email.md @@ -0,0 +1,39 @@ +## lagoon list notification project-email + +List email details about a project (alias: pe) + +### Synopsis + +List email details about a project (alias: pe) + +``` +lagoon list notification project-email [flags] +``` + +### Options + +``` + -h, --help help for project-email +``` + +### 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 list notification](lagoon_list_notification.md) - List all notifications or notifications on projects + diff --git a/docs/commands/lagoon_list_notification_project-microsoftteams.md b/docs/commands/lagoon_list_notification_project-microsoftteams.md new file mode 100644 index 00000000..a4f26881 --- /dev/null +++ b/docs/commands/lagoon_list_notification_project-microsoftteams.md @@ -0,0 +1,39 @@ +## lagoon list notification project-microsoftteams + +List Microsoft Teams details about a project (alias: pm) + +### Synopsis + +List Microsoft Teams details about a project (alias: pm) + +``` +lagoon list notification project-microsoftteams [flags] +``` + +### Options + +``` + -h, --help help for project-microsoftteams +``` + +### 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 list notification](lagoon_list_notification.md) - List all notifications or notifications on projects + diff --git a/docs/commands/lagoon_list_notification_project-rocketchat.md b/docs/commands/lagoon_list_notification_project-rocketchat.md new file mode 100644 index 00000000..6599be60 --- /dev/null +++ b/docs/commands/lagoon_list_notification_project-rocketchat.md @@ -0,0 +1,39 @@ +## lagoon list notification project-rocketchat + +List RocketChats details about a project (alias: pr) + +### Synopsis + +List RocketChats details about a project (alias: pr) + +``` +lagoon list notification project-rocketchat [flags] +``` + +### Options + +``` + -h, --help help for project-rocketchat +``` + +### 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 list notification](lagoon_list_notification.md) - List all notifications or notifications on projects + diff --git a/docs/commands/lagoon_list_notification_project-slack.md b/docs/commands/lagoon_list_notification_project-slack.md new file mode 100644 index 00000000..a4abbf0c --- /dev/null +++ b/docs/commands/lagoon_list_notification_project-slack.md @@ -0,0 +1,39 @@ +## lagoon list notification project-slack + +List Slacks details about a project (alias: ps) + +### Synopsis + +List Slacks details about a project (alias: ps) + +``` +lagoon list notification project-slack [flags] +``` + +### Options + +``` + -h, --help help for project-slack +``` + +### 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 list notification](lagoon_list_notification.md) - List all notifications or notifications on projects + diff --git a/docs/commands/lagoon_list_notification_project-webhook.md b/docs/commands/lagoon_list_notification_project-webhook.md new file mode 100644 index 00000000..80566d0f --- /dev/null +++ b/docs/commands/lagoon_list_notification_project-webhook.md @@ -0,0 +1,39 @@ +## lagoon list notification project-webhook + +List webhook details about a project (alias: pw) + +### Synopsis + +List webhook details about a project (alias: pw) + +``` +lagoon list notification project-webhook [flags] +``` + +### Options + +``` + -h, --help help for project-webhook +``` + +### 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 list notification](lagoon_list_notification.md) - List all notifications or notifications on projects + diff --git a/docs/commands/lagoon_list_notification_rocketchat.md b/docs/commands/lagoon_list_notification_rocketchat.md new file mode 100644 index 00000000..f45f7df0 --- /dev/null +++ b/docs/commands/lagoon_list_notification_rocketchat.md @@ -0,0 +1,39 @@ +## lagoon list notification rocketchat + +List all RocketChats notification details (alias: r) + +### Synopsis + +List all RocketChats notification details (alias: r) + +``` +lagoon list notification rocketchat [flags] +``` + +### Options + +``` + -h, --help help for rocketchat +``` + +### 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 list notification](lagoon_list_notification.md) - List all notifications or notifications on projects + diff --git a/docs/commands/lagoon_list_notification_slack.md b/docs/commands/lagoon_list_notification_slack.md new file mode 100644 index 00000000..9133f92e --- /dev/null +++ b/docs/commands/lagoon_list_notification_slack.md @@ -0,0 +1,39 @@ +## lagoon list notification slack + +List all Slacks notification details (alias: s) + +### Synopsis + +List all Slacks notification details (alias: s) + +``` +lagoon list notification slack [flags] +``` + +### Options + +``` + -h, --help help for slack +``` + +### 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 list notification](lagoon_list_notification.md) - List all notifications or notifications on projects + diff --git a/docs/commands/lagoon_list_notification_webhook.md b/docs/commands/lagoon_list_notification_webhook.md new file mode 100644 index 00000000..83811f0f --- /dev/null +++ b/docs/commands/lagoon_list_notification_webhook.md @@ -0,0 +1,39 @@ +## lagoon list notification webhook + +List all webhook notification details (alias: w) + +### Synopsis + +List all webhook notification details (alias: w) + +``` +lagoon list notification webhook [flags] +``` + +### Options + +``` + -h, --help help for webhook +``` + +### 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 list notification](lagoon_list_notification.md) - List all notifications or notifications on projects + diff --git a/docs/commands/lagoon_update.md b/docs/commands/lagoon_update.md index e5921920..c3bc20c5 100644 --- a/docs/commands/lagoon_update.md +++ b/docs/commands/lagoon_update.md @@ -34,10 +34,9 @@ Update a resource * [lagoon](lagoon.md) - Command line integration for Lagoon * [lagoon update deploytarget](lagoon_update_deploytarget.md) - Update a DeployTarget in lagoon * [lagoon update deploytarget-config](lagoon_update_deploytarget-config.md) - Update a deploytarget config +* [lagoon update notification](lagoon_update_notification.md) - List all notifications or notifications on projects * [lagoon update project](lagoon_update_project.md) - Update a project * [lagoon update project-metadata](lagoon_update_project-metadata.md) - Update a projects metadata with a given key or key:value -* [lagoon update rocketchat](lagoon_update_rocketchat.md) - Update an existing Rocket.Chat notification -* [lagoon update slack](lagoon_update_slack.md) - Update an existing Slack notification * [lagoon update user](lagoon_update_user.md) - Update a user in Lagoon * [lagoon update variable](lagoon_update_variable.md) - Add or update a variable to an environment or project diff --git a/docs/commands/lagoon_update_notification.md b/docs/commands/lagoon_update_notification.md new file mode 100644 index 00000000..38596a8e --- /dev/null +++ b/docs/commands/lagoon_update_notification.md @@ -0,0 +1,40 @@ +## lagoon update notification + +List all notifications or notifications on projects + +### Synopsis + +List all notifications or notifications on projects + +### Options + +``` + -h, --help help for notification +``` + +### 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 update](lagoon_update.md) - Update a resource +* [lagoon update notification email](lagoon_update_notification_email.md) - Update an existing email notification +* [lagoon update notification microsoftteams](lagoon_update_notification_microsoftteams.md) - Update an existing Microsoft Teams notification +* [lagoon update notification rocketchat](lagoon_update_notification_rocketchat.md) - Update an existing RocketChat notification +* [lagoon update notification slack](lagoon_update_notification_slack.md) - Update an existing Slack notification +* [lagoon update notification webhook](lagoon_update_notification_webhook.md) - Update an existing webhook notification + diff --git a/docs/commands/lagoon_update_notification_email.md b/docs/commands/lagoon_update_notification_email.md new file mode 100644 index 00000000..11dcb1f7 --- /dev/null +++ b/docs/commands/lagoon_update_notification_email.md @@ -0,0 +1,42 @@ +## lagoon update notification email + +Update an existing email notification + +### Synopsis + +Update an existing email notification + +``` +lagoon update notification email [flags] +``` + +### Options + +``` + -E, --email string The email address of the notification + -h, --help help for email + -n, --name string The current name of the notification + -N, --newname string The name of the notification +``` + +### 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 update notification](lagoon_update_notification.md) - List all notifications or notifications on projects + diff --git a/docs/commands/lagoon_update_notification_microsoftteams.md b/docs/commands/lagoon_update_notification_microsoftteams.md new file mode 100644 index 00000000..705eed78 --- /dev/null +++ b/docs/commands/lagoon_update_notification_microsoftteams.md @@ -0,0 +1,42 @@ +## lagoon update notification microsoftteams + +Update an existing Microsoft Teams notification + +### Synopsis + +Update an existing Microsoft Teams notification + +``` +lagoon update notification microsoftteams [flags] +``` + +### Options + +``` + -h, --help help for microsoftteams + -n, --name string The name of the notification + -N, --newname string The name of the notification + -w, --webhook string The webhook URL of the notification +``` + +### 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 update notification](lagoon_update_notification.md) - List all notifications or notifications on projects + diff --git a/docs/commands/lagoon_update_notification_rocketchat.md b/docs/commands/lagoon_update_notification_rocketchat.md new file mode 100644 index 00000000..367ba902 --- /dev/null +++ b/docs/commands/lagoon_update_notification_rocketchat.md @@ -0,0 +1,43 @@ +## lagoon update notification rocketchat + +Update an existing RocketChat notification + +### Synopsis + +Update an existing RocketChat notification + +``` +lagoon update notification rocketchat [flags] +``` + +### Options + +``` + -c, --channel string The channel for the notification + -h, --help help for rocketchat + -n, --name string The current name of the notification + -N, --newname string The new name of the notification (if required) + -w, --webhook string The webhook URL of the notification +``` + +### 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 update notification](lagoon_update_notification.md) - List all notifications or notifications on projects + diff --git a/docs/commands/lagoon_update_notification_slack.md b/docs/commands/lagoon_update_notification_slack.md new file mode 100644 index 00000000..202144ef --- /dev/null +++ b/docs/commands/lagoon_update_notification_slack.md @@ -0,0 +1,43 @@ +## lagoon update notification slack + +Update an existing Slack notification + +### Synopsis + +Update an existing Slack notification + +``` +lagoon update notification slack [flags] +``` + +### Options + +``` + -c, --channel string The channel for the notification + -h, --help help for slack + -n, --name string The current name of the notification + -N, --newname string The name of the notification + -w, --webhook string The webhook URL of the notification +``` + +### 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 update notification](lagoon_update_notification.md) - List all notifications or notifications on projects + diff --git a/docs/commands/lagoon_update_notification_webhook.md b/docs/commands/lagoon_update_notification_webhook.md new file mode 100644 index 00000000..dd46256a --- /dev/null +++ b/docs/commands/lagoon_update_notification_webhook.md @@ -0,0 +1,42 @@ +## lagoon update notification webhook + +Update an existing webhook notification + +### Synopsis + +Update an existing webhook notification + +``` +lagoon update notification webhook [flags] +``` + +### Options + +``` + -h, --help help for webhook + -n, --name string The name of the notification + -N, --newname string The name of the notification + -w, --webhook string The webhook URL of the notification +``` + +### 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 update notification](lagoon_update_notification.md) - List all notifications or notifications on projects + diff --git a/internal/lagoon/client/_lgraphql/addNotificationToProject.graphql b/internal/lagoon/client/_lgraphql/addNotificationToProject.graphql deleted file mode 100644 index e0b671b4..00000000 --- a/internal/lagoon/client/_lgraphql/addNotificationToProject.graphql +++ /dev/null @@ -1,13 +0,0 @@ -mutation ( - $project: String!, - $notificationType: NotificationType!, - $notificationName: String!) { - addNotificationToProject(input: { - project: $project - notificationType: $notificationType - notificationName: $notificationName - }) { - id - name - } - } diff --git a/internal/lagoon/client/_lgraphql/addNotificationEmail.graphql b/internal/lagoon/client/_lgraphql/notifications/addNotificationEmail.graphql similarity index 90% rename from internal/lagoon/client/_lgraphql/addNotificationEmail.graphql rename to internal/lagoon/client/_lgraphql/notifications/addNotificationEmail.graphql index 1f37bc37..9983ffe0 100644 --- a/internal/lagoon/client/_lgraphql/addNotificationEmail.graphql +++ b/internal/lagoon/client/_lgraphql/notifications/addNotificationEmail.graphql @@ -7,5 +7,6 @@ mutation ( }) { id name + emailAddress } } diff --git a/internal/lagoon/client/_lgraphql/addNotificationMicrosoftTeams.graphql b/internal/lagoon/client/_lgraphql/notifications/addNotificationMicrosoftTeams.graphql similarity index 92% rename from internal/lagoon/client/_lgraphql/addNotificationMicrosoftTeams.graphql rename to internal/lagoon/client/_lgraphql/notifications/addNotificationMicrosoftTeams.graphql index b452f99c..b61163ce 100644 --- a/internal/lagoon/client/_lgraphql/addNotificationMicrosoftTeams.graphql +++ b/internal/lagoon/client/_lgraphql/notifications/addNotificationMicrosoftTeams.graphql @@ -7,5 +7,6 @@ mutation ( }) { id name + webhook } } diff --git a/internal/lagoon/client/_lgraphql/addNotificationRocketChat.graphql b/internal/lagoon/client/_lgraphql/notifications/addNotificationRocketChat.graphql similarity index 88% rename from internal/lagoon/client/_lgraphql/addNotificationRocketChat.graphql rename to internal/lagoon/client/_lgraphql/notifications/addNotificationRocketChat.graphql index b5a20058..67dfaeac 100644 --- a/internal/lagoon/client/_lgraphql/addNotificationRocketChat.graphql +++ b/internal/lagoon/client/_lgraphql/notifications/addNotificationRocketChat.graphql @@ -9,5 +9,7 @@ mutation ( }) { id name + channel + webhook } } diff --git a/internal/lagoon/client/_lgraphql/addNotificationSlack.graphql b/internal/lagoon/client/_lgraphql/notifications/addNotificationSlack.graphql similarity index 88% rename from internal/lagoon/client/_lgraphql/addNotificationSlack.graphql rename to internal/lagoon/client/_lgraphql/notifications/addNotificationSlack.graphql index fa7ffe46..22dd9889 100644 --- a/internal/lagoon/client/_lgraphql/addNotificationSlack.graphql +++ b/internal/lagoon/client/_lgraphql/notifications/addNotificationSlack.graphql @@ -9,5 +9,7 @@ mutation ( }) { id name + channel + webhook } } diff --git a/internal/lagoon/client/_lgraphql/notifications/addNotificationToProject.graphql b/internal/lagoon/client/_lgraphql/notifications/addNotificationToProject.graphql new file mode 100644 index 00000000..9d9ad16f --- /dev/null +++ b/internal/lagoon/client/_lgraphql/notifications/addNotificationToProject.graphql @@ -0,0 +1,16 @@ +mutation ( + $project: String! + $notificationType: NotificationType! + $notificationName: String! +){ + addNotificationToProject( + input:{ + project: $project + notificationType: $notificationType + notificationName: $notificationName + } + ){ + id + name + } +} diff --git a/internal/lagoon/client/_lgraphql/notifications/addNotificationWebhook.graphql b/internal/lagoon/client/_lgraphql/notifications/addNotificationWebhook.graphql new file mode 100644 index 00000000..5121811e --- /dev/null +++ b/internal/lagoon/client/_lgraphql/notifications/addNotificationWebhook.graphql @@ -0,0 +1,12 @@ +mutation ( + $name: String!, + $webhook: String!) { + addNotificationWebhook(input: { + name: $name, + webhook: $webhook + }) { + id + name + webhook + } + } diff --git a/internal/lagoon/client/_lgraphql/notifications/deleteNotificationEmail.graphql b/internal/lagoon/client/_lgraphql/notifications/deleteNotificationEmail.graphql new file mode 100644 index 00000000..df172dd0 --- /dev/null +++ b/internal/lagoon/client/_lgraphql/notifications/deleteNotificationEmail.graphql @@ -0,0 +1,3 @@ +mutation ($name: String!) { + deleteNotification: deleteNotificationEmail(input:{name: $name}) +} \ No newline at end of file diff --git a/internal/lagoon/client/_lgraphql/notifications/deleteNotificationMicrosoftTeams.graphql b/internal/lagoon/client/_lgraphql/notifications/deleteNotificationMicrosoftTeams.graphql new file mode 100644 index 00000000..2b28338f --- /dev/null +++ b/internal/lagoon/client/_lgraphql/notifications/deleteNotificationMicrosoftTeams.graphql @@ -0,0 +1,3 @@ +mutation ($name: String!) { + deleteNotification: deleteNotificationMicrosoftTeams(input:{name: $name}) +} \ No newline at end of file diff --git a/internal/lagoon/client/_lgraphql/notifications/deleteNotificationRocketChat.graphql b/internal/lagoon/client/_lgraphql/notifications/deleteNotificationRocketChat.graphql new file mode 100644 index 00000000..6f320787 --- /dev/null +++ b/internal/lagoon/client/_lgraphql/notifications/deleteNotificationRocketChat.graphql @@ -0,0 +1,3 @@ +mutation ($name: String!) { + deleteNotification: deleteNotificationRocketChat(input:{name: $name}) +} \ No newline at end of file diff --git a/internal/lagoon/client/_lgraphql/notifications/deleteNotificationSlack.graphql b/internal/lagoon/client/_lgraphql/notifications/deleteNotificationSlack.graphql new file mode 100644 index 00000000..0b298edd --- /dev/null +++ b/internal/lagoon/client/_lgraphql/notifications/deleteNotificationSlack.graphql @@ -0,0 +1,3 @@ +mutation ($name: String!) { + deleteNotification: deleteNotificationSlack(input:{name: $name}) +} \ No newline at end of file diff --git a/internal/lagoon/client/_lgraphql/notifications/deleteNotificationWebhook.graphql b/internal/lagoon/client/_lgraphql/notifications/deleteNotificationWebhook.graphql new file mode 100644 index 00000000..2e58d2f0 --- /dev/null +++ b/internal/lagoon/client/_lgraphql/notifications/deleteNotificationWebhook.graphql @@ -0,0 +1,3 @@ +mutation ($name: String!) { + deleteNotification: deleteNotificationWebhook(input:{name: $name}) +} \ No newline at end of file diff --git a/internal/lagoon/client/_lgraphql/notifications/listAllNotificationEmail.graphql b/internal/lagoon/client/_lgraphql/notifications/listAllNotificationEmail.graphql new file mode 100644 index 00000000..4e13e955 --- /dev/null +++ b/internal/lagoon/client/_lgraphql/notifications/listAllNotificationEmail.graphql @@ -0,0 +1,13 @@ +query { + allProjects { + name + id + notifications(type: EMAIL) { + ... on NotificationEmail { + __typename + emailAddress + name + } + } + } +} \ No newline at end of file diff --git a/internal/lagoon/client/_lgraphql/notifications/listAllNotificationMicrosoftTeams.graphql b/internal/lagoon/client/_lgraphql/notifications/listAllNotificationMicrosoftTeams.graphql new file mode 100644 index 00000000..4691db9a --- /dev/null +++ b/internal/lagoon/client/_lgraphql/notifications/listAllNotificationMicrosoftTeams.graphql @@ -0,0 +1,13 @@ +query { + allProjects { + name + id + notifications(type: MICROSOFTTEAMS) { + ... on NotificationMicrosoftTeams { + __typename + webhook + name + } + } + } +} \ No newline at end of file diff --git a/internal/lagoon/client/_lgraphql/notifications/listAllNotificationRocketChat.graphql b/internal/lagoon/client/_lgraphql/notifications/listAllNotificationRocketChat.graphql new file mode 100644 index 00000000..2e63e6db --- /dev/null +++ b/internal/lagoon/client/_lgraphql/notifications/listAllNotificationRocketChat.graphql @@ -0,0 +1,14 @@ +query { + allProjects { + name + id + notifications(type: ROCKETCHAT) { + ... on NotificationRocketChat { + __typename + webhook + channel + name + } + } + } +} \ No newline at end of file diff --git a/internal/lagoon/client/_lgraphql/notifications/listAllNotificationSlack.graphql b/internal/lagoon/client/_lgraphql/notifications/listAllNotificationSlack.graphql new file mode 100644 index 00000000..05188bda --- /dev/null +++ b/internal/lagoon/client/_lgraphql/notifications/listAllNotificationSlack.graphql @@ -0,0 +1,14 @@ +query { + allProjects { + name + id + notifications(type: SLACK) { + ... on NotificationSlack { + __typename + webhook + channel + name + } + } + } +} \ No newline at end of file diff --git a/internal/lagoon/client/_lgraphql/notifications/listAllNotificationWebhook.graphql b/internal/lagoon/client/_lgraphql/notifications/listAllNotificationWebhook.graphql new file mode 100644 index 00000000..6e25d996 --- /dev/null +++ b/internal/lagoon/client/_lgraphql/notifications/listAllNotificationWebhook.graphql @@ -0,0 +1,13 @@ +query { + allProjects { + name + id + notifications(type: WEBHOOK) { + ... on NotificationWebhook { + __typename + webhook + name + } + } + } +} \ No newline at end of file diff --git a/internal/lagoon/client/_lgraphql/notifications/projectNotificationEmail.graphql b/internal/lagoon/client/_lgraphql/notifications/projectNotificationEmail.graphql new file mode 100644 index 00000000..f973d201 --- /dev/null +++ b/internal/lagoon/client/_lgraphql/notifications/projectNotificationEmail.graphql @@ -0,0 +1,11 @@ +query ($name: String!) { + projectByName(name: $name) { + notifications(type: EMAIL) { + ... on NotificationEmail { + __typename + emailAddress + name + } + } + } +} \ No newline at end of file diff --git a/internal/lagoon/client/_lgraphql/notifications/projectNotificationMicrosoftTeams.graphql b/internal/lagoon/client/_lgraphql/notifications/projectNotificationMicrosoftTeams.graphql new file mode 100644 index 00000000..2fe84f4e --- /dev/null +++ b/internal/lagoon/client/_lgraphql/notifications/projectNotificationMicrosoftTeams.graphql @@ -0,0 +1,11 @@ +query ($name: String!) { + projectByName(name: $name) { + notifications(type: MICROSOFTTEAMS) { + ... on NotificationMicrosoftTeams { + __typename + webhook + name + } + } + } +} \ No newline at end of file diff --git a/internal/lagoon/client/_lgraphql/notifications/projectNotificationRocketChat.graphql b/internal/lagoon/client/_lgraphql/notifications/projectNotificationRocketChat.graphql new file mode 100644 index 00000000..555fdc51 --- /dev/null +++ b/internal/lagoon/client/_lgraphql/notifications/projectNotificationRocketChat.graphql @@ -0,0 +1,12 @@ +query ($name: String!) { + projectByName(name: $name) { + notifications(type: ROCKETCHAT) { + ... on NotificationRocketChat { + __typename + webhook + channel + name + } + } + } +} \ No newline at end of file diff --git a/internal/lagoon/client/_lgraphql/notifications/projectNotificationSlack.graphql b/internal/lagoon/client/_lgraphql/notifications/projectNotificationSlack.graphql new file mode 100644 index 00000000..cd525e14 --- /dev/null +++ b/internal/lagoon/client/_lgraphql/notifications/projectNotificationSlack.graphql @@ -0,0 +1,12 @@ +query ($name: String!) { + projectByName(name: $name) { + notifications(type: SLACK) { + ... on NotificationSlack { + __typename + webhook + channel + name + } + } + } +} \ No newline at end of file diff --git a/internal/lagoon/client/_lgraphql/notifications/projectNotificationWebhook.graphql b/internal/lagoon/client/_lgraphql/notifications/projectNotificationWebhook.graphql new file mode 100644 index 00000000..a1ffd5ec --- /dev/null +++ b/internal/lagoon/client/_lgraphql/notifications/projectNotificationWebhook.graphql @@ -0,0 +1,11 @@ +query ($name: String!) { + projectByName(name: $name) { + notifications(type: WEBHOOK) { + ... on NotificationWebhook { + __typename + webhook + name + } + } + } +} \ No newline at end of file diff --git a/internal/lagoon/client/_lgraphql/notifications/removeNotificationFromProject.graphql b/internal/lagoon/client/_lgraphql/notifications/removeNotificationFromProject.graphql new file mode 100644 index 00000000..8073fc66 --- /dev/null +++ b/internal/lagoon/client/_lgraphql/notifications/removeNotificationFromProject.graphql @@ -0,0 +1,15 @@ +mutation ( + $project: String! + $notificationType: NotificationType! + $notificationName: String! +){ + removeNotificationFromProject( + input:{ + project: $project + notificationType: $notificationType + notificationName: $notificationName + } + ){ + id + } +} diff --git a/internal/lagoon/client/_lgraphql/notifications/updateNotificationEmail.graphql b/internal/lagoon/client/_lgraphql/notifications/updateNotificationEmail.graphql new file mode 100644 index 00000000..3f99f72e --- /dev/null +++ b/internal/lagoon/client/_lgraphql/notifications/updateNotificationEmail.graphql @@ -0,0 +1,15 @@ +mutation ( + $name: String! + $patch: UpdateNotificationEmailPatchInput! +) { + updateNotificationEmail( + input:{ + name: $name + patch: $patch + } + ){ + id + name + emailAddress + } +} \ No newline at end of file diff --git a/internal/lagoon/client/_lgraphql/notifications/updateNotificationMicrosoftTeams.graphql b/internal/lagoon/client/_lgraphql/notifications/updateNotificationMicrosoftTeams.graphql new file mode 100644 index 00000000..c5799811 --- /dev/null +++ b/internal/lagoon/client/_lgraphql/notifications/updateNotificationMicrosoftTeams.graphql @@ -0,0 +1,15 @@ +mutation ( + $name: String! + $patch: UpdateNotificationMicrosoftTeamsPatchInput! +) { + updateNotificationMicrosoftTeams( + input:{ + name: $name + patch: $patch + } + ){ + id + name + webhook + } +} \ No newline at end of file diff --git a/internal/lagoon/client/_lgraphql/notifications/updateNotificationRocketChat.graphql b/internal/lagoon/client/_lgraphql/notifications/updateNotificationRocketChat.graphql new file mode 100644 index 00000000..74260f23 --- /dev/null +++ b/internal/lagoon/client/_lgraphql/notifications/updateNotificationRocketChat.graphql @@ -0,0 +1,16 @@ +mutation ( + $name: String! + $patch: UpdateNotificationRocketChatPatchInput! +) { + updateNotificationRocketChat( + input:{ + name: $name + patch: $patch + } + ){ + id + name + channel + webhook + } +} \ No newline at end of file diff --git a/internal/lagoon/client/_lgraphql/notifications/updateNotificationSlack.graphql b/internal/lagoon/client/_lgraphql/notifications/updateNotificationSlack.graphql new file mode 100644 index 00000000..8e38f3c8 --- /dev/null +++ b/internal/lagoon/client/_lgraphql/notifications/updateNotificationSlack.graphql @@ -0,0 +1,16 @@ +mutation ( + $name: String! + $patch: UpdateNotificationSlackPatchInput! +) { + updateNotificationSlack( + input:{ + name: $name + patch: $patch + } + ){ + id + name + channel + webhook + } +} \ No newline at end of file diff --git a/internal/lagoon/client/_lgraphql/notifications/updateNotificationWebhook.graphql b/internal/lagoon/client/_lgraphql/notifications/updateNotificationWebhook.graphql new file mode 100644 index 00000000..b94d2ac7 --- /dev/null +++ b/internal/lagoon/client/_lgraphql/notifications/updateNotificationWebhook.graphql @@ -0,0 +1,15 @@ +mutation ( + $name: String! + $patch: UpdateNotificationWebhookPatchInput! +) { + updateNotificationWebhook( + input:{ + name: $name + patch: $patch + } + ){ + id + name + webhook + } +} \ No newline at end of file diff --git a/internal/lagoon/client/client.go b/internal/lagoon/client/client.go index 93ba94c3..04c65c4c 100644 --- a/internal/lagoon/client/client.go +++ b/internal/lagoon/client/client.go @@ -1,4 +1,4 @@ -//go:generate go-bindata -pkg lgraphql -o lgraphql/lgraphql.go -nometadata _lgraphql/ _lgraphql/variables/ +//go:generate go-bindata -pkg lgraphql -o lgraphql/lgraphql.go -nometadata _lgraphql/ _lgraphql/variables/ _lgraphql/notifications/ // Package client implements the interfaces required by the parent lagoon // package. diff --git a/internal/lagoon/client/lgraphql/lgraphql.go b/internal/lagoon/client/lgraphql/lgraphql.go index 085f2de6..77277091 100644 --- a/internal/lagoon/client/lgraphql/lgraphql.go +++ b/internal/lagoon/client/lgraphql/lgraphql.go @@ -1,16 +1,10 @@ -// Code generated by go-bindata. (@generated) DO NOT EDIT. - -// Package lgraphql generated by go-bindata.// sources: +// Code generated for package lgraphql by go-bindata DO NOT EDIT. (@generated) +// sources: // _lgraphql/addDeployTarget.graphql // _lgraphql/addDeployTargetConfig.graphql // _lgraphql/addEnvVariable.graphql // _lgraphql/addGroup.graphql // _lgraphql/addGroupsToProject.graphql -// _lgraphql/addNotificationEmail.graphql -// _lgraphql/addNotificationMicrosoftTeams.graphql -// _lgraphql/addNotificationRocketChat.graphql -// _lgraphql/addNotificationSlack.graphql -// _lgraphql/addNotificationToProject.graphql // _lgraphql/addOrUpdateEnvironment.graphql // _lgraphql/addProject.graphql // _lgraphql/addRestore.graphql @@ -43,6 +37,33 @@ // _lgraphql/variables/addOrUpdateEnvVariableByName.graphql // _lgraphql/variables/deleteEnvVariableByName.graphql // _lgraphql/variables/getEnvVariablesByProjectEnvironmentName.graphql +// _lgraphql/notifications/addNotificationEmail.graphql +// _lgraphql/notifications/addNotificationMicrosoftTeams.graphql +// _lgraphql/notifications/addNotificationRocketChat.graphql +// _lgraphql/notifications/addNotificationSlack.graphql +// _lgraphql/notifications/addNotificationToProject.graphql +// _lgraphql/notifications/addNotificationWebhook.graphql +// _lgraphql/notifications/deleteNotificationEmail.graphql +// _lgraphql/notifications/deleteNotificationMicrosoftTeams.graphql +// _lgraphql/notifications/deleteNotificationRocketChat.graphql +// _lgraphql/notifications/deleteNotificationSlack.graphql +// _lgraphql/notifications/deleteNotificationWebhook.graphql +// _lgraphql/notifications/listAllNotificationEmail.graphql +// _lgraphql/notifications/listAllNotificationMicrosoftTeams.graphql +// _lgraphql/notifications/listAllNotificationRocketChat.graphql +// _lgraphql/notifications/listAllNotificationSlack.graphql +// _lgraphql/notifications/listAllNotificationWebhook.graphql +// _lgraphql/notifications/projectNotificationEmail.graphql +// _lgraphql/notifications/projectNotificationMicrosoftTeams.graphql +// _lgraphql/notifications/projectNotificationRocketChat.graphql +// _lgraphql/notifications/projectNotificationSlack.graphql +// _lgraphql/notifications/projectNotificationWebhook.graphql +// _lgraphql/notifications/removeNotificationFromProject.graphql +// _lgraphql/notifications/updateNotificationEmail.graphql +// _lgraphql/notifications/updateNotificationMicrosoftTeams.graphql +// _lgraphql/notifications/updateNotificationRocketChat.graphql +// _lgraphql/notifications/updateNotificationSlack.graphql +// _lgraphql/notifications/updateNotificationWebhook.graphql package lgraphql import ( @@ -60,7 +81,7 @@ import ( func bindataRead(data []byte, name string) ([]byte, error) { gz, err := gzip.NewReader(bytes.NewBuffer(data)) if err != nil { - return nil, fmt.Errorf("read %q: %v", name, err) + return nil, fmt.Errorf("Read %q: %v", name, err) } var buf bytes.Buffer @@ -68,7 +89,7 @@ func bindataRead(data []byte, name string) ([]byte, error) { clErr := gz.Close() if err != nil { - return nil, fmt.Errorf("read %q: %v", name, err) + return nil, fmt.Errorf("Read %q: %v", name, err) } if clErr != nil { return nil, err @@ -104,7 +125,7 @@ func (fi bindataFileInfo) Mode() os.FileMode { return fi.mode } -// ModTime return file modify time +// Mode return file modify time func (fi bindataFileInfo) ModTime() time.Time { return fi.modTime } @@ -219,106 +240,6 @@ func _lgraphqlAddgroupstoprojectGraphql() (*asset, error) { return a, nil } -var __lgraphqlAddnotificationemailGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xca\x2d\x2d\x49\x2c\xc9\xcc\xcf\x53\xd0\xe0\x52\x50\x50\xc9\x4b\xcc\x4d\xb5\x52\x08\x2e\x29\xca\xcc\x4b\x57\xd4\x01\x89\xa4\xe6\x26\x66\xe6\x38\xa6\xa4\x14\xa5\x16\x17\xc3\x65\x34\x15\xaa\xb9\x14\x14\x14\x14\x12\x53\x52\xfc\xf2\x4b\x32\xd3\x32\x93\xc1\x66\xb8\x82\xd4\x6a\x64\xe6\x15\x94\x96\x58\x41\x55\x28\x28\x40\x8c\x04\x9b\xac\x03\x15\x42\x35\x13\xc5\x0a\xb0\x8a\x5a\x4d\xb8\xee\xcc\x14\x24\x63\x20\x92\x5c\x20\x0c\x08\x00\x00\xff\xff\x7d\x3b\x64\xad\xb7\x00\x00\x00") - -func _lgraphqlAddnotificationemailGraphqlBytes() ([]byte, error) { - return bindataRead( - __lgraphqlAddnotificationemailGraphql, - "_lgraphql/addNotificationEmail.graphql", - ) -} - -func _lgraphqlAddnotificationemailGraphql() (*asset, error) { - bytes, err := _lgraphqlAddnotificationemailGraphqlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "_lgraphql/addNotificationEmail.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var __lgraphqlAddnotificationmicrosoftteamsGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xca\x2d\x2d\x49\x2c\xc9\xcc\xcf\x53\xd0\xe0\x52\x50\x50\xc9\x4b\xcc\x4d\xb5\x52\x08\x2e\x29\xca\xcc\x4b\x57\xd4\x01\x89\x94\xa7\x26\x65\xe4\xe7\x67\xc3\x05\x35\x15\xaa\xb9\x14\x14\x14\x14\x12\x53\x52\xfc\xf2\x4b\x32\xd3\x32\x93\xc1\xda\x7d\x33\x93\x8b\xf2\x8b\xf3\xd3\x4a\x42\x52\x13\x73\x8b\x35\x32\xf3\x0a\x4a\x4b\xac\xa0\x4a\x15\x14\x20\xc6\x82\x4d\xd7\x81\x0a\xc1\xcd\x85\xd9\x00\x16\xaf\xd5\x84\xeb\xc9\x4c\x41\xd2\x0c\x91\xe4\x02\x61\x40\x00\x00\x00\xff\xff\x97\x56\x46\x93\xb1\x00\x00\x00") - -func _lgraphqlAddnotificationmicrosoftteamsGraphqlBytes() ([]byte, error) { - return bindataRead( - __lgraphqlAddnotificationmicrosoftteamsGraphql, - "_lgraphql/addNotificationMicrosoftTeams.graphql", - ) -} - -func _lgraphqlAddnotificationmicrosoftteamsGraphql() (*asset, error) { - bytes, err := _lgraphqlAddnotificationmicrosoftteamsGraphqlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "_lgraphql/addNotificationMicrosoftTeams.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var __lgraphqlAddnotificationrocketchatGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x54\x8d\x31\x0e\xc2\x30\x0c\x45\xf7\x9c\xe2\x23\x31\xb4\x52\x4f\xd0\x95\x9d\x01\x4e\x60\x92\x40\xac\x52\x1b\x21\x57\x0c\x88\xbb\xa3\xa6\x49\x04\x83\x97\xf7\xad\xf7\xe6\xc5\xc8\x58\x05\x9d\x03\xf6\x42\x73\x1c\x71\xb6\x27\xcb\x6d\x37\xac\xc4\x27\x12\x89\xf7\x7f\xf8\x8a\x97\xa4\x3a\x35\xd8\xe3\xed\x00\x80\x42\x38\xaa\xf1\x95\x7d\x76\x9e\xd4\x4f\xd1\x0e\x89\xac\x63\x79\x2c\x36\x96\x37\x60\xeb\xe4\xdc\x50\x50\x0b\xd5\x64\x1d\x5a\xac\x66\x33\xff\xf4\x4d\xc6\xe1\xc7\xba\x8d\x6e\xbd\x6f\x00\x00\x00\xff\xff\x53\x0f\xa2\x30\xdb\x00\x00\x00") - -func _lgraphqlAddnotificationrocketchatGraphqlBytes() ([]byte, error) { - return bindataRead( - __lgraphqlAddnotificationrocketchatGraphql, - "_lgraphql/addNotificationRocketChat.graphql", - ) -} - -func _lgraphqlAddnotificationrocketchatGraphql() (*asset, error) { - bytes, err := _lgraphqlAddnotificationrocketchatGraphqlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "_lgraphql/addNotificationRocketChat.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var __lgraphqlAddnotificationslackGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x54\x8d\x41\x0e\x82\x40\x0c\x45\xf7\x73\x8a\x6f\xe2\x02\x12\x4e\xc0\x21\xdc\x70\x82\x3a\x33\x4a\x03\xb4\xc6\x94\xb8\x30\xde\xdd\x30\x30\x8d\x2e\xba\x79\xbf\x79\x6f\x59\x8d\x8c\x55\xd0\x04\xe0\x2c\xb4\xe4\x1e\x83\x3d\x59\xee\xa7\x6e\x23\x71\x24\x91\x3c\xff\xc3\x57\xbe\x8e\xaa\x93\xc3\x16\xef\x00\x00\x94\xd2\x45\x8d\x6f\x1c\x8b\x73\x98\x29\x4e\x0d\xcb\x63\xb5\xfe\xf8\x00\xf6\x44\x29\x75\x07\xf2\x46\xad\xd5\xc1\x3b\xb5\x58\xf8\xa7\x75\x19\xa7\x1f\xeb\x3e\x86\xed\xbe\x01\x00\x00\xff\xff\xd9\x6e\xb4\xda\xd6\x00\x00\x00") - -func _lgraphqlAddnotificationslackGraphqlBytes() ([]byte, error) { - return bindataRead( - __lgraphqlAddnotificationslackGraphql, - "_lgraphql/addNotificationSlack.graphql", - ) -} - -func _lgraphqlAddnotificationslackGraphql() (*asset, error) { - bytes, err := _lgraphqlAddnotificationslackGraphqlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "_lgraphql/addNotificationSlack.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var __lgraphqlAddnotificationtoprojectGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xca\x2d\x2d\x49\x2c\xc9\xcc\xcf\x53\xd0\xe0\x52\x50\x50\x29\x28\xca\xcf\x4a\x4d\x2e\xb1\x52\x08\x2e\x29\xca\xcc\x4b\x57\xd4\x01\x09\xe6\xe5\x97\x64\xa6\x65\x26\x83\x95\x85\x54\x16\xa4\x5a\x29\xf8\xa1\x89\x60\xaa\xf3\x4b\xcc\x4d\x85\x9b\xa2\xa9\x50\xcd\xa5\xa0\xa0\xa0\x90\x98\x92\x82\xa2\x33\x3f\x00\x62\x9d\x46\x66\x5e\x41\x69\x89\x15\x54\x95\x82\x02\xdc\x15\x30\xf7\x40\xc5\x31\x1d\x82\xe1\x36\x2c\x2a\x21\x4e\xc1\x70\x1d\x58\x65\xad\x26\xdc\xd2\xcc\x14\x98\x5e\xb8\x24\x17\x08\x03\x02\x00\x00\xff\xff\x5d\xba\xcd\xcd\x21\x01\x00\x00") - -func _lgraphqlAddnotificationtoprojectGraphqlBytes() ([]byte, error) { - return bindataRead( - __lgraphqlAddnotificationtoprojectGraphql, - "_lgraphql/addNotificationToProject.graphql", - ) -} - -func _lgraphqlAddnotificationtoprojectGraphql() (*asset, error) { - bytes, err := _lgraphqlAddnotificationtoprojectGraphqlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "_lgraphql/addNotificationToProject.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - var __lgraphqlAddorupdateenvironmentGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x90\xcd\x4a\xc5\x30\x10\x85\xf7\x7d\x8a\x11\x5c\xdc\x0b\xf7\x09\xb2\x14\x0b\xba\x51\xf1\xe7\x01\x82\x99\x6a\xa4\x9d\x84\x74\x5a\x28\xe2\xbb\x4b\x9b\x26\x9d\xf4\x76\x51\x28\xe7\x9c\xcc\xcc\xf9\xba\x81\x35\x5b\x47\x70\xaa\x00\x6e\x49\x77\xa8\xe0\x8d\x83\xa5\xaf\x9b\xcb\xac\xf8\xe0\x7e\xf0\x93\x15\x3c\x12\x47\xc5\xa0\x6f\xdd\xf4\x3e\x79\x54\x70\x9f\xff\xa5\x77\xa7\x7b\x7c\xc5\xa6\x1c\x14\xad\x07\xd4\x46\x58\x72\xa0\xe5\x16\x0b\x1d\x69\xb4\xc1\x51\x87\xc4\x71\x5b\x4d\xe3\xb6\xca\x79\xa4\xfe\xdb\x36\xfc\x12\x2f\x7c\x92\xa7\x9f\xe1\xb7\x02\x00\xd0\xc6\x3c\x87\x0f\x6f\x34\x63\xbd\x4d\x3b\x59\xf2\x03\xab\x35\x03\x10\x5b\x2f\xe5\x2f\xab\x94\x6b\x27\x00\xc9\x90\xed\x05\x8a\xd2\xce\x00\x4a\x20\x65\x28\xa3\x28\xd1\xec\x16\x45\x2a\x92\x51\x0a\x5c\xe1\xd9\x03\x4b\xc1\x63\x52\x87\x00\x97\x17\x7f\xe7\x4c\xc6\x1a\x81\x28\x9a\xd5\xfc\xfd\x07\x00\x00\xff\xff\x2f\xb0\x49\x31\x36\x02\x00\x00") func _lgraphqlAddorupdateenvironmentGraphqlBytes() ([]byte, error) { @@ -959,12 +880,552 @@ func _lgraphqlVariablesGetenvvariablesbyprojectenvironmentnameGraphql() (*asset, return a, nil } +var __lgraphqlNotificationsAddnotificationemailGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xca\x2d\x2d\x49\x2c\xc9\xcc\xcf\x53\xd0\xe0\x52\x50\x50\xc9\x4b\xcc\x4d\xb5\x52\x08\x2e\x29\xca\xcc\x4b\x57\xd4\x01\x89\xa4\xe6\x26\x66\xe6\x38\xa6\xa4\x14\xa5\x16\x17\xc3\x65\x34\x15\xaa\xb9\x14\x14\x14\x14\x12\x53\x52\xfc\xf2\x4b\x32\xd3\x32\x93\xc1\x66\xb8\x82\xd4\x6a\x64\xe6\x15\x94\x96\x58\x41\x55\x28\x28\x40\x8c\x04\x9b\xac\x03\x15\x42\x35\x13\xc5\x0a\xb0\x8a\x5a\x4d\xb8\xee\xcc\x14\x24\x63\xb0\x68\x87\xa8\xe7\x02\x61\x40\x00\x00\x00\xff\xff\x7d\x85\xc8\xa0\xca\x00\x00\x00") + +func _lgraphqlNotificationsAddnotificationemailGraphqlBytes() ([]byte, error) { + return bindataRead( + __lgraphqlNotificationsAddnotificationemailGraphql, + "_lgraphql/notifications/addNotificationEmail.graphql", + ) +} + +func _lgraphqlNotificationsAddnotificationemailGraphql() (*asset, error) { + bytes, err := _lgraphqlNotificationsAddnotificationemailGraphqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "_lgraphql/notifications/addNotificationEmail.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var __lgraphqlNotificationsAddnotificationmicrosoftteamsGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xca\x2d\x2d\x49\x2c\xc9\xcc\xcf\x53\xd0\xe0\x52\x50\x50\xc9\x4b\xcc\x4d\xb5\x52\x08\x2e\x29\xca\xcc\x4b\x57\xd4\x01\x89\x94\xa7\x26\x65\xe4\xe7\x67\xc3\x05\x35\x15\xaa\xb9\x14\x14\x14\x14\x12\x53\x52\xfc\xf2\x4b\x32\xd3\x32\x93\xc1\xda\x7d\x33\x93\x8b\xf2\x8b\xf3\xd3\x4a\x42\x52\x13\x73\x8b\x35\x32\xf3\x0a\x4a\x4b\xac\xa0\x4a\x15\x14\x20\xc6\x82\x4d\xd7\x81\x0a\xc1\xcd\x85\xd9\x00\x16\xaf\xd5\x84\xeb\xc9\x4c\x41\xd2\x8c\xaa\x09\xa2\x94\x0b\x84\x01\x01\x00\x00\xff\xff\x66\x70\xe5\xad\xbf\x00\x00\x00") + +func _lgraphqlNotificationsAddnotificationmicrosoftteamsGraphqlBytes() ([]byte, error) { + return bindataRead( + __lgraphqlNotificationsAddnotificationmicrosoftteamsGraphql, + "_lgraphql/notifications/addNotificationMicrosoftTeams.graphql", + ) +} + +func _lgraphqlNotificationsAddnotificationmicrosoftteamsGraphql() (*asset, error) { + bytes, err := _lgraphqlNotificationsAddnotificationmicrosoftteamsGraphqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "_lgraphql/notifications/addNotificationMicrosoftTeams.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var __lgraphqlNotificationsAddnotificationrocketchatGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x54\x8d\x31\xce\xc2\x30\x0c\x46\xf7\x9c\xe2\xfb\xa5\x7f\x68\xa5\x9e\xa0\x2b\x3b\x03\x9c\xc0\x24\x81\x58\xa5\x36\x42\xae\x18\x10\x77\x47\x4d\x9b\x88\x0c\x5e\x9e\xed\xf7\xe6\xc5\xc8\x58\x05\x9d\x03\xfe\x85\xe6\x38\xe2\x6c\x4f\x96\xdb\xdf\xb0\x12\x9f\x48\x24\xde\x5b\xf8\x8a\x97\xa4\x3a\x55\xd8\xe3\xed\x00\x80\x42\x38\xaa\xf1\x95\x7d\x76\x9e\xd4\x4f\xd1\x0e\x89\xac\x63\x79\x2c\x36\xee\x67\xc0\xd6\xc9\xb9\x61\x47\x35\x54\x92\x65\x51\x63\x25\x9b\xf9\xa7\xaf\x32\x0e\x3f\xd6\xd6\xd6\x2a\xb6\x47\xb7\xce\x37\x00\x00\xff\xff\x49\x05\x99\xf8\xf7\x00\x00\x00") + +func _lgraphqlNotificationsAddnotificationrocketchatGraphqlBytes() ([]byte, error) { + return bindataRead( + __lgraphqlNotificationsAddnotificationrocketchatGraphql, + "_lgraphql/notifications/addNotificationRocketChat.graphql", + ) +} + +func _lgraphqlNotificationsAddnotificationrocketchatGraphql() (*asset, error) { + bytes, err := _lgraphqlNotificationsAddnotificationrocketchatGraphqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "_lgraphql/notifications/addNotificationRocketChat.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var __lgraphqlNotificationsAddnotificationslackGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x54\x8d\x31\x0e\x83\x30\x0c\x45\xf7\x9c\xe2\x57\xea\x00\x12\x27\xe0\x10\x5d\x38\x81\x9b\xa4\xc5\x02\x9c\xaa\x32\xea\x50\xf5\xee\x15\x81\x58\x64\xf0\xf2\x6c\xbf\xb7\xac\x4a\xca\x49\xd0\x38\xe0\x2a\xb4\xc4\x1e\x83\xbe\x59\x9e\x97\x6e\x23\x7e\x24\x91\x38\xd7\xf0\x13\xef\x63\x4a\x93\xc1\x16\x5f\x07\x00\x14\xc2\x2d\x29\x3f\xd8\x67\xe7\x30\x93\x9f\x1a\x96\xd7\xaa\xfd\x71\x01\xec\x89\x5c\xea\x0e\x64\x8d\x52\x2b\x0b\xeb\x94\x62\xe6\xbf\xd6\x64\x1c\x4e\xd6\xda\x56\x2b\xf6\x47\xb7\xcd\x3f\x00\x00\xff\xff\x50\xa8\xad\xd3\xf2\x00\x00\x00") + +func _lgraphqlNotificationsAddnotificationslackGraphqlBytes() ([]byte, error) { + return bindataRead( + __lgraphqlNotificationsAddnotificationslackGraphql, + "_lgraphql/notifications/addNotificationSlack.graphql", + ) +} + +func _lgraphqlNotificationsAddnotificationslackGraphql() (*asset, error) { + bytes, err := _lgraphqlNotificationsAddnotificationslackGraphqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "_lgraphql/notifications/addNotificationSlack.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var __lgraphqlNotificationsAddnotificationtoprojectGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x8e\x4d\x0a\x02\x31\x0c\x85\xf7\x39\xc5\x13\x5c\x38\x57\xe8\x21\x06\x41\x2f\x50\xa6\x55\x22\x4c\x5a\x86\xcc\x42\x86\xde\x5d\xda\xfa\x83\xc6\x55\xcb\xcb\x97\xbc\x6f\x5e\xd5\x2b\x27\xc1\x81\x80\x7d\x5e\xd2\x2d\x4e\xea\x70\xd2\x85\xe5\xba\xab\x99\x24\xe5\x0b\x4f\x8d\x3a\xdf\x73\x74\x18\x7f\x12\x83\x8d\x7e\x8e\x9f\x1b\xc3\x46\x80\x0f\xe1\x6b\x2d\x1d\x7b\x55\xad\x05\x58\xf2\xaa\x6e\x6b\x7f\xe0\x6d\xf1\xf2\x79\xe6\xd6\xc4\xc8\xfd\x21\xbb\x8c\xf1\x6b\x64\x21\x60\xe8\xb5\x1c\xda\x23\x7d\x54\xa8\xd0\x23\x00\x00\xff\xff\x6a\x63\xe5\x98\x1b\x01\x00\x00") + +func _lgraphqlNotificationsAddnotificationtoprojectGraphqlBytes() ([]byte, error) { + return bindataRead( + __lgraphqlNotificationsAddnotificationtoprojectGraphql, + "_lgraphql/notifications/addNotificationToProject.graphql", + ) +} + +func _lgraphqlNotificationsAddnotificationtoprojectGraphql() (*asset, error) { + bytes, err := _lgraphqlNotificationsAddnotificationtoprojectGraphqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "_lgraphql/notifications/addNotificationToProject.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var __lgraphqlNotificationsAddnotificationwebhookGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xca\x2d\x2d\x49\x2c\xc9\xcc\xcf\x53\xd0\xe0\x52\x50\x50\xc9\x4b\xcc\x4d\xb5\x52\x08\x2e\x29\xca\xcc\x4b\x57\xd4\x01\x89\x94\xa7\x26\x65\xe4\xe7\x67\xc3\x05\x35\x15\xaa\xb9\x14\x14\x14\x14\x12\x53\x52\xfc\xf2\x4b\x32\xd3\x32\x93\xc1\xda\xc3\x21\xca\x34\x32\xf3\x0a\x4a\x4b\xac\xa0\x6a\x14\x14\x20\xe6\x81\x8d\xd5\x81\x0a\xc1\x0d\x84\x19\x0d\x16\xaf\xd5\x84\xeb\xc9\x4c\x41\xd2\x8c\xaa\x09\xa2\x94\x0b\x84\x01\x01\x00\x00\xff\xff\x49\x84\xcd\x6a\xb8\x00\x00\x00") + +func _lgraphqlNotificationsAddnotificationwebhookGraphqlBytes() ([]byte, error) { + return bindataRead( + __lgraphqlNotificationsAddnotificationwebhookGraphql, + "_lgraphql/notifications/addNotificationWebhook.graphql", + ) +} + +func _lgraphqlNotificationsAddnotificationwebhookGraphql() (*asset, error) { + bytes, err := _lgraphqlNotificationsAddnotificationwebhookGraphqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "_lgraphql/notifications/addNotificationWebhook.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var __lgraphqlNotificationsDeletenotificationemailGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xca\x2d\x2d\x49\x2c\xc9\xcc\xcf\x53\xd0\x50\xc9\x4b\xcc\x4d\xb5\x52\x08\x2e\x29\xca\xcc\x4b\x57\xd4\x54\xa8\xe6\x52\x50\x50\x50\x48\x49\xcd\x49\x2d\x49\xf5\xcb\x2f\xc9\x4c\xcb\x4c\x06\xab\xb4\xc2\x22\xe6\x9a\x9b\x98\x99\xa3\x91\x99\x57\x50\x5a\x62\x55\x0d\x31\x07\x6c\x5c\xad\x26\x57\x2d\x20\x00\x00\xff\xff\xac\x83\xb7\xaa\x62\x00\x00\x00") + +func _lgraphqlNotificationsDeletenotificationemailGraphqlBytes() ([]byte, error) { + return bindataRead( + __lgraphqlNotificationsDeletenotificationemailGraphql, + "_lgraphql/notifications/deleteNotificationEmail.graphql", + ) +} + +func _lgraphqlNotificationsDeletenotificationemailGraphql() (*asset, error) { + bytes, err := _lgraphqlNotificationsDeletenotificationemailGraphqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "_lgraphql/notifications/deleteNotificationEmail.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var __lgraphqlNotificationsDeletenotificationmicrosoftteamsGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xca\x2d\x2d\x49\x2c\xc9\xcc\xcf\x53\xd0\x50\xc9\x4b\xcc\x4d\xb5\x52\x08\x2e\x29\xca\xcc\x4b\x57\xd4\x54\xa8\xe6\x52\x50\x50\x50\x48\x49\xcd\x49\x2d\x49\xf5\xcb\x2f\xc9\x4c\xcb\x4c\x06\xab\xb4\xc2\x22\xe6\x9b\x99\x5c\x94\x5f\x9c\x9f\x56\x12\x92\x9a\x98\x5b\xac\x91\x99\x57\x50\x5a\x62\x55\x0d\x31\x10\x6c\x6e\xad\x26\x57\x2d\x20\x00\x00\xff\xff\x54\xf6\x18\xff\x6b\x00\x00\x00") + +func _lgraphqlNotificationsDeletenotificationmicrosoftteamsGraphqlBytes() ([]byte, error) { + return bindataRead( + __lgraphqlNotificationsDeletenotificationmicrosoftteamsGraphql, + "_lgraphql/notifications/deleteNotificationMicrosoftTeams.graphql", + ) +} + +func _lgraphqlNotificationsDeletenotificationmicrosoftteamsGraphql() (*asset, error) { + bytes, err := _lgraphqlNotificationsDeletenotificationmicrosoftteamsGraphqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "_lgraphql/notifications/deleteNotificationMicrosoftTeams.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var __lgraphqlNotificationsDeletenotificationrocketchatGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xca\x2d\x2d\x49\x2c\xc9\xcc\xcf\x53\xd0\x50\xc9\x4b\xcc\x4d\xb5\x52\x08\x2e\x29\xca\xcc\x4b\x57\xd4\x54\xa8\xe6\x52\x50\x50\x50\x48\x49\xcd\x49\x2d\x49\xf5\xcb\x2f\xc9\x4c\xcb\x4c\x06\xab\xb4\xc2\x22\x16\x94\x9f\x9c\x9d\x5a\xe2\x9c\x91\x58\xa2\x91\x99\x57\x50\x5a\x62\x55\x0d\x31\x0c\x6c\x66\xad\x26\x57\x2d\x20\x00\x00\xff\xff\x36\x65\x00\x24\x67\x00\x00\x00") + +func _lgraphqlNotificationsDeletenotificationrocketchatGraphqlBytes() ([]byte, error) { + return bindataRead( + __lgraphqlNotificationsDeletenotificationrocketchatGraphql, + "_lgraphql/notifications/deleteNotificationRocketChat.graphql", + ) +} + +func _lgraphqlNotificationsDeletenotificationrocketchatGraphql() (*asset, error) { + bytes, err := _lgraphqlNotificationsDeletenotificationrocketchatGraphqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "_lgraphql/notifications/deleteNotificationRocketChat.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var __lgraphqlNotificationsDeletenotificationslackGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xca\x2d\x2d\x49\x2c\xc9\xcc\xcf\x53\xd0\x50\xc9\x4b\xcc\x4d\xb5\x52\x08\x2e\x29\xca\xcc\x4b\x57\xd4\x54\xa8\xe6\x52\x50\x50\x50\x48\x49\xcd\x49\x2d\x49\xf5\xcb\x2f\xc9\x4c\xcb\x4c\x06\xab\xb4\xc2\x22\x16\x9c\x93\x98\x9c\xad\x91\x99\x57\x50\x5a\x62\x55\x0d\x31\x07\x6c\x5c\xad\x26\x57\x2d\x20\x00\x00\xff\xff\xee\xc5\xad\x57\x62\x00\x00\x00") + +func _lgraphqlNotificationsDeletenotificationslackGraphqlBytes() ([]byte, error) { + return bindataRead( + __lgraphqlNotificationsDeletenotificationslackGraphql, + "_lgraphql/notifications/deleteNotificationSlack.graphql", + ) +} + +func _lgraphqlNotificationsDeletenotificationslackGraphql() (*asset, error) { + bytes, err := _lgraphqlNotificationsDeletenotificationslackGraphqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "_lgraphql/notifications/deleteNotificationSlack.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var __lgraphqlNotificationsDeletenotificationwebhookGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xca\x2d\x2d\x49\x2c\xc9\xcc\xcf\x53\xd0\x50\xc9\x4b\xcc\x4d\xb5\x52\x08\x2e\x29\xca\xcc\x4b\x57\xd4\x54\xa8\xe6\x52\x50\x50\x50\x48\x49\xcd\x49\x2d\x49\xf5\xcb\x2f\xc9\x4c\xcb\x4c\x06\xab\xb4\xc2\x22\x16\x9e\x9a\x94\x91\x9f\x9f\xad\x91\x99\x57\x50\x5a\x62\x55\x0d\x31\x09\x6c\x60\xad\x26\x57\x2d\x20\x00\x00\xff\xff\x8a\x89\x7f\x55\x64\x00\x00\x00") + +func _lgraphqlNotificationsDeletenotificationwebhookGraphqlBytes() ([]byte, error) { + return bindataRead( + __lgraphqlNotificationsDeletenotificationwebhookGraphql, + "_lgraphql/notifications/deleteNotificationWebhook.graphql", + ) +} + +func _lgraphqlNotificationsDeletenotificationwebhookGraphql() (*asset, error) { + bytes, err := _lgraphqlNotificationsDeletenotificationwebhookGraphqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "_lgraphql/notifications/deleteNotificationWebhook.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var __lgraphqlNotificationsListallnotificationemailGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x2a\x2c\x4d\x2d\xaa\x54\xa8\xe6\x52\x50\x50\x50\x48\xcc\xc9\x09\x28\xca\xcf\x4a\x4d\x2e\x29\x86\x8a\x80\x40\x5e\x62\x6e\x2a\x9c\x93\x99\x82\x10\xcf\x2f\xc9\x4c\xcb\x4c\x4e\x2c\xc9\xcc\xcf\x2b\xd6\x28\xa9\x2c\x48\xb5\x52\x70\xf5\x75\xf4\xf4\xd1\x44\xd2\x0c\x02\x7a\x7a\x7a\x0a\xf9\x79\x0a\x7e\x48\xea\x5d\x73\x13\x33\x73\xd0\x94\x81\x40\x7c\x3c\xc8\x1c\x14\x1b\x61\x20\x15\xa4\xc5\x31\x25\xa5\x28\xb5\xb8\x18\x43\x12\x43\x47\x2d\x17\x2a\xab\x96\xab\x16\x10\x00\x00\xff\xff\x24\xd5\x22\x2e\xea\x00\x00\x00") + +func _lgraphqlNotificationsListallnotificationemailGraphqlBytes() ([]byte, error) { + return bindataRead( + __lgraphqlNotificationsListallnotificationemailGraphql, + "_lgraphql/notifications/listAllNotificationEmail.graphql", + ) +} + +func _lgraphqlNotificationsListallnotificationemailGraphql() (*asset, error) { + bytes, err := _lgraphqlNotificationsListallnotificationemailGraphqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "_lgraphql/notifications/listAllNotificationEmail.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var __lgraphqlNotificationsListallnotificationmicrosoftteamsGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x2a\x2c\x4d\x2d\xaa\x54\xa8\xe6\x52\x50\x50\x50\x48\xcc\xc9\x09\x28\xca\xcf\x4a\x4d\x2e\x29\x86\x8a\x80\x40\x5e\x62\x6e\x2a\x9c\x93\x99\x82\x10\xcf\x2f\xc9\x4c\xcb\x4c\x4e\x2c\xc9\xcc\xcf\x2b\xd6\x28\xa9\x2c\x48\xb5\x52\xf0\xf5\x74\x0e\xf2\x0f\xf6\x77\x0b\x09\x71\x75\xf4\x0d\xd6\x44\x32\x05\x04\xf4\xf4\xf4\x14\xf2\xf3\x14\xfc\x90\x34\xfa\x66\x26\x17\xe5\x17\xe7\xa7\x95\x84\xa4\x26\xe6\x16\xa3\xa9\x07\x81\xf8\x78\x90\xc9\x28\x6e\x80\x81\xf2\xd4\xa4\x8c\xfc\xfc\x6c\x0c\x71\x0c\xc5\xb5\x5c\xa8\xac\x5a\xae\x5a\x40\x00\x00\x00\xff\xff\x3c\x1a\x87\x3b\xf7\x00\x00\x00") + +func _lgraphqlNotificationsListallnotificationmicrosoftteamsGraphqlBytes() ([]byte, error) { + return bindataRead( + __lgraphqlNotificationsListallnotificationmicrosoftteamsGraphql, + "_lgraphql/notifications/listAllNotificationMicrosoftTeams.graphql", + ) +} + +func _lgraphqlNotificationsListallnotificationmicrosoftteamsGraphql() (*asset, error) { + bytes, err := _lgraphqlNotificationsListallnotificationmicrosoftteamsGraphqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "_lgraphql/notifications/listAllNotificationMicrosoftTeams.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var __lgraphqlNotificationsListallnotificationrocketchatGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x2a\x2c\x4d\x2d\xaa\x54\xa8\xe6\x52\x50\x50\x50\x48\xcc\xc9\x09\x28\xca\xcf\x4a\x4d\x2e\x29\x86\x8a\x80\x40\x5e\x62\x6e\x2a\x9c\x93\x99\x82\x10\xcf\x2f\xc9\x4c\xcb\x4c\x4e\x2c\xc9\xcc\xcf\x2b\xd6\x28\xa9\x2c\x48\xb5\x52\x08\xf2\x77\xf6\x76\x0d\x71\xf6\x70\x0c\xd1\x44\x32\x01\x04\xf4\xf4\xf4\x14\xf2\xf3\x14\xfc\x90\x34\x05\xe5\x27\x67\xa7\x96\x38\x67\x24\x96\xa0\xa9\x05\x81\xf8\x78\x90\x89\x28\x76\xc3\x40\x79\x6a\x52\x46\x7e\x7e\x36\x86\x78\x72\x46\x62\x5e\x5e\x6a\x0e\x86\x38\x86\x21\xb5\x5c\xa8\xac\x5a\xae\x5a\x40\x00\x00\x00\xff\xff\x4a\x62\x23\x28\x07\x01\x00\x00") + +func _lgraphqlNotificationsListallnotificationrocketchatGraphqlBytes() ([]byte, error) { + return bindataRead( + __lgraphqlNotificationsListallnotificationrocketchatGraphql, + "_lgraphql/notifications/listAllNotificationRocketChat.graphql", + ) +} + +func _lgraphqlNotificationsListallnotificationrocketchatGraphql() (*asset, error) { + bytes, err := _lgraphqlNotificationsListallnotificationrocketchatGraphqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "_lgraphql/notifications/listAllNotificationRocketChat.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var __lgraphqlNotificationsListallnotificationslackGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x2a\x2c\x4d\x2d\xaa\x54\xa8\xe6\x52\x50\x50\x50\x48\xcc\xc9\x09\x28\xca\xcf\x4a\x4d\x2e\x29\x86\x8a\x80\x40\x5e\x62\x6e\x2a\x9c\x93\x99\x82\x10\xcf\x2f\xc9\x4c\xcb\x4c\x4e\x2c\xc9\xcc\xcf\x2b\xd6\x28\xa9\x2c\x48\xb5\x52\x08\xf6\x71\x74\xf6\xd6\x44\xd2\x0c\x02\x7a\x7a\x7a\x0a\xf9\x79\x0a\x7e\x48\xea\x83\x73\x12\x93\xb3\xd1\x94\x81\x40\x7c\x3c\xc8\x1c\x14\x1b\x61\xa0\x3c\x35\x29\x23\x3f\x3f\x1b\x43\x3c\x39\x23\x31\x2f\x2f\x35\x07\x43\x1c\xc3\x90\x5a\x2e\x54\x56\x2d\x57\x2d\x20\x00\x00\xff\xff\xff\x6b\xa2\xcc\xfd\x00\x00\x00") + +func _lgraphqlNotificationsListallnotificationslackGraphqlBytes() ([]byte, error) { + return bindataRead( + __lgraphqlNotificationsListallnotificationslackGraphql, + "_lgraphql/notifications/listAllNotificationSlack.graphql", + ) +} + +func _lgraphqlNotificationsListallnotificationslackGraphql() (*asset, error) { + bytes, err := _lgraphqlNotificationsListallnotificationslackGraphqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "_lgraphql/notifications/listAllNotificationSlack.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var __lgraphqlNotificationsListallnotificationwebhookGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x2a\x2c\x4d\x2d\xaa\x54\xa8\xe6\x52\x50\x50\x50\x48\xcc\xc9\x09\x28\xca\xcf\x4a\x4d\x2e\x29\x86\x8a\x80\x40\x5e\x62\x6e\x2a\x9c\x93\x99\x82\x10\xcf\x2f\xc9\x4c\xcb\x4c\x4e\x2c\xc9\xcc\xcf\x2b\xd6\x28\xa9\x2c\x48\xb5\x52\x08\x77\x75\xf2\xf0\xf7\xf7\xd6\x44\xd2\x0e\x02\x7a\x7a\x7a\x0a\xf9\x79\x0a\x7e\x48\x3a\xc2\x53\x93\x32\xf2\xf3\xb3\xd1\x14\x82\x40\x7c\x3c\xc8\x2c\x14\x5b\x61\xa0\x1c\xa2\x09\x43\x1c\x43\x71\x2d\x17\x2a\xab\x96\xab\x16\x10\x00\x00\xff\xff\x92\xfc\x32\xab\xe9\x00\x00\x00") + +func _lgraphqlNotificationsListallnotificationwebhookGraphqlBytes() ([]byte, error) { + return bindataRead( + __lgraphqlNotificationsListallnotificationwebhookGraphql, + "_lgraphql/notifications/listAllNotificationWebhook.graphql", + ) +} + +func _lgraphqlNotificationsListallnotificationwebhookGraphql() (*asset, error) { + bytes, err := _lgraphqlNotificationsListallnotificationwebhookGraphqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "_lgraphql/notifications/listAllNotificationWebhook.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var __lgraphqlNotificationsProjectnotificationemailGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x2a\x2c\x4d\x2d\xaa\x54\xd0\x50\xc9\x4b\xcc\x4d\xb5\x52\x08\x2e\x29\xca\xcc\x4b\x57\xd4\x54\xa8\xe6\x52\x50\x50\x50\x28\x28\xca\xcf\x4a\x4d\x2e\x71\xaa\xf4\x4b\xcc\x4d\xd5\x80\x28\x01\xab\x84\x29\x00\x81\xbc\xfc\x92\xcc\xb4\xcc\xe4\xc4\x92\xcc\xfc\xbc\x62\x8d\x92\xca\x82\x54\x2b\x05\x57\x5f\x47\x4f\x1f\x64\x45\x20\xa0\xa7\xa7\xa7\x90\x9f\xa7\xe0\x87\xa4\xde\x35\x37\x31\x33\x07\x4d\x19\x08\xc4\xc7\x83\xcc\x01\xd9\x84\x21\x95\x0a\xd2\xe2\x98\x92\x52\x94\x5a\x5c\x8c\x21\x89\xa1\xa3\x96\x0b\x95\x55\xcb\x55\x0b\x08\x00\x00\xff\xff\x65\xff\x3e\x1e\xf2\x00\x00\x00") + +func _lgraphqlNotificationsProjectnotificationemailGraphqlBytes() ([]byte, error) { + return bindataRead( + __lgraphqlNotificationsProjectnotificationemailGraphql, + "_lgraphql/notifications/projectNotificationEmail.graphql", + ) +} + +func _lgraphqlNotificationsProjectnotificationemailGraphql() (*asset, error) { + bytes, err := _lgraphqlNotificationsProjectnotificationemailGraphqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "_lgraphql/notifications/projectNotificationEmail.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var __lgraphqlNotificationsProjectnotificationmicrosoftteamsGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x2a\x2c\x4d\x2d\xaa\x54\xd0\x50\xc9\x4b\xcc\x4d\xb5\x52\x08\x2e\x29\xca\xcc\x4b\x57\xd4\x54\xa8\xe6\x52\x50\x50\x50\x28\x28\xca\xcf\x4a\x4d\x2e\x71\xaa\xf4\x4b\xcc\x4d\xd5\x80\x28\x01\xab\x84\x29\x00\x81\xbc\xfc\x92\xcc\xb4\xcc\xe4\xc4\x92\xcc\xfc\xbc\x62\x8d\x92\xca\x82\x54\x2b\x05\x5f\x4f\xe7\x20\xff\x60\x7f\xb7\x90\x10\x57\x47\xdf\x60\x64\xd5\x20\xa0\xa7\xa7\xa7\x90\x9f\xa7\xe0\x87\xa4\xd1\x37\x33\xb9\x28\xbf\x38\x3f\xad\x24\x24\x35\x31\xb7\x18\x4d\x3d\x08\xc4\xc7\x83\x4c\x06\xd9\x8d\x21\x55\x9e\x9a\x94\x91\x9f\x9f\x8d\x21\x8e\xa1\xb8\x96\x0b\x95\x55\xcb\x55\x0b\x08\x00\x00\xff\xff\xbf\xb5\x85\x65\xff\x00\x00\x00") + +func _lgraphqlNotificationsProjectnotificationmicrosoftteamsGraphqlBytes() ([]byte, error) { + return bindataRead( + __lgraphqlNotificationsProjectnotificationmicrosoftteamsGraphql, + "_lgraphql/notifications/projectNotificationMicrosoftTeams.graphql", + ) +} + +func _lgraphqlNotificationsProjectnotificationmicrosoftteamsGraphql() (*asset, error) { + bytes, err := _lgraphqlNotificationsProjectnotificationmicrosoftteamsGraphqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "_lgraphql/notifications/projectNotificationMicrosoftTeams.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var __lgraphqlNotificationsProjectnotificationrocketchatGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x64\x8d\xc1\x0a\xc2\x30\x0c\x86\xef\x7b\x8a\x08\x1e\xe6\x65\x0f\xb0\x9b\x0e\x41\x10\x26\xcc\xdd\x47\x2d\xd1\xd6\xb9\x64\xd6\x88\x14\xe9\xbb\x4b\x15\x61\xda\xef\x14\xfe\x7c\xf9\x73\xbd\xa3\xf3\x90\xcf\x49\x0d\x58\xc2\x5e\x9c\xa5\xd3\x6c\x01\xcf\x0c\x00\x60\x74\x7c\x46\x2d\x2b\x5f\xab\x01\xf3\x8f\xf2\x36\xbf\x42\x84\x58\xec\xd1\x6a\x25\x96\xe9\x96\x8b\x1f\xb1\x84\x66\x57\x6d\xd7\x6d\xb5\x59\xb6\x53\x33\x52\x14\x05\x30\x41\x3d\x39\x6a\x58\xf7\x28\x95\x51\xf2\xe7\x46\xba\x2e\x36\xc6\x9f\xc9\xea\x81\x07\xc3\xdc\x27\xb9\x36\x8a\x08\x2f\x49\x9e\x94\x84\xec\x77\x0a\x59\x78\x05\x00\x00\xff\xff\x98\xc9\xde\xdd\x0f\x01\x00\x00") + +func _lgraphqlNotificationsProjectnotificationrocketchatGraphqlBytes() ([]byte, error) { + return bindataRead( + __lgraphqlNotificationsProjectnotificationrocketchatGraphql, + "_lgraphql/notifications/projectNotificationRocketChat.graphql", + ) +} + +func _lgraphqlNotificationsProjectnotificationrocketchatGraphql() (*asset, error) { + bytes, err := _lgraphqlNotificationsProjectnotificationrocketchatGraphqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "_lgraphql/notifications/projectNotificationRocketChat.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var __lgraphqlNotificationsProjectnotificationslackGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x2a\x2c\x4d\x2d\xaa\x54\xd0\x50\xc9\x4b\xcc\x4d\xb5\x52\x08\x2e\x29\xca\xcc\x4b\x57\xd4\x54\xa8\xe6\x52\x50\x50\x50\x28\x28\xca\xcf\x4a\x4d\x2e\x71\xaa\xf4\x4b\xcc\x4d\xd5\x80\x28\x01\xab\x84\x29\x00\x81\xbc\xfc\x92\xcc\xb4\xcc\xe4\xc4\x92\xcc\xfc\xbc\x62\x8d\x92\xca\x02\x90\x39\x3e\x8e\xce\xde\xc8\x8a\x40\x40\x4f\x4f\x4f\x21\x3f\x4f\xc1\x0f\x49\x7d\x70\x4e\x62\x72\x36\x9a\x32\x10\x88\x8f\x07\x99\x03\xb2\x09\x43\xaa\x3c\x35\x29\x23\x3f\x3f\x1b\x43\x3c\x39\x23\x31\x2f\x2f\x35\x07\x43\x1c\xc3\x90\x5a\x2e\x54\x56\x2d\x57\x2d\x20\x00\x00\xff\xff\xff\xce\xda\x6a\x05\x01\x00\x00") + +func _lgraphqlNotificationsProjectnotificationslackGraphqlBytes() ([]byte, error) { + return bindataRead( + __lgraphqlNotificationsProjectnotificationslackGraphql, + "_lgraphql/notifications/projectNotificationSlack.graphql", + ) +} + +func _lgraphqlNotificationsProjectnotificationslackGraphql() (*asset, error) { + bytes, err := _lgraphqlNotificationsProjectnotificationslackGraphqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "_lgraphql/notifications/projectNotificationSlack.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var __lgraphqlNotificationsProjectnotificationwebhookGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x2a\x2c\x4d\x2d\xaa\x54\xd0\x50\xc9\x4b\xcc\x4d\xb5\x52\x08\x2e\x29\xca\xcc\x4b\x57\xd4\x54\xa8\xe6\x52\x50\x50\x50\x28\x28\xca\xcf\x4a\x4d\x2e\x71\xaa\xf4\x4b\xcc\x4d\xd5\x80\x28\x01\xab\x84\x29\x00\x81\xbc\xfc\x92\xcc\xb4\xcc\xe4\xc4\x92\xcc\xfc\xbc\x62\x8d\x92\xca\x82\x54\x2b\x85\x70\x57\x27\x0f\x7f\x7f\x6f\x64\x65\x20\xa0\xa7\xa7\xa7\x90\x9f\xa7\xe0\x87\xa4\x23\x3c\x35\x29\x23\x3f\x3f\x1b\x4d\x21\x08\xc4\xc7\x83\xcc\x02\xd9\x86\x21\x55\x0e\xd1\x84\x21\x8e\xa1\xb8\x96\x0b\x95\x55\xcb\x55\x0b\x08\x00\x00\xff\xff\x7d\x54\xe7\x02\xf1\x00\x00\x00") + +func _lgraphqlNotificationsProjectnotificationwebhookGraphqlBytes() ([]byte, error) { + return bindataRead( + __lgraphqlNotificationsProjectnotificationwebhookGraphql, + "_lgraphql/notifications/projectNotificationWebhook.graphql", + ) +} + +func _lgraphqlNotificationsProjectnotificationwebhookGraphql() (*asset, error) { + bytes, err := _lgraphqlNotificationsProjectnotificationwebhookGraphqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "_lgraphql/notifications/projectNotificationWebhook.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var __lgraphqlNotificationsRemovenotificationfromprojectGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x8e\x4d\x0a\x02\x31\x0c\x85\xf7\x39\xc5\x13\x5c\x38\x57\xe8\x01\x5c\x0e\x82\x5e\x60\x18\xa3\x44\x68\x53\x4a\x46\x90\x61\xee\x2e\x6d\xfd\xc3\xce\x2e\x79\x7c\xc9\xfb\xfc\x64\x83\x89\x06\xec\x08\xd8\xc6\xa4\x37\x1e\xcd\xe1\x68\x49\xc2\x75\x93\xb3\xa0\x26\x17\x19\x0b\x75\x7a\x44\x76\xe8\xff\x92\x06\xeb\x07\xcf\xdf\x1f\xdd\x4c\x40\x62\xaf\x77\xfe\xbd\xdc\x27\xf5\x87\xda\x97\xbb\x01\x09\x71\x32\x37\x97\x19\xf8\xa8\xbc\xa5\x5e\x79\xab\xd3\x18\xae\x90\xd5\xa8\x91\x2c\xe4\x42\x40\x57\x6b\xe5\x4c\x79\x5f\xe8\x19\x00\x00\xff\xff\x17\x0d\x7b\xbb\x17\x01\x00\x00") + +func _lgraphqlNotificationsRemovenotificationfromprojectGraphqlBytes() ([]byte, error) { + return bindataRead( + __lgraphqlNotificationsRemovenotificationfromprojectGraphql, + "_lgraphql/notifications/removeNotificationFromProject.graphql", + ) +} + +func _lgraphqlNotificationsRemovenotificationfromprojectGraphql() (*asset, error) { + bytes, err := _lgraphqlNotificationsRemovenotificationfromprojectGraphqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "_lgraphql/notifications/removeNotificationFromProject.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var __lgraphqlNotificationsUpdatenotificationemailGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x8e\x3d\x0a\x02\x31\x10\x85\xeb\xcc\x29\x66\xc1\xc2\xbd\x42\x3a\x0b\x0b\x1b\x11\xc4\x03\x0c\x9b\xa8\x03\x26\x1b\x76\x27\x55\xc8\xdd\x65\x36\x12\x14\x9c\xee\xfd\xe4\x7d\x09\x59\x48\x78\x8e\xb8\x07\x44\xc4\x5d\xa4\xe0\x2d\x5e\x65\xe1\xf8\x18\x9a\x95\x48\xa6\xa7\xc5\x5b\x72\x24\xfe\x3c\x0b\xdf\x79\xda\xde\x1c\x03\xf1\xeb\xa2\xe9\x29\xa6\x2c\x03\x8c\x58\xc0\xe4\xff\xbd\xb6\xaf\xc7\x5a\xb6\xa5\x6b\xbd\x86\xdd\xe8\x3f\xfe\x87\xdd\xfe\xd0\x93\x0a\x66\x2c\x60\x0c\x3b\xf8\x1e\xe8\xc2\x2b\xf0\xe0\xdc\xe2\xd7\x15\x4c\x85\xfa\x0e\x00\x00\xff\xff\x53\xd5\xfd\x0c\xe6\x00\x00\x00") + +func _lgraphqlNotificationsUpdatenotificationemailGraphqlBytes() ([]byte, error) { + return bindataRead( + __lgraphqlNotificationsUpdatenotificationemailGraphql, + "_lgraphql/notifications/updateNotificationEmail.graphql", + ) +} + +func _lgraphqlNotificationsUpdatenotificationemailGraphql() (*asset, error) { + bytes, err := _lgraphqlNotificationsUpdatenotificationemailGraphqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "_lgraphql/notifications/updateNotificationEmail.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var __lgraphqlNotificationsUpdatenotificationmicrosoftteamsGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x84\x8e\x31\x0e\xc2\x30\x0c\x45\xe7\xf8\x14\xae\xc4\x40\xaf\xd0\x1b\x30\x80\x90\x80\x03\x84\x34\xa5\x16\x4a\x1c\xb5\x8e\x18\xa2\xdc\x1d\xa5\x41\x11\x4c\xfc\xed\x7f\xfb\xdb\xcf\x45\xd1\x42\xec\x71\x0f\x88\x88\x3b\xaf\x9d\x1d\xf0\x22\x0b\xf9\x47\x57\xa3\xa0\xc5\xcc\x03\xde\xc2\xa8\xc5\x9e\x58\x68\x22\xb3\x75\x8e\x64\x16\x5e\x79\x92\xab\xd5\x6e\x3d\x97\xb5\x83\x0f\x51\x3a\xe8\x31\x81\x8a\x7f\x0a\xf5\x63\x11\x95\xd6\x90\x9a\x2f\xaa\x20\x1b\xcf\x4f\xfe\xa1\xa9\x54\x6d\x92\x41\xf5\x09\x94\xa2\x11\xbe\x0f\x34\xf3\xb2\xf7\x99\xf9\x09\x2a\x43\x7e\x07\x00\x00\xff\xff\x71\xce\xd3\xe8\xf3\x00\x00\x00") + +func _lgraphqlNotificationsUpdatenotificationmicrosoftteamsGraphqlBytes() ([]byte, error) { + return bindataRead( + __lgraphqlNotificationsUpdatenotificationmicrosoftteamsGraphql, + "_lgraphql/notifications/updateNotificationMicrosoftTeams.graphql", + ) +} + +func _lgraphqlNotificationsUpdatenotificationmicrosoftteamsGraphql() (*asset, error) { + bytes, err := _lgraphqlNotificationsUpdatenotificationmicrosoftteamsGraphqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "_lgraphql/notifications/updateNotificationMicrosoftTeams.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var __lgraphqlNotificationsUpdatenotificationrocketchatGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x7c\x8e\xb1\x0e\xc2\x30\x0c\x44\xe7\xf8\x2b\x5c\x89\x81\xfe\x42\x57\x26\x16\x84\x40\x7c\x80\x49\x03\xb1\x4a\x9d\x0a\x39\x62\x88\xf2\xef\x28\x0d\x8a\x60\xe1\xb6\xbb\xdc\xc5\x6f\x8e\x4a\xca\x41\x70\x0b\x88\x88\x1b\xa1\xd9\x0d\x78\xd6\x27\xcb\xbd\xab\xd1\x42\x6a\xfd\x80\x97\x65\x24\x75\x87\xa0\x7c\x63\xbb\x6e\x4e\xc1\x4e\x4e\x77\x9e\xf4\x58\x2a\x7b\x59\xa2\x76\xd0\x63\x02\x13\xff\x94\xeb\xa5\x22\x2e\x8b\x21\x35\x5f\x54\x01\x56\x8e\x9f\xfc\x43\x51\x69\xda\x4b\x06\xd3\x27\x30\x86\x47\xf8\xfe\xa0\x19\xeb\x49\xc4\x3d\x9a\x7f\xb9\xab\x0f\x61\x02\x93\x21\xbf\x03\x00\x00\xff\xff\x5d\x2a\x5a\x5e\xfb\x00\x00\x00") + +func _lgraphqlNotificationsUpdatenotificationrocketchatGraphqlBytes() ([]byte, error) { + return bindataRead( + __lgraphqlNotificationsUpdatenotificationrocketchatGraphql, + "_lgraphql/notifications/updateNotificationRocketChat.graphql", + ) +} + +func _lgraphqlNotificationsUpdatenotificationrocketchatGraphql() (*asset, error) { + bytes, err := _lgraphqlNotificationsUpdatenotificationrocketchatGraphqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "_lgraphql/notifications/updateNotificationRocketChat.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var __lgraphqlNotificationsUpdatenotificationslackGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x4e\x4b\x0a\xc2\x30\x10\x5d\x67\x4e\x31\x05\x17\xf6\x0a\xbd\x81\x1b\x11\x8a\x07\x18\xd3\x68\x87\xb6\x93\x20\x13\x5c\x84\xdc\x5d\xd2\x48\x50\xf0\xed\xde\x67\xde\x9b\x2d\x2a\x29\x7b\xc1\x23\x20\x22\x1e\x84\x36\x37\xe0\xa8\x4f\x96\x47\x57\xa5\x40\x6a\xe7\x01\xaf\x61\x22\x75\x67\xaf\x7c\x67\xbb\xdf\x8c\x2b\xd9\xe5\x52\xdc\x93\x84\xa8\x1d\xf4\x98\xc0\xc4\xff\xb9\xda\x5f\xc0\x25\x3c\xa4\xc6\x0b\xea\xec\xbe\xfe\xa3\x7f\xb6\xeb\x0f\xcd\xc9\x60\xfa\x04\xc6\xf0\x04\xdf\x05\x8d\xd8\x99\x44\xdc\xda\xf8\xcb\xdd\x66\xef\x17\x30\x19\xf2\x3b\x00\x00\xff\xff\xd4\x02\x8b\x34\xf1\x00\x00\x00") + +func _lgraphqlNotificationsUpdatenotificationslackGraphqlBytes() ([]byte, error) { + return bindataRead( + __lgraphqlNotificationsUpdatenotificationslackGraphql, + "_lgraphql/notifications/updateNotificationSlack.graphql", + ) +} + +func _lgraphqlNotificationsUpdatenotificationslackGraphql() (*asset, error) { + bytes, err := _lgraphqlNotificationsUpdatenotificationslackGraphqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "_lgraphql/notifications/updateNotificationSlack.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var __lgraphqlNotificationsUpdatenotificationwebhookGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xca\x2d\x2d\x49\x2c\xc9\xcc\xcf\x53\xd0\xe0\x52\x50\x50\x50\x50\xc9\x4b\xcc\x4d\xb5\x52\x08\x2e\x29\xca\xcc\x4b\x57\x84\x08\x15\x24\x96\x24\x67\x58\x29\x84\x16\xa4\x24\x96\xa4\xfa\xe5\x97\x64\xa6\x65\x26\x83\xf5\x84\xa7\x26\x65\xe4\xe7\x67\x07\x80\xe4\x3d\xf3\x0a\x4a\x4b\x14\xb9\x34\x15\xaa\xb9\x38\x4b\x71\xa9\x84\xd8\x01\x02\x99\x20\xe5\x56\xd5\x70\x3e\x08\x40\xac\x06\xbb\x00\x45\x1c\x6a\x3f\xc4\x1d\x70\x99\x5a\x2e\x4e\xcd\x6a\x2e\x4e\xce\xcc\x14\x2e\x64\x03\xe0\x9c\x72\x88\x95\x5c\x9c\xb5\x5c\xb5\x80\x00\x00\x00\xff\xff\x93\xb3\xe1\xf1\xe5\x00\x00\x00") + +func _lgraphqlNotificationsUpdatenotificationwebhookGraphqlBytes() ([]byte, error) { + return bindataRead( + __lgraphqlNotificationsUpdatenotificationwebhookGraphql, + "_lgraphql/notifications/updateNotificationWebhook.graphql", + ) +} + +func _lgraphqlNotificationsUpdatenotificationwebhookGraphql() (*asset, error) { + bytes, err := _lgraphqlNotificationsUpdatenotificationwebhookGraphqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "_lgraphql/notifications/updateNotificationWebhook.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + // Asset loads and returns the asset for the given name. // It returns an error if the asset could not be found or // could not be loaded. func Asset(name string) ([]byte, error) { - canonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[canonicalName]; ok { + cannonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[cannonicalName]; ok { a, err := f() if err != nil { return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) @@ -989,8 +1450,8 @@ func MustAsset(name string) []byte { // It returns an error if the asset could not be found or // could not be loaded. func AssetInfo(name string) (os.FileInfo, error) { - canonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[canonicalName]; ok { + cannonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[cannonicalName]; ok { a, err := f() if err != nil { return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) @@ -1016,11 +1477,6 @@ var _bindata = map[string]func() (*asset, error){ "_lgraphql/addEnvVariable.graphql": _lgraphqlAddenvvariableGraphql, "_lgraphql/addGroup.graphql": _lgraphqlAddgroupGraphql, "_lgraphql/addGroupsToProject.graphql": _lgraphqlAddgroupstoprojectGraphql, - "_lgraphql/addNotificationEmail.graphql": _lgraphqlAddnotificationemailGraphql, - "_lgraphql/addNotificationMicrosoftTeams.graphql": _lgraphqlAddnotificationmicrosoftteamsGraphql, - "_lgraphql/addNotificationRocketChat.graphql": _lgraphqlAddnotificationrocketchatGraphql, - "_lgraphql/addNotificationSlack.graphql": _lgraphqlAddnotificationslackGraphql, - "_lgraphql/addNotificationToProject.graphql": _lgraphqlAddnotificationtoprojectGraphql, "_lgraphql/addOrUpdateEnvironment.graphql": _lgraphqlAddorupdateenvironmentGraphql, "_lgraphql/addProject.graphql": _lgraphqlAddprojectGraphql, "_lgraphql/addRestore.graphql": _lgraphqlAddrestoreGraphql, @@ -1053,28 +1509,53 @@ var _bindata = map[string]func() (*asset, error){ "_lgraphql/variables/addOrUpdateEnvVariableByName.graphql": _lgraphqlVariablesAddorupdateenvvariablebynameGraphql, "_lgraphql/variables/deleteEnvVariableByName.graphql": _lgraphqlVariablesDeleteenvvariablebynameGraphql, "_lgraphql/variables/getEnvVariablesByProjectEnvironmentName.graphql": _lgraphqlVariablesGetenvvariablesbyprojectenvironmentnameGraphql, + "_lgraphql/notifications/addNotificationEmail.graphql": _lgraphqlNotificationsAddnotificationemailGraphql, + "_lgraphql/notifications/addNotificationMicrosoftTeams.graphql": _lgraphqlNotificationsAddnotificationmicrosoftteamsGraphql, + "_lgraphql/notifications/addNotificationRocketChat.graphql": _lgraphqlNotificationsAddnotificationrocketchatGraphql, + "_lgraphql/notifications/addNotificationSlack.graphql": _lgraphqlNotificationsAddnotificationslackGraphql, + "_lgraphql/notifications/addNotificationToProject.graphql": _lgraphqlNotificationsAddnotificationtoprojectGraphql, + "_lgraphql/notifications/addNotificationWebhook.graphql": _lgraphqlNotificationsAddnotificationwebhookGraphql, + "_lgraphql/notifications/deleteNotificationEmail.graphql": _lgraphqlNotificationsDeletenotificationemailGraphql, + "_lgraphql/notifications/deleteNotificationMicrosoftTeams.graphql": _lgraphqlNotificationsDeletenotificationmicrosoftteamsGraphql, + "_lgraphql/notifications/deleteNotificationRocketChat.graphql": _lgraphqlNotificationsDeletenotificationrocketchatGraphql, + "_lgraphql/notifications/deleteNotificationSlack.graphql": _lgraphqlNotificationsDeletenotificationslackGraphql, + "_lgraphql/notifications/deleteNotificationWebhook.graphql": _lgraphqlNotificationsDeletenotificationwebhookGraphql, + "_lgraphql/notifications/listAllNotificationEmail.graphql": _lgraphqlNotificationsListallnotificationemailGraphql, + "_lgraphql/notifications/listAllNotificationMicrosoftTeams.graphql": _lgraphqlNotificationsListallnotificationmicrosoftteamsGraphql, + "_lgraphql/notifications/listAllNotificationRocketChat.graphql": _lgraphqlNotificationsListallnotificationrocketchatGraphql, + "_lgraphql/notifications/listAllNotificationSlack.graphql": _lgraphqlNotificationsListallnotificationslackGraphql, + "_lgraphql/notifications/listAllNotificationWebhook.graphql": _lgraphqlNotificationsListallnotificationwebhookGraphql, + "_lgraphql/notifications/projectNotificationEmail.graphql": _lgraphqlNotificationsProjectnotificationemailGraphql, + "_lgraphql/notifications/projectNotificationMicrosoftTeams.graphql": _lgraphqlNotificationsProjectnotificationmicrosoftteamsGraphql, + "_lgraphql/notifications/projectNotificationRocketChat.graphql": _lgraphqlNotificationsProjectnotificationrocketchatGraphql, + "_lgraphql/notifications/projectNotificationSlack.graphql": _lgraphqlNotificationsProjectnotificationslackGraphql, + "_lgraphql/notifications/projectNotificationWebhook.graphql": _lgraphqlNotificationsProjectnotificationwebhookGraphql, + "_lgraphql/notifications/removeNotificationFromProject.graphql": _lgraphqlNotificationsRemovenotificationfromprojectGraphql, + "_lgraphql/notifications/updateNotificationEmail.graphql": _lgraphqlNotificationsUpdatenotificationemailGraphql, + "_lgraphql/notifications/updateNotificationMicrosoftTeams.graphql": _lgraphqlNotificationsUpdatenotificationmicrosoftteamsGraphql, + "_lgraphql/notifications/updateNotificationRocketChat.graphql": _lgraphqlNotificationsUpdatenotificationrocketchatGraphql, + "_lgraphql/notifications/updateNotificationSlack.graphql": _lgraphqlNotificationsUpdatenotificationslackGraphql, + "_lgraphql/notifications/updateNotificationWebhook.graphql": _lgraphqlNotificationsUpdatenotificationwebhookGraphql, } // AssetDir returns the file names below a certain // directory embedded in the file by go-bindata. // For example if you run go-bindata on data/... and data contains the // following hierarchy: -// -// data/ -// foo.txt -// img/ -// a.png -// b.png -// +// data/ +// foo.txt +// img/ +// a.png +// b.png // then AssetDir("data") would return []string{"foo.txt", "img"} // AssetDir("data/img") would return []string{"a.png", "b.png"} -// AssetDir("foo.txt") and AssetDir("nonexistent") would return an error +// AssetDir("foo.txt") and AssetDir("notexist") would return an error // AssetDir("") will return []string{"data"}. func AssetDir(name string) ([]string, error) { node := _bintree if len(name) != 0 { - canonicalName := strings.Replace(name, "\\", "/", -1) - pathList := strings.Split(canonicalName, "/") + cannonicalName := strings.Replace(name, "\\", "/", -1) + pathList := strings.Split(cannonicalName, "/") for _, p := range pathList { node = node.Children[p] if node == nil { @@ -1104,11 +1585,6 @@ var _bintree = &bintree{nil, map[string]*bintree{ "addEnvVariable.graphql": &bintree{_lgraphqlAddenvvariableGraphql, map[string]*bintree{}}, "addGroup.graphql": &bintree{_lgraphqlAddgroupGraphql, map[string]*bintree{}}, "addGroupsToProject.graphql": &bintree{_lgraphqlAddgroupstoprojectGraphql, map[string]*bintree{}}, - "addNotificationEmail.graphql": &bintree{_lgraphqlAddnotificationemailGraphql, map[string]*bintree{}}, - "addNotificationMicrosoftTeams.graphql": &bintree{_lgraphqlAddnotificationmicrosoftteamsGraphql, map[string]*bintree{}}, - "addNotificationRocketChat.graphql": &bintree{_lgraphqlAddnotificationrocketchatGraphql, map[string]*bintree{}}, - "addNotificationSlack.graphql": &bintree{_lgraphqlAddnotificationslackGraphql, map[string]*bintree{}}, - "addNotificationToProject.graphql": &bintree{_lgraphqlAddnotificationtoprojectGraphql, map[string]*bintree{}}, "addOrUpdateEnvironment.graphql": &bintree{_lgraphqlAddorupdateenvironmentGraphql, map[string]*bintree{}}, "addProject.graphql": &bintree{_lgraphqlAddprojectGraphql, map[string]*bintree{}}, "addRestore.graphql": &bintree{_lgraphqlAddrestoreGraphql, map[string]*bintree{}}, @@ -1129,15 +1605,44 @@ var _bintree = &bintree{nil, map[string]*bintree{ "listDeployTargets.graphql": &bintree{_lgraphqlListdeploytargetsGraphql, map[string]*bintree{}}, "me.graphql": &bintree{_lgraphqlMeGraphql, map[string]*bintree{}}, "minimalProjectByName.graphql": &bintree{_lgraphqlMinimalprojectbynameGraphql, map[string]*bintree{}}, - "projectByName.graphql": &bintree{_lgraphqlProjectbynameGraphql, map[string]*bintree{}}, - "projectByNameMetadata.graphql": &bintree{_lgraphqlProjectbynamemetadataGraphql, map[string]*bintree{}}, - "projectsByMetadata.graphql": &bintree{_lgraphqlProjectsbymetadataGraphql, map[string]*bintree{}}, - "removeProjectMetadataByKey.graphql": &bintree{_lgraphqlRemoveprojectmetadatabykeyGraphql, map[string]*bintree{}}, - "switchActiveStandby.graphql": &bintree{_lgraphqlSwitchactivestandbyGraphql, map[string]*bintree{}}, - "taskByID.graphql": &bintree{_lgraphqlTaskbyidGraphql, map[string]*bintree{}}, - "updateDeployTarget.graphql": &bintree{_lgraphqlUpdatedeploytargetGraphql, map[string]*bintree{}}, - "updateDeployTargetConfig.graphql": &bintree{_lgraphqlUpdatedeploytargetconfigGraphql, map[string]*bintree{}}, - "updateProjectMetadata.graphql": &bintree{_lgraphqlUpdateprojectmetadataGraphql, map[string]*bintree{}}, + "notifications": &bintree{nil, map[string]*bintree{ + "addNotificationEmail.graphql": &bintree{_lgraphqlNotificationsAddnotificationemailGraphql, map[string]*bintree{}}, + "addNotificationMicrosoftTeams.graphql": &bintree{_lgraphqlNotificationsAddnotificationmicrosoftteamsGraphql, map[string]*bintree{}}, + "addNotificationRocketChat.graphql": &bintree{_lgraphqlNotificationsAddnotificationrocketchatGraphql, map[string]*bintree{}}, + "addNotificationSlack.graphql": &bintree{_lgraphqlNotificationsAddnotificationslackGraphql, map[string]*bintree{}}, + "addNotificationToProject.graphql": &bintree{_lgraphqlNotificationsAddnotificationtoprojectGraphql, map[string]*bintree{}}, + "addNotificationWebhook.graphql": &bintree{_lgraphqlNotificationsAddnotificationwebhookGraphql, map[string]*bintree{}}, + "deleteNotificationEmail.graphql": &bintree{_lgraphqlNotificationsDeletenotificationemailGraphql, map[string]*bintree{}}, + "deleteNotificationMicrosoftTeams.graphql": &bintree{_lgraphqlNotificationsDeletenotificationmicrosoftteamsGraphql, map[string]*bintree{}}, + "deleteNotificationRocketChat.graphql": &bintree{_lgraphqlNotificationsDeletenotificationrocketchatGraphql, map[string]*bintree{}}, + "deleteNotificationSlack.graphql": &bintree{_lgraphqlNotificationsDeletenotificationslackGraphql, map[string]*bintree{}}, + "deleteNotificationWebhook.graphql": &bintree{_lgraphqlNotificationsDeletenotificationwebhookGraphql, map[string]*bintree{}}, + "listAllNotificationEmail.graphql": &bintree{_lgraphqlNotificationsListallnotificationemailGraphql, map[string]*bintree{}}, + "listAllNotificationMicrosoftTeams.graphql": &bintree{_lgraphqlNotificationsListallnotificationmicrosoftteamsGraphql, map[string]*bintree{}}, + "listAllNotificationRocketChat.graphql": &bintree{_lgraphqlNotificationsListallnotificationrocketchatGraphql, map[string]*bintree{}}, + "listAllNotificationSlack.graphql": &bintree{_lgraphqlNotificationsListallnotificationslackGraphql, map[string]*bintree{}}, + "listAllNotificationWebhook.graphql": &bintree{_lgraphqlNotificationsListallnotificationwebhookGraphql, map[string]*bintree{}}, + "projectNotificationEmail.graphql": &bintree{_lgraphqlNotificationsProjectnotificationemailGraphql, map[string]*bintree{}}, + "projectNotificationMicrosoftTeams.graphql": &bintree{_lgraphqlNotificationsProjectnotificationmicrosoftteamsGraphql, map[string]*bintree{}}, + "projectNotificationRocketChat.graphql": &bintree{_lgraphqlNotificationsProjectnotificationrocketchatGraphql, map[string]*bintree{}}, + "projectNotificationSlack.graphql": &bintree{_lgraphqlNotificationsProjectnotificationslackGraphql, map[string]*bintree{}}, + "projectNotificationWebhook.graphql": &bintree{_lgraphqlNotificationsProjectnotificationwebhookGraphql, map[string]*bintree{}}, + "removeNotificationFromProject.graphql": &bintree{_lgraphqlNotificationsRemovenotificationfromprojectGraphql, map[string]*bintree{}}, + "updateNotificationEmail.graphql": &bintree{_lgraphqlNotificationsUpdatenotificationemailGraphql, map[string]*bintree{}}, + "updateNotificationMicrosoftTeams.graphql": &bintree{_lgraphqlNotificationsUpdatenotificationmicrosoftteamsGraphql, map[string]*bintree{}}, + "updateNotificationRocketChat.graphql": &bintree{_lgraphqlNotificationsUpdatenotificationrocketchatGraphql, map[string]*bintree{}}, + "updateNotificationSlack.graphql": &bintree{_lgraphqlNotificationsUpdatenotificationslackGraphql, map[string]*bintree{}}, + "updateNotificationWebhook.graphql": &bintree{_lgraphqlNotificationsUpdatenotificationwebhookGraphql, map[string]*bintree{}}, + }}, + "projectByName.graphql": &bintree{_lgraphqlProjectbynameGraphql, map[string]*bintree{}}, + "projectByNameMetadata.graphql": &bintree{_lgraphqlProjectbynamemetadataGraphql, map[string]*bintree{}}, + "projectsByMetadata.graphql": &bintree{_lgraphqlProjectsbymetadataGraphql, map[string]*bintree{}}, + "removeProjectMetadataByKey.graphql": &bintree{_lgraphqlRemoveprojectmetadatabykeyGraphql, map[string]*bintree{}}, + "switchActiveStandby.graphql": &bintree{_lgraphqlSwitchactivestandbyGraphql, map[string]*bintree{}}, + "taskByID.graphql": &bintree{_lgraphqlTaskbyidGraphql, map[string]*bintree{}}, + "updateDeployTarget.graphql": &bintree{_lgraphqlUpdatedeploytargetGraphql, map[string]*bintree{}}, + "updateDeployTargetConfig.graphql": &bintree{_lgraphqlUpdatedeploytargetconfigGraphql, map[string]*bintree{}}, + "updateProjectMetadata.graphql": &bintree{_lgraphqlUpdateprojectmetadataGraphql, map[string]*bintree{}}, "variables": &bintree{nil, map[string]*bintree{ "addOrUpdateEnvVariableByName.graphql": &bintree{_lgraphqlVariablesAddorupdateenvvariablebynameGraphql, map[string]*bintree{}}, "deleteEnvVariableByName.graphql": &bintree{_lgraphqlVariablesDeleteenvvariablebynameGraphql, map[string]*bintree{}}, @@ -1189,6 +1694,6 @@ func RestoreAssets(dir, name string) error { } func _filePath(dir, name string) string { - canonicalName := strings.Replace(name, "\\", "/", -1) - return filepath.Join(append([]string{dir}, strings.Split(canonicalName, "/")...)...) + cannonicalName := strings.Replace(name, "\\", "/", -1) + return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) } diff --git a/internal/lagoon/client/mutation.go b/internal/lagoon/client/mutation.go index 28616be6..1dba8f61 100644 --- a/internal/lagoon/client/mutation.go +++ b/internal/lagoon/client/mutation.go @@ -112,65 +112,6 @@ func (c *Client) AddUserToGroup( }) } -// AddNotificationSlack defines a Slack notification. -func (c *Client) AddNotificationSlack(ctx context.Context, - in *schema.AddNotificationSlackInput, out *schema.NotificationSlack) error { - req, err := c.newRequest("_lgraphql/addNotificationSlack.graphql", in) - if err != nil { - return err - } - return c.client.Run(ctx, req, &struct { - Response *schema.NotificationSlack `json:"addNotificationSlack"` - }{ - Response: out, - }) -} - -// AddNotificationRocketChat defines a RocketChat notification. -func (c *Client) AddNotificationRocketChat(ctx context.Context, - in *schema.AddNotificationRocketChatInput, - out *schema.NotificationRocketChat) error { - req, err := c.newRequest("_lgraphql/addNotificationRocketChat.graphql", in) - if err != nil { - return err - } - return c.client.Run(ctx, req, &struct { - Response *schema.NotificationRocketChat `json:"addNotificationRocketChat"` - }{ - Response: out, - }) -} - -// AddNotificationEmail defines an Email notification. -func (c *Client) AddNotificationEmail(ctx context.Context, - in *schema.AddNotificationEmailInput, - out *schema.NotificationEmail) error { - req, err := c.newRequest("_lgraphql/addNotificationEmail.graphql", in) - if err != nil { - return err - } - return c.client.Run(ctx, req, &struct { - Response *schema.NotificationEmail `json:"addNotificationEmail"` - }{ - Response: out, - }) -} - -// AddNotificationMicrosoftTeams defines a MicrosoftTeams notification. -func (c *Client) AddNotificationMicrosoftTeams(ctx context.Context, - in *schema.AddNotificationMicrosoftTeamsInput, - out *schema.NotificationMicrosoftTeams) error { - req, err := c.newRequest("_lgraphql/addNotificationMicrosoftTeams.graphql", in) - if err != nil { - return err - } - return c.client.Run(ctx, req, &struct { - Response *schema.NotificationMicrosoftTeams `json:"addNotificationMicrosoftTeams"` - }{ - Response: out, - }) -} - // AddProject adds a project. func (c *Client) AddProject( ctx context.Context, in *schema.AddProjectInput, out *schema.Project) error { @@ -227,20 +168,6 @@ func (c *Client) AddGroupsToProject(ctx context.Context, }) } -// AddNotificationToProject adds a Notification to a Project. -func (c *Client) AddNotificationToProject(ctx context.Context, - in *schema.AddNotificationToProjectInput, out *schema.Project) error { - req, err := c.newRequest("_lgraphql/addNotificationToProject.graphql", in) - if err != nil { - return err - } - return c.client.Run(ctx, req, &struct { - Response *schema.Project `json:"addNotificationToProject"` - }{ - Response: out, - }) -} - // DeployEnvironmentLatest deploys a latest environment. func (c *Client) DeployEnvironmentLatest(ctx context.Context, in *schema.DeployEnvironmentLatestInput, out *schema.DeployEnvironmentLatest) error { diff --git a/internal/lagoon/client/notification.go b/internal/lagoon/client/notification.go new file mode 100644 index 00000000..51510632 --- /dev/null +++ b/internal/lagoon/client/notification.go @@ -0,0 +1,449 @@ +package client + +import ( + "context" + + "github.com/uselagoon/lagoon-cli/internal/schema" +) + +// AddNotificationSlack defines a Slack notification. +func (c *Client) AddNotificationSlack(ctx context.Context, + in *schema.AddNotificationSlackInput, out *schema.NotificationSlack) error { + req, err := c.newRequest("_lgraphql/notifications/addNotificationSlack.graphql", in) + if err != nil { + return err + } + return c.client.Run(ctx, req, &struct { + Response *schema.NotificationSlack `json:"addNotificationSlack"` + }{ + Response: out, + }) +} + +// AddNotificationRocketChat defines a RocketChat notification. +func (c *Client) AddNotificationRocketChat(ctx context.Context, + in *schema.AddNotificationRocketChatInput, + out *schema.NotificationRocketChat) error { + req, err := c.newRequest("_lgraphql/notifications/addNotificationRocketChat.graphql", in) + if err != nil { + return err + } + return c.client.Run(ctx, req, &struct { + Response *schema.NotificationRocketChat `json:"addNotificationRocketChat"` + }{ + Response: out, + }) +} + +// AddNotificationEmail defines an Email notification. +func (c *Client) AddNotificationEmail(ctx context.Context, + in *schema.AddNotificationEmailInput, + out *schema.NotificationEmail) error { + req, err := c.newRequest("_lgraphql/notifications/addNotificationEmail.graphql", in) + if err != nil { + return err + } + return c.client.Run(ctx, req, &struct { + Response *schema.NotificationEmail `json:"addNotificationEmail"` + }{ + Response: out, + }) +} + +// AddNotificationMicrosoftTeams defines a MicrosoftTeams notification. +func (c *Client) AddNotificationMicrosoftTeams(ctx context.Context, + in *schema.AddNotificationMicrosoftTeamsInput, + out *schema.NotificationMicrosoftTeams) error { + req, err := c.newRequest("_lgraphql/notifications/addNotificationMicrosoftTeams.graphql", in) + if err != nil { + return err + } + return c.client.Run(ctx, req, &struct { + Response *schema.NotificationMicrosoftTeams `json:"addNotificationMicrosoftTeams"` + }{ + Response: out, + }) +} + +// AddNotificationWebhook defines a Webhook notification. +func (c *Client) AddNotificationWebhook(ctx context.Context, + in *schema.AddNotificationWebhookInput, + out *schema.NotificationWebhook) error { + req, err := c.newRequest("_lgraphql/notifications/addNotificationWebhook.graphql", in) + if err != nil { + return err + } + return c.client.Run(ctx, req, &struct { + Response *schema.NotificationWebhook `json:"addNotificationWebhook"` + }{ + Response: out, + }) +} + +// UpdateNotificationEmail updates an email notification. +func (c *Client) UpdateNotificationEmail( + ctx context.Context, input *schema.UpdateNotificationEmailInput, out *schema.NotificationEmail) error { + + req, err := c.newVersionedRequest("_lgraphql/notifications/updateNotificationEmail.graphql", + map[string]interface{}{ + "name": input.Name, + "patch": input.Patch, + }) + if err != nil { + return err + } + + return c.client.Run(ctx, req, &struct { + Response *schema.NotificationEmail `json:"updateNotificationEmail"` + }{ + Response: out, + }) +} + +// UpdateNotificationSlack updates a slack notification. +func (c *Client) UpdateNotificationSlack( + ctx context.Context, input *schema.UpdateNotificationSlackInput, out *schema.NotificationSlack) error { + + req, err := c.newVersionedRequest("_lgraphql/notifications/updateNotificationSlack.graphql", + map[string]interface{}{ + "name": input.Name, + "patch": input.Patch, + }) + if err != nil { + return err + } + + return c.client.Run(ctx, req, &struct { + Response *schema.NotificationSlack `json:"updateNotificationSlack"` + }{ + Response: out, + }) +} + +// UpdateNotificationRocketChat updates a rocket chat notification. +func (c *Client) UpdateNotificationRocketChat( + ctx context.Context, input *schema.UpdateNotificationRocketChatInput, out *schema.NotificationRocketChat) error { + + req, err := c.newVersionedRequest("_lgraphql/notifications/updateNotificationRocketChat.graphql", + map[string]interface{}{ + "name": input.Name, + "patch": input.Patch, + }) + if err != nil { + return err + } + + return c.client.Run(ctx, req, &struct { + Response *schema.NotificationRocketChat `json:"updateNotificationRocketChat"` + }{ + Response: out, + }) +} + +// UpdateNotificationMicrosoftTeams updates a microsoft teams notification. +func (c *Client) UpdateNotificationMicrosoftTeams( + ctx context.Context, input *schema.UpdateNotificationMicrosoftTeamsInput, out *schema.NotificationMicrosoftTeams) error { + + req, err := c.newVersionedRequest("_lgraphql/notifications/updateNotificationMicrosoftTeams.graphql", + map[string]interface{}{ + "name": input.Name, + "patch": input.Patch, + }) + if err != nil { + return err + } + + return c.client.Run(ctx, req, &struct { + Response *schema.NotificationMicrosoftTeams `json:"updateNotificationMicrosoftTeams"` + }{ + Response: out, + }) +} + +// UpdateNotificationWebhook updates a webhook notification. +func (c *Client) UpdateNotificationWebhook( + ctx context.Context, input *schema.UpdateNotificationWebhookInput, out *schema.NotificationWebhook) error { + + req, err := c.newVersionedRequest("_lgraphql/notifications/updateNotificationWebhook.graphql", + map[string]interface{}{ + "name": input.Name, + "patch": input.Patch, + }) + if err != nil { + return err + } + + return c.client.Run(ctx, req, &struct { + Response *schema.NotificationWebhook `json:"updateNotificationWebhook"` + }{ + Response: out, + }) +} + +// DeleteNotificationSlack deletes a Slack notification. +func (c *Client) DeleteNotificationSlack(ctx context.Context, + name string, + out *schema.DeleteNotification) error { + req, err := c.newRequest("_lgraphql/notifications/deleteNotificationSlack.graphql", map[string]interface{}{ + "name": name, + }) + if err != nil { + return err + } + return c.client.Run(ctx, req, &out) +} + +// DeleteNotificationRocketChat deletes a RocketChat notification. +func (c *Client) DeleteNotificationRocketChat(ctx context.Context, + name string, + out *schema.DeleteNotification) error { + req, err := c.newRequest("_lgraphql/notifications/deleteNotificationRocketChat.graphql", map[string]interface{}{ + "name": name, + }) + if err != nil { + return err + } + return c.client.Run(ctx, req, &out) +} + +// DeleteNotificationEmail deletes an Email notification. +func (c *Client) DeleteNotificationEmail(ctx context.Context, + name string, + out *schema.DeleteNotification) error { + req, err := c.newRequest("_lgraphql/notifications/deleteNotificationEmail.graphql", map[string]interface{}{ + "name": name, + }) + if err != nil { + return err + } + return c.client.Run(ctx, req, &out) +} + +// DeleteNotificationMicrosoftTeams deletes a MicrosoftTeams notification. +func (c *Client) DeleteNotificationMicrosoftTeams(ctx context.Context, + name string, + out *schema.DeleteNotification) error { + req, err := c.newRequest("_lgraphql/notifications/deleteNotificationMicrosoftTeams.graphql", map[string]interface{}{ + "name": name, + }) + if err != nil { + return err + } + return c.client.Run(ctx, req, &out) +} + +// DeleteNotificationWebhook deletes a Webhook notification. +func (c *Client) DeleteNotificationWebhook(ctx context.Context, + name string, + out *schema.DeleteNotification) error { + req, err := c.newRequest("_lgraphql/notifications/deleteNotificationWebhook.graphql", map[string]interface{}{ + "name": name, + }) + if err != nil { + return err + } + return c.client.Run(ctx, req, &out) +} + +// AddNotificationToProject adds a Notification to a Project. +func (c *Client) AddNotificationToProject(ctx context.Context, + in *schema.AddNotificationToProjectInput, out *schema.Project) error { + req, err := c.newRequest("_lgraphql/notifications/addNotificationToProject.graphql", in) + if err != nil { + return err + } + return c.client.Run(ctx, req, &struct { + Response *schema.Project `json:"addNotificationToProject"` + }{ + Response: out, + }) +} + +// RemoveNotificationFromProject removes a Notification from a Project. +func (c *Client) RemoveNotificationFromProject(ctx context.Context, + in *schema.RemoveNotificationFromProjectInput, out *schema.Project) error { + req, err := c.newRequest("_lgraphql/notifications/removeNotificationFromProject.graphql", in) + if err != nil { + return err + } + return c.client.Run(ctx, req, &struct { + Response *schema.Project `json:"removeNotificationFromProject"` + }{ + Response: out, + }) +} + +// GetProjectNotificationEmail queries the Lagoon API for notifications of the requested type +func (c *Client) GetProjectNotificationEmail( + ctx context.Context, name string, project *schema.Project) error { + + req, err := c.newRequest("_lgraphql/notifications/projectNotificationEmail.graphql", + map[string]interface{}{ + "name": name, + }) + if err != nil { + return err + } + + return c.client.Run(ctx, req, &struct { + Response *schema.Project `json:"projectByName"` + }{ + Response: project, + }) +} + +// GetAllNotificationEmail queries the Lagoon API for notifications of the requested type +func (c *Client) GetAllNotificationEmail( + ctx context.Context, projects *[]schema.Project) error { + + req, err := c.newRequest("_lgraphql/notifications/listAllNotificationEmail.graphql", nil) + if err != nil { + return err + } + + return c.client.Run(ctx, req, &struct { + Response *[]schema.Project `json:"allProjects"` + }{ + Response: projects, + }) +} + +// GetProjectNotificationWebhook queries the Lagoon API for notifications of the requested type +func (c *Client) GetProjectNotificationWebhook( + ctx context.Context, name string, project *schema.Project) error { + + req, err := c.newRequest("_lgraphql/notifications/projectNotificationWebhook.graphql", + map[string]interface{}{ + "name": name, + }) + if err != nil { + return err + } + + return c.client.Run(ctx, req, &struct { + Response *schema.Project `json:"projectByName"` + }{ + Response: project, + }) +} + +// GetAllNotificationWebhook queries the Lagoon API for notifications of the requested type +func (c *Client) GetAllNotificationWebhook( + ctx context.Context, projects *[]schema.Project) error { + + req, err := c.newRequest("_lgraphql/notifications/listAllNotificationWebhook.graphql", nil) + if err != nil { + return err + } + + return c.client.Run(ctx, req, &struct { + Response *[]schema.Project `json:"allProjects"` + }{ + Response: projects, + }) +} + +// GetProjectNotificationSlack queries the Lagoon API for notifications of the requested type +func (c *Client) GetProjectNotificationSlack( + ctx context.Context, name string, project *schema.Project) error { + + req, err := c.newRequest("_lgraphql/notifications/projectNotificationSlack.graphql", + map[string]interface{}{ + "name": name, + }) + if err != nil { + return err + } + + return c.client.Run(ctx, req, &struct { + Response *schema.Project `json:"projectByName"` + }{ + Response: project, + }) +} + +// GetAllNotificationSlack queries the Lagoon API for notifications of the requested type +func (c *Client) GetAllNotificationSlack( + ctx context.Context, projects *[]schema.Project) error { + + req, err := c.newRequest("_lgraphql/notifications/listAllNotificationSlack.graphql", nil) + if err != nil { + return err + } + + return c.client.Run(ctx, req, &struct { + Response *[]schema.Project `json:"allProjects"` + }{ + Response: projects, + }) +} + +// GetProjectNotificationRocketChat queries the Lagoon API for notifications of the requested type +func (c *Client) GetProjectNotificationRocketChat( + ctx context.Context, name string, project *schema.Project) error { + + req, err := c.newRequest("_lgraphql/notifications/projectNotificationRocketChat.graphql", + map[string]interface{}{ + "name": name, + }) + if err != nil { + return err + } + + return c.client.Run(ctx, req, &struct { + Response *schema.Project `json:"projectByName"` + }{ + Response: project, + }) +} + +// GetAllNotificationRocketChat queries the Lagoon API for notifications of the requested type +func (c *Client) GetAllNotificationRocketChat( + ctx context.Context, projects *[]schema.Project) error { + + req, err := c.newRequest("_lgraphql/notifications/listAllNotificationRocketChat.graphql", nil) + if err != nil { + return err + } + + return c.client.Run(ctx, req, &struct { + Response *[]schema.Project `json:"allProjects"` + }{ + Response: projects, + }) +} + +// GetProjectNotificationMicrosoftTeams queries the Lagoon API for notifications of the requested type +func (c *Client) GetProjectNotificationMicrosoftTeams( + ctx context.Context, name string, project *schema.Project) error { + + req, err := c.newRequest("_lgraphql/notifications/projectNotificationMicrosoftTeams.graphql", + map[string]interface{}{ + "name": name, + }) + if err != nil { + return err + } + + return c.client.Run(ctx, req, &struct { + Response *schema.Project `json:"projectByName"` + }{ + Response: project, + }) +} + +// GetAllNotificationMicrosoftTeams queries the Lagoon API for notifications of the requested type +func (c *Client) GetAllNotificationMicrosoftTeams( + ctx context.Context, projects *[]schema.Project) error { + + req, err := c.newRequest("_lgraphql/notifications/listAllNotificationMicrosoftTeams.graphql", nil) + if err != nil { + return err + } + + return c.client.Run(ctx, req, &struct { + Response *[]schema.Project `json:"allProjects"` + }{ + Response: projects, + }) +} diff --git a/internal/lagoon/notifications.go b/internal/lagoon/notifications.go new file mode 100644 index 00000000..12e6fd7a --- /dev/null +++ b/internal/lagoon/notifications.go @@ -0,0 +1,207 @@ +// Package lagoon implements high-level functions for interacting with the +// Lagoon API. +package lagoon + +import ( + "context" + + "github.com/uselagoon/lagoon-cli/internal/schema" +) + +// Notification interface contains methods for adding notifications in Lagoon. +type Notification interface { + AddNotificationWebhook(ctx context.Context, input *schema.AddNotificationWebhookInput, result *schema.NotificationWebhook) error + AddNotificationEmail(ctx context.Context, input *schema.AddNotificationEmailInput, result *schema.NotificationEmail) error + AddNotificationRocketChat(ctx context.Context, input *schema.AddNotificationRocketChatInput, result *schema.NotificationRocketChat) error + AddNotificationMicrosoftTeams(ctx context.Context, input *schema.AddNotificationMicrosoftTeamsInput, result *schema.NotificationMicrosoftTeams) error + AddNotificationSlack(ctx context.Context, input *schema.AddNotificationSlackInput, result *schema.NotificationSlack) error + AddNotificationToProject(context.Context, *schema.AddNotificationToProjectInput, *schema.Project) error + + RemoveNotificationFromProject(context.Context, *schema.RemoveNotificationFromProjectInput, *schema.Project) error + + DeleteNotificationSlack(ctx context.Context, name string, project *schema.DeleteNotification) error + DeleteNotificationRocketChat(ctx context.Context, name string, project *schema.DeleteNotification) error + DeleteNotificationMicrosoftTeams(ctx context.Context, name string, project *schema.DeleteNotification) error + DeleteNotificationEmail(ctx context.Context, name string, project *schema.DeleteNotification) error + DeleteNotificationWebhook(ctx context.Context, name string, project *schema.DeleteNotification) error + + UpdateNotificationWebhook(ctx context.Context, input *schema.UpdateNotificationWebhookInput, result *schema.NotificationWebhook) error + UpdateNotificationEmail(ctx context.Context, input *schema.UpdateNotificationEmailInput, result *schema.NotificationEmail) error + UpdateNotificationRocketChat(ctx context.Context, input *schema.UpdateNotificationRocketChatInput, result *schema.NotificationRocketChat) error + UpdateNotificationMicrosoftTeams(ctx context.Context, input *schema.UpdateNotificationMicrosoftTeamsInput, result *schema.NotificationMicrosoftTeams) error + UpdateNotificationSlack(ctx context.Context, input *schema.UpdateNotificationSlackInput, result *schema.NotificationSlack) error + + GetAllNotificationEmail(ctx context.Context, project *[]schema.Project) error + GetAllNotificationWebhook(ctx context.Context, project *[]schema.Project) error + GetAllNotificationMicrosoftTeams(ctx context.Context, project *[]schema.Project) error + GetAllNotificationSlack(ctx context.Context, project *[]schema.Project) error + GetAllNotificationRocketChat(ctx context.Context, project *[]schema.Project) error + + GetProjectNotificationSlack(ctx context.Context, name string, project *schema.Project) error + GetProjectNotificationRocketChat(ctx context.Context, name string, project *schema.Project) error + GetProjectNotificationMicrosoftTeams(ctx context.Context, name string, project *schema.Project) error + GetProjectNotificationEmail(ctx context.Context, name string, project *schema.Project) error + GetProjectNotificationWebhook(ctx context.Context, name string, project *schema.Project) error +} + +// AddNotificationWebhook adds a notification. +func AddNotificationWebhook(ctx context.Context, input *schema.AddNotificationWebhookInput, n Notification) (*schema.NotificationWebhook, error) { + result := schema.NotificationWebhook{} + return &result, n.AddNotificationWebhook(ctx, input, &result) +} + +// AddNotificationEmail adds a notification. +func AddNotificationEmail(ctx context.Context, input *schema.AddNotificationEmailInput, n Notification) (*schema.NotificationEmail, error) { + result := schema.NotificationEmail{} + return &result, n.AddNotificationEmail(ctx, input, &result) +} + +// AddNotificationRocketChat adds a notification. +func AddNotificationRocketChat(ctx context.Context, input *schema.AddNotificationRocketChatInput, n Notification) (*schema.NotificationRocketChat, error) { + result := schema.NotificationRocketChat{} + return &result, n.AddNotificationRocketChat(ctx, input, &result) +} + +// AddNotificationMicrosoftTeams adds a notification. +func AddNotificationMicrosoftTeams(ctx context.Context, input *schema.AddNotificationMicrosoftTeamsInput, n Notification) (*schema.NotificationMicrosoftTeams, error) { + result := schema.NotificationMicrosoftTeams{} + return &result, n.AddNotificationMicrosoftTeams(ctx, input, &result) +} + +// AddNotificationSlack adds a notification. +func AddNotificationSlack(ctx context.Context, input *schema.AddNotificationSlackInput, n Notification) (*schema.NotificationSlack, error) { + result := schema.NotificationSlack{} + return &result, n.AddNotificationSlack(ctx, input, &result) +} + +// AddNotificationToProject adds a notification to project. +func AddNotificationToProject(ctx context.Context, input *schema.AddNotificationToProjectInput, n Notification) (*schema.Project, error) { + result := schema.Project{} + return &result, n.AddNotificationToProject(ctx, input, &result) +} + +// RemoveNotificationFromProject removes a notification from a project. +func RemoveNotificationFromProject(ctx context.Context, input *schema.RemoveNotificationFromProjectInput, n Notification) (*schema.Project, error) { + result := schema.Project{} + return &result, n.RemoveNotificationFromProject(ctx, input, &result) +} + +// UpdateNotificationWebhook updates a notification. +func UpdateNotificationWebhook(ctx context.Context, input *schema.UpdateNotificationWebhookInput, n Notification) (*schema.NotificationWebhook, error) { + result := schema.NotificationWebhook{} + return &result, n.UpdateNotificationWebhook(ctx, input, &result) +} + +// UpdateNotificationEmail updates a notification. +func UpdateNotificationEmail(ctx context.Context, input *schema.UpdateNotificationEmailInput, n Notification) (*schema.NotificationEmail, error) { + result := schema.NotificationEmail{} + return &result, n.UpdateNotificationEmail(ctx, input, &result) +} + +// UpdateNotificationRocketChat updates a notification. +func UpdateNotificationRocketChat(ctx context.Context, input *schema.UpdateNotificationRocketChatInput, n Notification) (*schema.NotificationRocketChat, error) { + result := schema.NotificationRocketChat{} + return &result, n.UpdateNotificationRocketChat(ctx, input, &result) +} + +// UpdateNotificationMicrosoftTeams updates a notification. +func UpdateNotificationMicrosoftTeams(ctx context.Context, input *schema.UpdateNotificationMicrosoftTeamsInput, n Notification) (*schema.NotificationMicrosoftTeams, error) { + result := schema.NotificationMicrosoftTeams{} + return &result, n.UpdateNotificationMicrosoftTeams(ctx, input, &result) +} + +// UpdateNotificationSlack updates a notification. +func UpdateNotificationSlack(ctx context.Context, input *schema.UpdateNotificationSlackInput, n Notification) (*schema.NotificationSlack, error) { + result := schema.NotificationSlack{} + return &result, n.UpdateNotificationSlack(ctx, input, &result) +} + +// GetAllNotificationEmail gets all notifications of type. +func GetAllNotificationEmail(ctx context.Context, n Notification) (*[]schema.Project, error) { + result := []schema.Project{} + return &result, n.GetAllNotificationEmail(ctx, &result) +} + +// GetAllNotificationWebhook gets all notifications of type. +func GetAllNotificationWebhook(ctx context.Context, n Notification) (*[]schema.Project, error) { + result := []schema.Project{} + return &result, n.GetAllNotificationWebhook(ctx, &result) +} + +// GetAllNotificationSlack gets all notifications of type. +func GetAllNotificationSlack(ctx context.Context, n Notification) (*[]schema.Project, error) { + result := []schema.Project{} + return &result, n.GetAllNotificationSlack(ctx, &result) +} + +// GetAllNotificationRocketChat gets all notifications of type. +func GetAllNotificationRocketChat(ctx context.Context, n Notification) (*[]schema.Project, error) { + result := []schema.Project{} + return &result, n.GetAllNotificationRocketChat(ctx, &result) +} + +// GetAllNotificationMicrosoftTeams gets all notifications of type. +func GetAllNotificationMicrosoftTeams(ctx context.Context, n Notification) (*[]schema.Project, error) { + result := []schema.Project{} + return &result, n.GetAllNotificationMicrosoftTeams(ctx, &result) +} + +// GetProjectNotificationEmail gets all notifications of type in project. +func GetProjectNotificationEmail(ctx context.Context, name string, n Notification) (*schema.Project, error) { + result := schema.Project{} + return &result, n.GetProjectNotificationEmail(ctx, name, &result) +} + +// GetProjectNotificationWebhook gets all notifications of type in project. +func GetProjectNotificationWebhook(ctx context.Context, name string, n Notification) (*schema.Project, error) { + result := schema.Project{} + return &result, n.GetProjectNotificationWebhook(ctx, name, &result) +} + +// GetProjectNotificationRocketChat gets all notifications of type in project. +func GetProjectNotificationRocketChat(ctx context.Context, name string, n Notification) (*schema.Project, error) { + result := schema.Project{} + return &result, n.GetProjectNotificationRocketChat(ctx, name, &result) +} + +// GetProjectNotificationSlack gets all notifications of type in project. +func GetProjectNotificationSlack(ctx context.Context, name string, n Notification) (*schema.Project, error) { + result := schema.Project{} + return &result, n.GetProjectNotificationSlack(ctx, name, &result) +} + +// GetProjectNotificationMicrosoftTeams gets all notifications of type in project. +func GetProjectNotificationMicrosoftTeams(ctx context.Context, name string, n Notification) (*schema.Project, error) { + result := schema.Project{} + return &result, n.GetProjectNotificationMicrosoftTeams(ctx, name, &result) +} + +// DeleteNotificationEmail deletes notification. +func DeleteNotificationEmail(ctx context.Context, name string, n Notification) (*schema.DeleteNotification, error) { + result := schema.DeleteNotification{} + return &result, n.DeleteNotificationEmail(ctx, name, &result) +} + +// DeleteNotificationWebhook deletes notification. +func DeleteNotificationWebhook(ctx context.Context, name string, n Notification) (*schema.DeleteNotification, error) { + result := schema.DeleteNotification{} + return &result, n.DeleteNotificationWebhook(ctx, name, &result) +} + +// DeleteNotificationRocketChat deletes notification. +func DeleteNotificationRocketChat(ctx context.Context, name string, n Notification) (*schema.DeleteNotification, error) { + result := schema.DeleteNotification{} + return &result, n.DeleteNotificationRocketChat(ctx, name, &result) +} + +// DeleteNotificationSlack deletes notification. +func DeleteNotificationSlack(ctx context.Context, name string, n Notification) (*schema.DeleteNotification, error) { + result := schema.DeleteNotification{} + return &result, n.DeleteNotificationSlack(ctx, name, &result) +} + +// DeleteNotificationMicrosoftTeams deletes notification. +func DeleteNotificationMicrosoftTeams(ctx context.Context, name string, n Notification) (*schema.DeleteNotification, error) { + result := schema.DeleteNotification{} + return &result, n.DeleteNotificationMicrosoftTeams(ctx, name, &result) +} diff --git a/internal/mock/mock_importer.go b/internal/mock/mock_importer.go index 603e530c..358b07bf 100644 --- a/internal/mock/mock_importer.go +++ b/internal/mock/mock_importer.go @@ -6,50 +6,35 @@ package mock import ( context "context" - reflect "reflect" - gomock "github.com/golang/mock/gomock" schema "github.com/uselagoon/lagoon-cli/internal/schema" + reflect "reflect" ) -// MockImporter is a mock of Importer interface. +// MockImporter is a mock of Importer interface type MockImporter struct { ctrl *gomock.Controller recorder *MockImporterMockRecorder } -// MockImporterMockRecorder is the mock recorder for MockImporter. +// MockImporterMockRecorder is the mock recorder for MockImporter type MockImporterMockRecorder struct { mock *MockImporter } -// NewMockImporter creates a new mock instance. +// NewMockImporter creates a new mock instance func NewMockImporter(ctrl *gomock.Controller) *MockImporter { mock := &MockImporter{ctrl: ctrl} mock.recorder = &MockImporterMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use. +// EXPECT returns an object that allows the caller to indicate expected use func (m *MockImporter) EXPECT() *MockImporterMockRecorder { return m.recorder } -// AddEnvVariable mocks base method. -func (m *MockImporter) AddEnvVariable(arg0 context.Context, arg1 *schema.EnvVariableInput, arg2 *schema.EnvKeyValue) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddEnvVariable", arg0, arg1, arg2) - ret0, _ := ret[0].(error) - return ret0 -} - -// AddEnvVariable indicates an expected call of AddEnvVariable. -func (mr *MockImporterMockRecorder) AddEnvVariable(arg0, arg1, arg2 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddEnvVariable", reflect.TypeOf((*MockImporter)(nil).AddEnvVariable), arg0, arg1, arg2) -} - -// AddGroup mocks base method. +// AddGroup mocks base method func (m *MockImporter) AddGroup(arg0 context.Context, arg1 *schema.AddGroupInput, arg2 *schema.Group) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "AddGroup", arg0, arg1, arg2) @@ -57,111 +42,111 @@ func (m *MockImporter) AddGroup(arg0 context.Context, arg1 *schema.AddGroupInput return ret0 } -// AddGroup indicates an expected call of AddGroup. +// AddGroup indicates an expected call of AddGroup func (mr *MockImporterMockRecorder) AddGroup(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddGroup", reflect.TypeOf((*MockImporter)(nil).AddGroup), arg0, arg1, arg2) } -// AddGroupsToProject mocks base method. -func (m *MockImporter) AddGroupsToProject(arg0 context.Context, arg1 *schema.ProjectGroupsInput, arg2 *schema.Project) error { +// AddUser mocks base method +func (m *MockImporter) AddUser(arg0 context.Context, arg1 *schema.AddUserInput, arg2 *schema.User) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddGroupsToProject", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "AddUser", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 } -// AddGroupsToProject indicates an expected call of AddGroupsToProject. -func (mr *MockImporterMockRecorder) AddGroupsToProject(arg0, arg1, arg2 interface{}) *gomock.Call { +// AddUser indicates an expected call of AddUser +func (mr *MockImporterMockRecorder) AddUser(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddGroupsToProject", reflect.TypeOf((*MockImporter)(nil).AddGroupsToProject), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddUser", reflect.TypeOf((*MockImporter)(nil).AddUser), arg0, arg1, arg2) } -// AddNotificationEmail mocks base method. -func (m *MockImporter) AddNotificationEmail(arg0 context.Context, arg1 *schema.AddNotificationEmailInput, arg2 *schema.NotificationEmail) error { +// AddSSHKey mocks base method +func (m *MockImporter) AddSSHKey(arg0 context.Context, arg1 *schema.AddSSHKeyInput, arg2 *schema.SSHKey) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddNotificationEmail", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "AddSSHKey", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 } -// AddNotificationEmail indicates an expected call of AddNotificationEmail. -func (mr *MockImporterMockRecorder) AddNotificationEmail(arg0, arg1, arg2 interface{}) *gomock.Call { +// AddSSHKey indicates an expected call of AddSSHKey +func (mr *MockImporterMockRecorder) AddSSHKey(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddNotificationEmail", reflect.TypeOf((*MockImporter)(nil).AddNotificationEmail), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddSSHKey", reflect.TypeOf((*MockImporter)(nil).AddSSHKey), arg0, arg1, arg2) } -// AddNotificationMicrosoftTeams mocks base method. -func (m *MockImporter) AddNotificationMicrosoftTeams(arg0 context.Context, arg1 *schema.AddNotificationMicrosoftTeamsInput, arg2 *schema.NotificationMicrosoftTeams) error { +// AddUserToGroup mocks base method +func (m *MockImporter) AddUserToGroup(arg0 context.Context, arg1 *schema.UserGroupRoleInput, arg2 *schema.Group) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddNotificationMicrosoftTeams", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "AddUserToGroup", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 } -// AddNotificationMicrosoftTeams indicates an expected call of AddNotificationMicrosoftTeams. -func (mr *MockImporterMockRecorder) AddNotificationMicrosoftTeams(arg0, arg1, arg2 interface{}) *gomock.Call { +// AddUserToGroup indicates an expected call of AddUserToGroup +func (mr *MockImporterMockRecorder) AddUserToGroup(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddNotificationMicrosoftTeams", reflect.TypeOf((*MockImporter)(nil).AddNotificationMicrosoftTeams), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddUserToGroup", reflect.TypeOf((*MockImporter)(nil).AddUserToGroup), arg0, arg1, arg2) } -// AddNotificationRocketChat mocks base method. -func (m *MockImporter) AddNotificationRocketChat(arg0 context.Context, arg1 *schema.AddNotificationRocketChatInput, arg2 *schema.NotificationRocketChat) error { +// AddNotificationSlack mocks base method +func (m *MockImporter) AddNotificationSlack(arg0 context.Context, arg1 *schema.AddNotificationSlackInput, arg2 *schema.NotificationSlack) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddNotificationRocketChat", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "AddNotificationSlack", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 } -// AddNotificationRocketChat indicates an expected call of AddNotificationRocketChat. -func (mr *MockImporterMockRecorder) AddNotificationRocketChat(arg0, arg1, arg2 interface{}) *gomock.Call { +// AddNotificationSlack indicates an expected call of AddNotificationSlack +func (mr *MockImporterMockRecorder) AddNotificationSlack(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddNotificationRocketChat", reflect.TypeOf((*MockImporter)(nil).AddNotificationRocketChat), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddNotificationSlack", reflect.TypeOf((*MockImporter)(nil).AddNotificationSlack), arg0, arg1, arg2) } -// AddNotificationSlack mocks base method. -func (m *MockImporter) AddNotificationSlack(arg0 context.Context, arg1 *schema.AddNotificationSlackInput, arg2 *schema.NotificationSlack) error { +// AddNotificationRocketChat mocks base method +func (m *MockImporter) AddNotificationRocketChat(arg0 context.Context, arg1 *schema.AddNotificationRocketChatInput, arg2 *schema.NotificationRocketChat) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddNotificationSlack", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "AddNotificationRocketChat", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 } -// AddNotificationSlack indicates an expected call of AddNotificationSlack. -func (mr *MockImporterMockRecorder) AddNotificationSlack(arg0, arg1, arg2 interface{}) *gomock.Call { +// AddNotificationRocketChat indicates an expected call of AddNotificationRocketChat +func (mr *MockImporterMockRecorder) AddNotificationRocketChat(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddNotificationSlack", reflect.TypeOf((*MockImporter)(nil).AddNotificationSlack), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddNotificationRocketChat", reflect.TypeOf((*MockImporter)(nil).AddNotificationRocketChat), arg0, arg1, arg2) } -// AddNotificationToProject mocks base method. -func (m *MockImporter) AddNotificationToProject(arg0 context.Context, arg1 *schema.AddNotificationToProjectInput, arg2 *schema.Project) error { +// AddNotificationEmail mocks base method +func (m *MockImporter) AddNotificationEmail(arg0 context.Context, arg1 *schema.AddNotificationEmailInput, arg2 *schema.NotificationEmail) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddNotificationToProject", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "AddNotificationEmail", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 } -// AddNotificationToProject indicates an expected call of AddNotificationToProject. -func (mr *MockImporterMockRecorder) AddNotificationToProject(arg0, arg1, arg2 interface{}) *gomock.Call { +// AddNotificationEmail indicates an expected call of AddNotificationEmail +func (mr *MockImporterMockRecorder) AddNotificationEmail(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddNotificationToProject", reflect.TypeOf((*MockImporter)(nil).AddNotificationToProject), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddNotificationEmail", reflect.TypeOf((*MockImporter)(nil).AddNotificationEmail), arg0, arg1, arg2) } -// AddOrUpdateEnvironment mocks base method. -func (m *MockImporter) AddOrUpdateEnvironment(arg0 context.Context, arg1 *schema.AddEnvironmentInput, arg2 *schema.Environment) error { +// AddNotificationMicrosoftTeams mocks base method +func (m *MockImporter) AddNotificationMicrosoftTeams(arg0 context.Context, arg1 *schema.AddNotificationMicrosoftTeamsInput, arg2 *schema.NotificationMicrosoftTeams) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddOrUpdateEnvironment", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "AddNotificationMicrosoftTeams", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 } -// AddOrUpdateEnvironment indicates an expected call of AddOrUpdateEnvironment. -func (mr *MockImporterMockRecorder) AddOrUpdateEnvironment(arg0, arg1, arg2 interface{}) *gomock.Call { +// AddNotificationMicrosoftTeams indicates an expected call of AddNotificationMicrosoftTeams +func (mr *MockImporterMockRecorder) AddNotificationMicrosoftTeams(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddOrUpdateEnvironment", reflect.TypeOf((*MockImporter)(nil).AddOrUpdateEnvironment), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddNotificationMicrosoftTeams", reflect.TypeOf((*MockImporter)(nil).AddNotificationMicrosoftTeams), arg0, arg1, arg2) } -// AddProject mocks base method. +// AddProject mocks base method func (m *MockImporter) AddProject(arg0 context.Context, arg1 *schema.AddProjectInput, arg2 *schema.Project) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "AddProject", arg0, arg1, arg2) @@ -169,55 +154,55 @@ func (m *MockImporter) AddProject(arg0 context.Context, arg1 *schema.AddProjectI return ret0 } -// AddProject indicates an expected call of AddProject. +// AddProject indicates an expected call of AddProject func (mr *MockImporterMockRecorder) AddProject(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddProject", reflect.TypeOf((*MockImporter)(nil).AddProject), arg0, arg1, arg2) } -// AddSSHKey mocks base method. -func (m *MockImporter) AddSSHKey(arg0 context.Context, arg1 *schema.AddSSHKeyInput, arg2 *schema.SSHKey) error { +// AddEnvVariable mocks base method +func (m *MockImporter) AddEnvVariable(arg0 context.Context, arg1 *schema.EnvVariableInput, arg2 *schema.EnvKeyValue) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddSSHKey", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "AddEnvVariable", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 } -// AddSSHKey indicates an expected call of AddSSHKey. -func (mr *MockImporterMockRecorder) AddSSHKey(arg0, arg1, arg2 interface{}) *gomock.Call { +// AddEnvVariable indicates an expected call of AddEnvVariable +func (mr *MockImporterMockRecorder) AddEnvVariable(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddSSHKey", reflect.TypeOf((*MockImporter)(nil).AddSSHKey), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddEnvVariable", reflect.TypeOf((*MockImporter)(nil).AddEnvVariable), arg0, arg1, arg2) } -// AddUser mocks base method. -func (m *MockImporter) AddUser(arg0 context.Context, arg1 *schema.AddUserInput, arg2 *schema.User) error { +// ProjectByName mocks base method +func (m *MockImporter) ProjectByName(arg0 context.Context, arg1 string, arg2 *schema.Project) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddUser", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "ProjectByName", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 } -// AddUser indicates an expected call of AddUser. -func (mr *MockImporterMockRecorder) AddUser(arg0, arg1, arg2 interface{}) *gomock.Call { +// ProjectByName indicates an expected call of ProjectByName +func (mr *MockImporterMockRecorder) ProjectByName(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddUser", reflect.TypeOf((*MockImporter)(nil).AddUser), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProjectByName", reflect.TypeOf((*MockImporter)(nil).ProjectByName), arg0, arg1, arg2) } -// AddUserToGroup mocks base method. -func (m *MockImporter) AddUserToGroup(arg0 context.Context, arg1 *schema.UserGroupRoleInput, arg2 *schema.Group) error { +// AddOrUpdateEnvironment mocks base method +func (m *MockImporter) AddOrUpdateEnvironment(arg0 context.Context, arg1 *schema.AddEnvironmentInput, arg2 *schema.Environment) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddUserToGroup", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "AddOrUpdateEnvironment", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 } -// AddUserToGroup indicates an expected call of AddUserToGroup. -func (mr *MockImporterMockRecorder) AddUserToGroup(arg0, arg1, arg2 interface{}) *gomock.Call { +// AddOrUpdateEnvironment indicates an expected call of AddOrUpdateEnvironment +func (mr *MockImporterMockRecorder) AddOrUpdateEnvironment(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddUserToGroup", reflect.TypeOf((*MockImporter)(nil).AddUserToGroup), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddOrUpdateEnvironment", reflect.TypeOf((*MockImporter)(nil).AddOrUpdateEnvironment), arg0, arg1, arg2) } -// EnvironmentByName mocks base method. +// EnvironmentByName mocks base method func (m *MockImporter) EnvironmentByName(arg0 context.Context, arg1 string, arg2 uint, arg3 *schema.Environment) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "EnvironmentByName", arg0, arg1, arg2, arg3) @@ -225,22 +210,36 @@ func (m *MockImporter) EnvironmentByName(arg0 context.Context, arg1 string, arg2 return ret0 } -// EnvironmentByName indicates an expected call of EnvironmentByName. +// EnvironmentByName indicates an expected call of EnvironmentByName func (mr *MockImporterMockRecorder) EnvironmentByName(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EnvironmentByName", reflect.TypeOf((*MockImporter)(nil).EnvironmentByName), arg0, arg1, arg2, arg3) } -// ProjectByName mocks base method. -func (m *MockImporter) ProjectByName(arg0 context.Context, arg1 string, arg2 *schema.Project) error { +// AddGroupsToProject mocks base method +func (m *MockImporter) AddGroupsToProject(arg0 context.Context, arg1 *schema.ProjectGroupsInput, arg2 *schema.Project) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ProjectByName", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "AddGroupsToProject", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 } -// ProjectByName indicates an expected call of ProjectByName. -func (mr *MockImporterMockRecorder) ProjectByName(arg0, arg1, arg2 interface{}) *gomock.Call { +// AddGroupsToProject indicates an expected call of AddGroupsToProject +func (mr *MockImporterMockRecorder) AddGroupsToProject(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProjectByName", reflect.TypeOf((*MockImporter)(nil).ProjectByName), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddGroupsToProject", reflect.TypeOf((*MockImporter)(nil).AddGroupsToProject), arg0, arg1, arg2) +} + +// AddNotificationToProject mocks base method +func (m *MockImporter) AddNotificationToProject(arg0 context.Context, arg1 *schema.AddNotificationToProjectInput, arg2 *schema.Project) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AddNotificationToProject", arg0, arg1, arg2) + ret0, _ := ret[0].(error) + return ret0 +} + +// AddNotificationToProject indicates an expected call of AddNotificationToProject +func (mr *MockImporterMockRecorder) AddNotificationToProject(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddNotificationToProject", reflect.TypeOf((*MockImporter)(nil).AddNotificationToProject), arg0, arg1, arg2) } diff --git a/internal/mock/mock_me.go b/internal/mock/mock_me.go index 9d5479cf..2e09baa8 100644 --- a/internal/mock/mock_me.go +++ b/internal/mock/mock_me.go @@ -6,36 +6,35 @@ package mock import ( context "context" - reflect "reflect" - gomock "github.com/golang/mock/gomock" schema "github.com/uselagoon/lagoon-cli/internal/schema" + reflect "reflect" ) -// MockMe is a mock of Me interface. +// MockMe is a mock of Me interface type MockMe struct { ctrl *gomock.Controller recorder *MockMeMockRecorder } -// MockMeMockRecorder is the mock recorder for MockMe. +// MockMeMockRecorder is the mock recorder for MockMe type MockMeMockRecorder struct { mock *MockMe } -// NewMockMe creates a new mock instance. +// NewMockMe creates a new mock instance func NewMockMe(ctrl *gomock.Controller) *MockMe { mock := &MockMe{ctrl: ctrl} mock.recorder = &MockMeMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use. +// EXPECT returns an object that allows the caller to indicate expected use func (m *MockMe) EXPECT() *MockMeMockRecorder { return m.recorder } -// Me mocks base method. +// Me mocks base method func (m *MockMe) Me(ctx context.Context, user *schema.User) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Me", ctx, user) @@ -43,7 +42,7 @@ func (m *MockMe) Me(ctx context.Context, user *schema.User) error { return ret0 } -// Me indicates an expected call of Me. +// Me indicates an expected call of Me func (mr *MockMeMockRecorder) Me(ctx, user interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Me", reflect.TypeOf((*MockMe)(nil).Me), ctx, user) diff --git a/internal/schema/notification.go b/internal/schema/notification.go index 20bb4655..9fdaa80d 100644 --- a/internal/schema/notification.go +++ b/internal/schema/notification.go @@ -7,9 +7,15 @@ import ( // AddNotificationRocketChatInput is based on the Lagoon API type. type AddNotificationRocketChatInput struct { - Name string `json:"name"` - Webhook string `json:"webhook"` - Channel string `json:"channel"` + Name string `json:"name,omitempty"` + Webhook string `json:"webhook,omitempty"` + Channel string `json:"channel,omitempty"` +} + +// UpdateNotificationRocketChatPatchInput is based on the Lagoon API type. +type UpdateNotificationRocketChatInput struct { + Name string `json:"name"` + Patch AddNotificationRocketChatInput `json:"patch"` } // NotificationRocketChat is based on the Lagoon API type. @@ -20,9 +26,15 @@ type NotificationRocketChat struct { // AddNotificationSlackInput is based on the Lagoon API type. type AddNotificationSlackInput struct { - Name string `json:"name"` - Webhook string `json:"webhook"` - Channel string `json:"channel"` + Name string `json:"name,omitempty"` + Webhook string `json:"webhook,omitempty"` + Channel string `json:"channel,omitempty"` +} + +// UpdateNotificationSlackPatchInput is based on the Lagoon API type. +type UpdateNotificationSlackInput struct { + Name string `json:"name"` + Patch AddNotificationSlackInput `json:"patch"` } // NotificationSlack is based on the Lagoon API type. @@ -33,8 +45,14 @@ type NotificationSlack struct { // AddNotificationEmailInput is based on the Lagoon API type. type AddNotificationEmailInput struct { - Name string `json:"name"` - EmailAddress string `json:"emailAddress"` + Name string `json:"name,omitempty"` + EmailAddress string `json:"emailAddress,omitempty"` +} + +// UpdateNotificationEmailPatchInput is based on the Lagoon API type. +type UpdateNotificationEmailInput struct { + Name string `json:"name"` + Patch AddNotificationEmailInput `json:"patch"` } // NotificationEmail is based on the Lagoon API type. @@ -45,8 +63,14 @@ type NotificationEmail struct { // AddNotificationMicrosoftTeamsInput is based on the Lagoon API type. type AddNotificationMicrosoftTeamsInput struct { - Name string `json:"name"` - Webhook string `json:"webhook"` + Name string `json:"name,omitempty"` + Webhook string `json:"webhook,omitempty"` +} + +// UpdateNotificationMicrosoftTeamsPatchInput is based on the Lagoon API type. +type UpdateNotificationMicrosoftTeamsInput struct { + Name string `json:"name"` + Patch AddNotificationMicrosoftTeamsInput `json:"patch"` } // NotificationMicrosoftTeams is based on the Lagoon API type. @@ -55,13 +79,37 @@ type NotificationMicrosoftTeams struct { ID uint `json:"id,omitempty"` } +// AddNotificationWebhookInput is based on the Lagoon API type. +type AddNotificationWebhookInput struct { + Name string `json:"name,omitempty"` + Webhook string `json:"webhook,omitempty"` +} + +// UpdateNotificationWebhookPatchInput is based on the Lagoon API type. +type UpdateNotificationWebhookInput struct { + Name string `json:"name"` + Patch AddNotificationWebhookInput `json:"patch"` +} + +// NotificationWebhook is based on the Lagoon API type. +type NotificationWebhook struct { + AddNotificationWebhookInput + ID uint `json:"id,omitempty"` +} + +// DeleteNotification is the response. +type DeleteNotification struct { + DeleteNotification string `json:"deleteNotification"` +} + // Notifications represents possible Lagoon notification types. // These are unmarshalled from a projectByName query response. type Notifications struct { - Slack []AddNotificationSlackInput - RocketChat []AddNotificationRocketChatInput - Email []AddNotificationEmailInput - MicrosoftTeams []AddNotificationMicrosoftTeamsInput + Slack []AddNotificationSlackInput `json:"slack,omitempty"` + RocketChat []AddNotificationRocketChatInput `json:"rocketchat,omitempty"` + Email []AddNotificationEmailInput `json:"email,omitempty"` + MicrosoftTeams []AddNotificationMicrosoftTeamsInput `json:"microsoftteams,omitempty"` + Webhook []AddNotificationWebhookInput `json:"webhook,omitempty"` } // NotificationsConfig represents possible Lagoon notification types and @@ -112,6 +160,12 @@ func (n *Notifications) UnmarshalJSON(b []byte) error { Name: nMap["name"], Webhook: nMap["webhook"], }) + case "NotificationWebhook": + n.Webhook = append(n.Webhook, + AddNotificationWebhookInput{ + Name: nMap["name"], + Webhook: nMap["webhook"], + }) default: return fmt.Errorf("unknown notification type: %v", nMap["__typename"]) } @@ -148,6 +202,12 @@ func (n *NotificationsConfig) MarshalJSON() ([]byte, error) { "webhook": microsoftTeams.Webhook, }) } + for _, webhook := range n.Webhook { + nMap["webhook"] = append(nMap["webhook"], map[string]string{ + "name": webhook.Name, + "webhook": webhook.Webhook, + }) + } return json.Marshal(nMap) } @@ -194,6 +254,14 @@ func (n *NotificationsConfig) UnmarshalJSON(b []byte) error { Webhook: microsoftTeamsMap["webhook"], }) } + case "webhook": + for _, webhookMap := range nValues { + n.Webhook = append(n.Webhook, + AddNotificationWebhookInput{ + Name: webhookMap["name"], + Webhook: webhookMap["webhook"], + }) + } default: return fmt.Errorf("unknown notification type: %v", nType) } diff --git a/internal/schema/project.go b/internal/schema/project.go index b80038c8..37b2aa35 100644 --- a/internal/schema/project.go +++ b/internal/schema/project.go @@ -57,6 +57,7 @@ type ProjectNotifications struct { RocketChat []string `json:"rocketChat,omitempty"` Email []string `json:"email,omitempty"` MicrosoftTeams []string `json:"microsoftTeams,omitempty"` + Webhook []string `json:"webhook,omitempty"` } // OpenshiftID is unmarshalled during export. @@ -85,6 +86,14 @@ type AddNotificationToProjectInput struct { NotificationName string `json:"notificationName"` } +// RemoveNotificationFromProjectInput is based on the input to +// removeNotificationFromProject. +type RemoveNotificationFromProjectInput struct { + Project string `json:"project"` + NotificationType api.NotificationType `json:"notificationType"` + NotificationName string `json:"notificationName"` +} + // ProjectMetadata . type ProjectMetadata struct { Project diff --git a/pkg/api/types.go b/pkg/api/types.go index 03bb4abd..a9132931 100644 --- a/pkg/api/types.go +++ b/pkg/api/types.go @@ -40,6 +40,7 @@ const ( RocketChatNotification NotificationType = "ROCKETCHAT" EmailNotification NotificationType = "EMAIL" MicrosoftTeamsNotification NotificationType = "MICROSOFTTEAMS" + WebhookNotification NotificationType = "WEBHOOK" ) // DeploymentStatusType . diff --git a/pkg/lagoon/projects/main.go b/pkg/lagoon/projects/main.go index d59f724d..51df0dfb 100644 --- a/pkg/lagoon/projects/main.go +++ b/pkg/lagoon/projects/main.go @@ -25,20 +25,6 @@ type Client interface { ListProjectVariables(string, bool) ([]byte, error) GetProjectKey(string, bool) ([]byte, error) GetProjectInfo(string) ([]byte, error) - ListAllRocketChats() ([]byte, error) - ListProjectRocketChats(string) ([]byte, error) - ListAllSlacks() ([]byte, error) - ListProjectSlacks(string) ([]byte, error) - AddRocketChatNotification(string, string, string) ([]byte, error) - AddRocketChatNotificationToProject(string, string) ([]byte, error) - DeleteRocketChatNotificationFromProject(string, string) ([]byte, error) - UpdateRocketChatNotification(string, string) ([]byte, error) - DeleteRocketChatNotification(string) ([]byte, error) - AddSlackNotification(string, string, string) ([]byte, error) - AddSlackNotificationToProject(string, string) ([]byte, error) - DeleteSlackNotificationFromProject(string, string) ([]byte, error) - UpdateSlackNotification(string, string) ([]byte, error) - DeleteSlackNotification(string) ([]byte, error) DeleteProject(string) ([]byte, error) AddProject(string, string) ([]byte, error) UpdateProject(string, string) ([]byte, error) diff --git a/pkg/lagoon/projects/notifications.go b/pkg/lagoon/projects/notifications.go deleted file mode 100644 index d38367a1..00000000 --- a/pkg/lagoon/projects/notifications.go +++ /dev/null @@ -1,484 +0,0 @@ -package projects - -import ( - "encoding/json" - "fmt" - - "github.com/uselagoon/lagoon-cli/pkg/api" - "github.com/uselagoon/lagoon-cli/pkg/graphql" - "github.com/uselagoon/lagoon-cli/pkg/output" -) - -// ListProjectRocketChats will list all rocketchat notifications for a project -func (p *Projects) ListProjectRocketChats(projectName string) ([]byte, error) { - project := api.Project{ - Name: projectName, - } - projectRocketChats, err := p.api.GetRocketChatInfoForProject(project, graphql.RocketChatFragment) - if err != nil { - return []byte(""), err - } - returnResult, err := processProjectRocketChats(projectRocketChats) - if err != nil { - return []byte(""), err - } - return returnResult, nil -} - -// ListAllRocketChats will list all rocketchat notifications on all projects -func (p *Projects) ListAllRocketChats() ([]byte, error) { - customReq := api.CustomRequest{ - Query: `query { - allProjects { - name - id - notifications { - ...Notification - } - } - } - fragment Notification on NotificationRocketChat { - id - name - webhook - channel - }`, - Variables: map[string]interface{}{}, - MappedResult: "allProjects", - } - allRocketChats, err := p.api.Request(customReq) - if err != nil { - return []byte(""), err - } - returnResult, err := processAllRocketChats(allRocketChats) - if err != nil { - return []byte(""), err - } - return returnResult, nil -} - -func processProjectRocketChats(allProjects []byte) ([]byte, error) { - var rocketChats api.RocketChats - err := json.Unmarshal([]byte(allProjects), &rocketChats) - if err != nil { - return []byte(""), err - } - // process the data for output - data := []output.Data{} - for _, rocketchat := range rocketChats.RocketChats { - projectData := processRocketChat(rocketchat) - data = append(data, projectData) - } - dataMain := output.Table{ - Header: []string{"NID", "NotificationName", "Channel", "Webhook"}, - Data: data, - } - return json.Marshal(dataMain) -} - -func processRocketChat(rocketchat api.NotificationRocketChat) []string { - // count the current dev environments in a project - data := []string{ - fmt.Sprintf("%d", rocketchat.ID), - rocketchat.Name, - rocketchat.Channel, - rocketchat.Webhook, - } - return data -} - -func processAllRocketChats(allProjects []byte) ([]byte, error) { - var projects []api.Project - err := json.Unmarshal([]byte(allProjects), &projects) - if err != nil { - return []byte(""), err - } - // process the data for output - data := []output.Data{} - for _, project := range projects { - for _, notif := range project.Notifications { - var rocketchat api.NotificationRocketChat - rocketNotif, _ := json.Marshal(notif) - err := json.Unmarshal([]byte(rocketNotif), &rocketchat) - if err != nil { - return []byte(""), err - } - if rocketchat.ID != 0 { - data = append(data, []string{ - fmt.Sprintf("%d", rocketchat.ID), - project.Name, - rocketchat.Name, - rocketchat.Channel, - rocketchat.Webhook, - }) - } - } - } - dataMain := output.Table{ - Header: []string{"NID", "Project", "NotificationName", "Channel", "Webhook"}, - Data: data, - } - return json.Marshal(dataMain) -} - -// ListProjectSlacks will list all slack notifications for a project -func (p *Projects) ListProjectSlacks(projectName string) ([]byte, error) { - project := api.Project{ - Name: projectName, - } - projectSlacks, err := p.api.GetSlackInfoForProject(project, graphql.SlackFragment) - if err != nil { - return []byte(""), err - } - returnResult, err := processProjectSlacks(projectSlacks) - if err != nil { - return []byte(""), err - } - return returnResult, nil -} - -// ListAllSlacks will list all slack notifications on all projects -func (p *Projects) ListAllSlacks() ([]byte, error) { - customReq := api.CustomRequest{ - Query: `query { - allProjects { - name - id - notifications { - ...Notification - } - } - } - fragment Notification on NotificationSlack { - id - name - webhook - channel - }`, - Variables: map[string]interface{}{}, - MappedResult: "allProjects", - } - allSlacks, err := p.api.Request(customReq) - if err != nil { - return []byte(""), err - } - returnResult, err := processAllSlacks(allSlacks) - if err != nil { - return []byte(""), err - } - return returnResult, nil -} - -func processProjectSlacks(allProjects []byte) ([]byte, error) { - var rocketChats api.Slacks - err := json.Unmarshal([]byte(allProjects), &rocketChats) - if err != nil { - return []byte(""), err - } - // process the data for output - data := []output.Data{} - for _, slack := range rocketChats.Slacks { - projectData := processSlack(slack) - data = append(data, projectData) - } - dataMain := output.Table{ - Header: []string{"NID", "NotificationName", "Channel", "Webhook"}, - Data: data, - } - return json.Marshal(dataMain) -} - -func processSlack(rocketchat api.NotificationSlack) []string { - // count the current dev environments in a project - data := []string{ - fmt.Sprintf("%d", rocketchat.ID), - rocketchat.Name, - rocketchat.Channel, - rocketchat.Webhook, - } - return data -} - -func processAllSlacks(allProjects []byte) ([]byte, error) { - var projects []api.Project - err := json.Unmarshal([]byte(allProjects), &projects) - if err != nil { - return []byte(""), err - } - // process the data for output - data := []output.Data{} - for _, project := range projects { - for _, notif := range project.Notifications { - var slack api.NotificationSlack - slackNotif, _ := json.Marshal(notif) - err := json.Unmarshal([]byte(slackNotif), &slack) - if err != nil { - return []byte(""), err - } - if slack.ID != 0 { - data = append(data, []string{ - fmt.Sprintf("%d", slack.ID), - project.Name, - slack.Name, - slack.Channel, - slack.Webhook, - }) - } - } - } - dataMain := output.Table{ - Header: []string{"NID", "Project", "NotificationName", "Channel", "Webhook"}, - Data: data, - } - return json.Marshal(dataMain) -} - -// AddSlackNotification will add a slack notification to lagoon to be used by a project -func (p *Projects) AddSlackNotification(notificationName string, channel string, webhookURL string) ([]byte, error) { - customReq := api.CustomRequest{ - Query: `mutation ($name: String!, $channel: String!, $webhook: String!) { - addNotificationSlack(input:{name: $name, channel: $channel, webhook: $webhook} - ){ - id - } - }`, - Variables: map[string]interface{}{ - "name": notificationName, - "channel": channel, - "webhook": webhookURL, - }, - MappedResult: "addNotificationSlack", - } - returnResult, err := p.api.Request(customReq) - if err != nil { - return []byte(""), err - } - return returnResult, nil -} - -// AddSlackNotificationToProject will add a notification to a project -func (p *Projects) AddSlackNotificationToProject(projectName string, notificationName string) ([]byte, error) { - customReq := api.CustomRequest{ - Query: `mutation ($name: String!, $project: String!) { - addNotificationToProject(input:{notificationName: $name, notificationType: SLACK, project: $project} - ){ - id - } - }`, - Variables: map[string]interface{}{ - "name": notificationName, - "project": projectName, - }, - MappedResult: "addNotificationToProject", - } - returnResult, err := p.api.Request(customReq) - if err != nil { - return []byte(""), err - } - return returnResult, nil -} - -// DeleteSlackNotification will delete a slack notification from lagoon -func (p *Projects) DeleteSlackNotification(notificationName string) ([]byte, error) { - customReq := api.CustomRequest{ - Query: `mutation ($name: String!) { - deleteNotificationSlack(input:{name: $name}) - }`, - Variables: map[string]interface{}{ - "name": notificationName, - }, - MappedResult: "deleteNotificationSlack", - } - returnResult, err := p.api.Request(customReq) - if err != nil { - return []byte(""), err - } - return returnResult, nil -} - -// DeleteSlackNotificationFromProject will delete a slack notification from a project -func (p *Projects) DeleteSlackNotificationFromProject(projectName string, notificationName string) ([]byte, error) { - // get project info from lagoon, we need the project ID for later - project := api.Project{ - Name: projectName, - } - projectByName, err := p.api.GetProjectByName(project, graphql.ProjectNameID) - if err != nil { - return []byte(""), err - } - var projectInfo api.Project - err = json.Unmarshal([]byte(projectByName), &projectInfo) - if err != nil { - return []byte(""), err - } - customReq := api.CustomRequest{ - Query: `mutation ($name: String!, $project: String!) { - removeNotificationFromProject(input:{notificationName: $name, project: $project, notificationType: SLACK}) - { - id - } - }`, - Variables: map[string]interface{}{ - "name": notificationName, - "project": projectName, - }, - MappedResult: "removeNotificationFromProject", - } - returnResult, err := p.api.Request(customReq) - if err != nil { - return []byte(""), err - } - return returnResult, nil -} - -// AddRocketChatNotification will add a rocketchat notification to lagoon to be used by a project -func (p *Projects) AddRocketChatNotification(notificationName string, channel string, webhookURL string) ([]byte, error) { - customReq := api.CustomRequest{ - Query: `mutation ($name: String!, $channel: String!, $webhook: String!) { - addNotificationRocketChat(input:{name: $name, channel: $channel, webhook: $webhook} - ){ - id - } - }`, - Variables: map[string]interface{}{ - "name": notificationName, - "channel": channel, - "webhook": webhookURL, - }, - MappedResult: "addNotificationRocketChat", - } - returnResult, err := p.api.Request(customReq) - if err != nil { - return []byte(""), err - } - return returnResult, nil -} - -// AddRocketChatNotificationToProject will add a rocketchat notification to a project -func (p *Projects) AddRocketChatNotificationToProject(projectName string, notificationName string) ([]byte, error) { - customReq := api.CustomRequest{ - Query: `mutation ($name: String!, $project: String!) { - addNotificationToProject(input:{notificationName: $name, notificationType: ROCKETCHAT, project: $project} - ){ - id - } - }`, - Variables: map[string]interface{}{ - "name": notificationName, - "project": projectName, - }, - MappedResult: "addNotificationToProject", - } - returnResult, err := p.api.Request(customReq) - if err != nil { - return []byte(""), err - } - return returnResult, nil -} - -// DeleteRocketChatNotification will delete a rocketchat notification from lagoon -func (p *Projects) DeleteRocketChatNotification(notificationName string) ([]byte, error) { - customReq := api.CustomRequest{ - Query: `mutation ($name: String!) { - deleteNotificationRocketChat(input:{name: $name}) - }`, - Variables: map[string]interface{}{ - "name": notificationName, - }, - MappedResult: "deleteNotificationRocketChat", - } - returnResult, err := p.api.Request(customReq) - if err != nil { - return []byte(""), err - } - return returnResult, nil -} - -// DeleteRocketChatNotificationFromProject will delete a rocketchat notification from a project -func (p *Projects) DeleteRocketChatNotificationFromProject(projectName string, notificationName string) ([]byte, error) { - // get project info from lagoon, we need the project ID for later - project := api.Project{ - Name: projectName, - } - projectByName, err := p.api.GetProjectByName(project, graphql.ProjectNameID) - if err != nil { - return []byte(""), err - } - var projectInfo api.Project - err = json.Unmarshal([]byte(projectByName), &projectInfo) - if err != nil { - return []byte(""), err - } - customReq := api.CustomRequest{ - Query: `mutation ($name: String!, $project: String!) { - removeNotificationFromProject(input:{notificationName: $name, project: $project, notificationType: ROCKETCHAT}) - { - id - } - }`, - Variables: map[string]interface{}{ - "name": notificationName, - "project": projectName, - }, - MappedResult: "removeNotificationFromProject", - } - returnResult, err := p.api.Request(customReq) - if err != nil { - return []byte(""), err - } - return returnResult, nil -} - -// UpdateSlackNotification will update an existing notification -func (p *Projects) UpdateSlackNotification(notificationName string, jsonPatch string) ([]byte, error) { - var updateSlack api.UpdateNotificationSlackPatch - err := json.Unmarshal([]byte(jsonPatch), &updateSlack) - if err != nil { - return []byte(""), err - } - customReq := api.CustomRequest{ - Query: `mutation ($oldname: String!, $patch: UpdateNotificationSlackPatchInput!) { - updateNotificationSlack(input:{name: $oldname, patch: $patch} - ){ - id - } - }`, - Variables: map[string]interface{}{ - "oldname": notificationName, - "patch": updateSlack, - }, - MappedResult: "updateNotificationSlack", - } - returnResult, err := p.api.Request(customReq) - if err != nil { - return []byte(""), err - } - return returnResult, nil -} - -// UpdateRocketChatNotification will update an existing notification -func (p *Projects) UpdateRocketChatNotification(notificationName string, jsonPatch string) ([]byte, error) { - var updateRocketChat api.UpdateNotificationRocketChatPatch - err := json.Unmarshal([]byte(jsonPatch), &updateRocketChat) - if err != nil { - return []byte(""), err - } - customReq := api.CustomRequest{ - Query: `mutation ($oldname: String!, $patch: UpdateNotificationRocketChatPatchInput!) { - updateNotificationRocketChat(input:{name: $oldname, patch: $patch} - ){ - id - } - }`, - Variables: map[string]interface{}{ - "oldname": notificationName, - "patch": updateRocketChat, - }, - MappedResult: "updateNotificationRocketChat", - } - returnResult, err := p.api.Request(customReq) - if err != nil { - return []byte(""), err - } - return returnResult, nil -} diff --git a/pkg/lagoon/projects/notifications_test.go b/pkg/lagoon/projects/notifications_test.go deleted file mode 100644 index 50ebc71c..00000000 --- a/pkg/lagoon/projects/notifications_test.go +++ /dev/null @@ -1,120 +0,0 @@ -package projects - -import ( - "testing" -) - -func TestListProjectRocketChats(t *testing.T) { - var allRocketChats = `{"rocketchats":[{"channel":"lagoon-local-ci","id":1,"name":"amazeeio--lagoon-local-ci","webhook":"https://amazeeio.rocket.chat/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"}]}` - var allRocketChatsSuccess = `{"header":["NID","NotificationName","Channel","Webhook"],"data":[["1","amazeeio--lagoon-local-ci","lagoon-local-ci","https://amazeeio.rocket.chat/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"]]}` - - returnResult, err := processProjectRocketChats([]byte(allRocketChats)) - if err != nil { - t.Error("Should not fail if processing succeeded", err) - } - if string(returnResult) != allRocketChatsSuccess { - checkEqual(t, string(returnResult), allRocketChatsSuccess, "projectInfo processing failed") - } -} - -func TestListAllRocketChats(t *testing.T) { - var allRocketChats = `[ - {"id":1,"name":"credentialstest-project1","notifications":[]}, - {"id":2,"name":"credentialstest-project2","notifications":[]}, - {"id":3,"name":"ci-github","notifications":[ - {},{"channel":"lagoon-local-ci","id":1,"name":"amazeeio--lagoon-local-ci","webhook":"https://amazeeio.rocket.chat/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"}]}, - {"id":4,"name":"ci-gitlab","notifications":[ - {},{},{"channel":"lagoon-local-ci","id":1,"name":"amazeeio--lagoon-local-ci","webhook":"https://amazeeio.rocket.chat/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"}]}, - {"id":5,"name":"ci-bitbucket","notifications":[ - {"channel":"lagoon-local-ci","id":1,"name":"amazeeio--lagoon-local-ci","webhook":"https://amazeeio.rocket.chat/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"}]}, - {"id":6,"name":"ci-rest","notifications":[ - {"channel":"lagoon-local-ci","id":1,"name":"amazeeio--lagoon-local-ci","webhook":"https://amazeeio.rocket.chat/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"}]}, - {"id":7,"name":"ci-node","notifications":[ - {"channel":"lagoon-local-ci","id":1,"name":"amazeeio--lagoon-local-ci","webhook":"https://amazeeio.rocket.chat/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"}]}, - {"id":8,"name":"ci-multiproject1","notifications":[ - {"channel":"lagoon-local-ci","id":1,"name":"amazeeio--lagoon-local-ci","webhook":"https://amazeeio.rocket.chat/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"}]}, - {"id":9,"name":"ci-multiproject2","notifications":[ - {"channel":"lagoon-local-ci","id":1,"name":"amazeeio--lagoon-local-ci","webhook":"https://amazeeio.rocket.chat/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"}]}, - {"id":10,"name":"ci-drupal","notifications":[ - {"channel":"lagoon-local-ci","id":1,"name":"amazeeio--lagoon-local-ci","webhook":"https://amazeeio.rocket.chat/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"}]}, - {"id":11,"name":"ci-nginx","notifications":[ - {"channel":"lagoon-local-ci","id":1,"name":"amazeeio--lagoon-local-ci","webhook":"https://amazeeio.rocket.chat/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"}]}, - {"id":12,"name":"ci-features","notifications":[ - {"channel":"lagoon-local-ci","id":1,"name":"amazeeio--lagoon-local-ci","webhook":"https://amazeeio.rocket.chat/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"}]}, - {"id":13,"name":"lagoon","notifications":[ - {"channel":"lagoon-kickstart","id":3,"name":"amazeeio--lagoon-kickstart","webhook":"https://amazeeio.rocket.chat/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"}]}, - {"id":14,"name":"ci-elasticsearch","notifications":[ - {"channel":"lagoon-local-ci","id":1,"name":"amazeeio--lagoon-local-ci","webhook":"https://amazeeio.rocket.chat/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"}]}, - {"id":15,"name":"ci-drupal-galera","notifications":[ - {"channel":"lagoon-local-ci","id":1,"name":"amazeeio--lagoon-local-ci","webhook":"https://amazeeio.rocket.chat/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"}]}, - {"id":16,"name":"ci-drupal-postgres","notifications":[ - {"channel":"lagoon-local-ci","id":1,"name":"amazeeio--lagoon-local-ci","webhook":"https://amazeeio.rocket.chat/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"}]}, - {"id":17,"name":"ci-features-subfolder","notifications":[ - {"channel":"lagoon-local-ci","id":1,"name":"amazeeio--lagoon-local-ci","webhook":"https://amazeeio.rocket.chat/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"}]}, - {"id":18,"name":"high-cotton","notifications":[{},{}]}, - {"id":19,"name":"ci-env-limit","notifications":[]}, - {"id":20,"name":"ci-solr","notifications":[ - {"channel":"lagoon-local-ci","id":1,"name":"amazeeio--lagoon-local-ci","webhook":"https://amazeeio.rocket.chat/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"}]}, - {"id":21,"name":"ci-api","notifications":[ - {"channel":"lagoon-local-ci","id":1,"name":"amazeeio--lagoon-local-ci","webhook":"https://amazeeio.rocket.chat/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"}]}, - {"id":22,"name":"credentialstest-project3","notifications":[]}]` - var allRocketChatsSuccess = `{"header":["NID","Project","NotificationName","Channel","Webhook"],"data":[["1","ci-github","amazeeio--lagoon-local-ci","lagoon-local-ci","https://amazeeio.rocket.chat/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"],["1","ci-gitlab","amazeeio--lagoon-local-ci","lagoon-local-ci","https://amazeeio.rocket.chat/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"],["1","ci-bitbucket","amazeeio--lagoon-local-ci","lagoon-local-ci","https://amazeeio.rocket.chat/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"],["1","ci-rest","amazeeio--lagoon-local-ci","lagoon-local-ci","https://amazeeio.rocket.chat/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"],["1","ci-node","amazeeio--lagoon-local-ci","lagoon-local-ci","https://amazeeio.rocket.chat/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"],["1","ci-multiproject1","amazeeio--lagoon-local-ci","lagoon-local-ci","https://amazeeio.rocket.chat/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"],["1","ci-multiproject2","amazeeio--lagoon-local-ci","lagoon-local-ci","https://amazeeio.rocket.chat/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"],["1","ci-drupal","amazeeio--lagoon-local-ci","lagoon-local-ci","https://amazeeio.rocket.chat/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"],["1","ci-nginx","amazeeio--lagoon-local-ci","lagoon-local-ci","https://amazeeio.rocket.chat/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"],["1","ci-features","amazeeio--lagoon-local-ci","lagoon-local-ci","https://amazeeio.rocket.chat/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"],["3","lagoon","amazeeio--lagoon-kickstart","lagoon-kickstart","https://amazeeio.rocket.chat/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"],["1","ci-elasticsearch","amazeeio--lagoon-local-ci","lagoon-local-ci","https://amazeeio.rocket.chat/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"],["1","ci-drupal-galera","amazeeio--lagoon-local-ci","lagoon-local-ci","https://amazeeio.rocket.chat/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"],["1","ci-drupal-postgres","amazeeio--lagoon-local-ci","lagoon-local-ci","https://amazeeio.rocket.chat/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"],["1","ci-features-subfolder","amazeeio--lagoon-local-ci","lagoon-local-ci","https://amazeeio.rocket.chat/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"],["1","ci-solr","amazeeio--lagoon-local-ci","lagoon-local-ci","https://amazeeio.rocket.chat/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"],["1","ci-api","amazeeio--lagoon-local-ci","lagoon-local-ci","https://amazeeio.rocket.chat/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"]]}` - - returnResult, err := processAllSlacks([]byte(allRocketChats)) - if err != nil { - t.Error("Should not fail if processing succeeded", err) - } - if string(returnResult) != allRocketChatsSuccess { - checkEqual(t, string(returnResult), allRocketChatsSuccess, "projectInfo processing failed") - } -} - -func TestListProjectSlacks(t *testing.T) { - var allSlacks = `{"slacks":[{"channel":"lagoon-local-ci","id":30,"name":"amazeeio--lagoon-local-ci","webhook":"https://amazeeio.slack.fake/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"}]}` - var allSlacksSuccess = `{"header":["NID","NotificationName","Channel","Webhook"],"data":[["30","amazeeio--lagoon-local-ci","lagoon-local-ci","https://amazeeio.slack.fake/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"]]}` - - returnResult, err := processProjectSlacks([]byte(allSlacks)) - if err != nil { - t.Error("Should not fail if processing succeeded", err) - } - if string(returnResult) != allSlacksSuccess { - checkEqual(t, string(returnResult), allSlacksSuccess, "projectInfo processing failed") - } -} - -func TestListAllSlacks(t *testing.T) { - var allSlacks = `[ - {"id":1,"name":"credentialstest-project1","notifications":[]}, - {"id":2,"name":"credentialstest-project2","notifications":[]}, - {"id":3,"name":"ci-github","notifications":[ - {"channel":"lagoon-local-ci","id":30,"name":"amazeeio--lagoon-local-ci","webhook":"https://amazeeio.slack.fake/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"}, - {}]}, - {"id":4,"name":"ci-gitlab","notifications":[]}, - {"id":5,"name":"ci-bitbucket","notifications":[{}]}, - {"id":6,"name":"ci-rest","notifications":[{}]}, - {"id":7,"name":"ci-node","notifications":[{}]}, - {"id":8,"name":"ci-multiproject1","notifications":[{}]}, - {"id":9,"name":"ci-multiproject2","notifications":[{}]}, - {"id":10,"name":"ci-drupal","notifications":[{}]}, - {"id":11,"name":"ci-nginx","notifications":[{}]}, - {"id":12,"name":"ci-features","notifications":[{}]}, - {"id":13,"name":"lagoon","notifications":[{}]}, - {"id":14,"name":"ci-elasticsearch","notifications":[{}]}, - {"id":15,"name":"ci-drupal-galera","notifications":[{}]}, - {"id":16,"name":"ci-drupal-postgres","notifications":[{}]}, - {"id":17,"name":"ci-features-subfolder","notifications":[{}]}, - {"id":18,"name":"high-cotton","notifications":[]}, - {"id":19,"name":"ci-env-limit","notifications":[]}, - {"id":20,"name":"ci-solr","notifications":[{}]}, - {"id":21,"name":"ci-api","notifications":[{}]}, - {"id":22,"name":"credentialstest-project3","notifications":[]}]` - var allSlacksSuccess = `{"header":["NID","Project","NotificationName","Channel","Webhook"],"data":[["30","ci-github","amazeeio--lagoon-local-ci","lagoon-local-ci","https://amazeeio.slack.fake/hooks/ikF5XMohDZK7KpsZf/c9BFBt2ch8oMMuycoERJQMSLTPo8nmZhg2Hf2ny68ZpuD4Kn"]]}` - - returnResult, err := processAllSlacks([]byte(allSlacks)) - if err != nil { - t.Error("Should not fail if processing succeeded", err) - } - if string(returnResult) != allSlacksSuccess { - checkEqual(t, string(returnResult), allSlacksSuccess, "projectInfo processing failed") - } -}