From f1a8c0d2de6f784e8309c012017920dc7160abca Mon Sep 17 00:00:00 2001 From: Chris Goodwin <40746380+CGoodwin90@users.noreply.github.com> Date: Mon, 4 Dec 2023 16:17:21 +1100 Subject: [PATCH] Fix: Updated various commands to utilize machinery (#300) --- cmd/deploytargetconfig.go | 23 ++- cmd/project.go | 30 ++-- cmd/tasks.go | 20 +-- go.mod | 4 +- go.sum | 5 + .../_lgraphql/addDeployTargetConfig.graphql | 61 -------- .../_lgraphql/projectsByMetadata.graphql | 27 ---- .../removeProjectMetadataByKey.graphql | 16 -- .../_lgraphql/switchActiveStandby.graphql | 15 -- .../lagoon/client/_lgraphql/taskByID.graphql | 18 --- .../_lgraphql/updateProjectMetadata.graphql | 20 --- internal/lagoon/client/lgraphql/lgraphql.go | 148 +----------------- internal/lagoon/client/mutation.go | 73 --------- internal/lagoon/client/query.go | 41 ----- internal/lagoon/deploytargetconfig.go | 7 - internal/lagoon/projects.go | 21 --- internal/lagoon/tasks.go | 27 ---- 17 files changed, 54 insertions(+), 502 deletions(-) delete mode 100644 internal/lagoon/client/_lgraphql/addDeployTargetConfig.graphql delete mode 100644 internal/lagoon/client/_lgraphql/projectsByMetadata.graphql delete mode 100644 internal/lagoon/client/_lgraphql/removeProjectMetadataByKey.graphql delete mode 100644 internal/lagoon/client/_lgraphql/switchActiveStandby.graphql delete mode 100644 internal/lagoon/client/_lgraphql/taskByID.graphql delete mode 100644 internal/lagoon/client/_lgraphql/updateProjectMetadata.graphql delete mode 100644 internal/lagoon/tasks.go diff --git a/cmd/deploytargetconfig.go b/cmd/deploytargetconfig.go index d9fd24f8..ad0dfcf8 100644 --- a/cmd/deploytargetconfig.go +++ b/cmd/deploytargetconfig.go @@ -3,6 +3,9 @@ package cmd import ( "context" "fmt" + l "github.com/uselagoon/machinery/api/lagoon" + lclient "github.com/uselagoon/machinery/api/lagoon/client" + s "github.com/uselagoon/machinery/api/schema" "github.com/spf13/cobra" "github.com/uselagoon/lagoon-cli/internal/lagoon" @@ -41,6 +44,12 @@ var addDeployTargetConfigCmd = &cobra.Command{ return err } + if cmdProjectName == "" { + return fmt.Errorf("Missing arguments: project is a required flag") + } + if deploytarget == 0 { + return fmt.Errorf("Missing arguments: deploytarget id is a required flag") + } if pullrequests == "" { return fmt.Errorf("Missing arguments: pullrequests is a required flag") } @@ -48,31 +57,31 @@ var addDeployTargetConfigCmd = &cobra.Command{ return fmt.Errorf("Missing arguments: branches is a required flag") } current := lagoonCLIConfig.Current - lc := client.New( + token := lagoonCLIConfig.Lagoons[current].Token + lc := lclient.New( lagoonCLIConfig.Lagoons[current].GraphQL, - lagoonCLIConfig.Lagoons[current].Token, - lagoonCLIConfig.Lagoons[current].Version, lagoonCLIVersion, + &token, debug) - project, err := lagoon.GetMinimalProjectByName(context.TODO(), cmdProjectName, lc) + project, err := l.GetMinimalProjectByName(context.TODO(), cmdProjectName, lc) if err != nil { return err } - addDeployTargetConfig := &schema.AddDeployTargetConfigInput{ + addDeployTargetConfig := &s.AddDeployTargetConfigInput{ Project: uint(project.ID), Weight: weight, } if branches != "" { addDeployTargetConfig.Branches = branches } - if branches != "" { + if pullrequests != "" { addDeployTargetConfig.Pullrequests = pullrequests } if deploytarget != 0 { addDeployTargetConfig.DeployTarget = deploytarget } if yesNo(fmt.Sprintf("You are attempting to add a deploytarget configuration to project '%s', are you sure?", cmdProjectName)) { - deployTargetConfig, err := lagoon.AddDeployTargetConfiguration(context.TODO(), addDeployTargetConfig, lc) + deployTargetConfig, err := l.AddDeployTargetConfiguration(context.TODO(), addDeployTargetConfig, lc) if err != nil { return err } diff --git a/cmd/project.go b/cmd/project.go index 272e56bf..25863c1e 100644 --- a/cmd/project.go +++ b/cmd/project.go @@ -4,6 +4,8 @@ import ( "context" "encoding/json" "fmt" + l "github.com/uselagoon/machinery/api/lagoon" + lclient "github.com/uselagoon/machinery/api/lagoon/client" "os" "github.com/spf13/cobra" @@ -155,13 +157,13 @@ var listProjectByMetadata = &cobra.Command{ return fmt.Errorf("Missing arguments: key is not defined") } current := lagoonCLIConfig.Current - lc := client.New( + token := lagoonCLIConfig.Lagoons[current].Token + lc := lclient.New( lagoonCLIConfig.Lagoons[current].GraphQL, - lagoonCLIConfig.Lagoons[current].Token, - lagoonCLIConfig.Lagoons[current].Version, lagoonCLIVersion, + &token, debug) - projects, err := lagoon.GetProjectsByMetadata(context.TODO(), key, value, lc) + projects, err := l.GetProjectsByMetadata(context.TODO(), key, value, lc) if err != nil { return err } @@ -275,17 +277,17 @@ var updateProjectMetadata = &cobra.Command{ } if yesNo(fmt.Sprintf("You are attempting to update key '%s' for project '%s' metadata, are you sure?", key, cmdProjectName)) { current := lagoonCLIConfig.Current - lc := client.New( + token := lagoonCLIConfig.Lagoons[current].Token + lc := lclient.New( lagoonCLIConfig.Lagoons[current].GraphQL, - lagoonCLIConfig.Lagoons[current].Token, - lagoonCLIConfig.Lagoons[current].Version, lagoonCLIVersion, + &token, debug) - project, err := lagoon.GetMinimalProjectByName(context.TODO(), cmdProjectName, lc) + project, err := l.GetMinimalProjectByName(context.TODO(), cmdProjectName, lc) if err != nil { return err } - projectResult, err := lagoon.UpdateProjectMetadata(context.TODO(), int(project.ID), key, value, lc) + projectResult, err := l.UpdateProjectMetadata(context.TODO(), int(project.ID), key, value, lc) if err != nil { return err } @@ -330,17 +332,17 @@ var deleteProjectMetadataByKey = &cobra.Command{ } if yesNo(fmt.Sprintf("You are attempting to delete key '%s' from project '%s' metadata, are you sure?", key, cmdProjectName)) { current := lagoonCLIConfig.Current - lc := client.New( + token := lagoonCLIConfig.Lagoons[current].Token + lc := lclient.New( lagoonCLIConfig.Lagoons[current].GraphQL, - lagoonCLIConfig.Lagoons[current].Token, - lagoonCLIConfig.Lagoons[current].Version, lagoonCLIVersion, + &token, debug) - project, err := lagoon.GetMinimalProjectByName(context.TODO(), cmdProjectName, lc) + project, err := l.GetMinimalProjectByName(context.TODO(), cmdProjectName, lc) if err != nil { return err } - projectResult, err := lagoon.RemoveProjectMetadataByKey(context.TODO(), int(project.ID), key, lc) + projectResult, err := l.RemoveProjectMetadataByKey(context.TODO(), int(project.ID), key, lc) if err != nil { return err } diff --git a/cmd/tasks.go b/cmd/tasks.go index 3050c95a..a927f91b 100644 --- a/cmd/tasks.go +++ b/cmd/tasks.go @@ -7,10 +7,10 @@ import ( "errors" "fmt" "github.com/spf13/cobra" - "github.com/uselagoon/lagoon-cli/internal/lagoon" - "github.com/uselagoon/lagoon-cli/internal/lagoon/client" "github.com/uselagoon/lagoon-cli/pkg/api" "github.com/uselagoon/lagoon-cli/pkg/output" + l "github.com/uselagoon/machinery/api/lagoon" + lclient "github.com/uselagoon/machinery/api/lagoon/client" "io/ioutil" "os" ) @@ -41,13 +41,13 @@ var getTaskByID = &cobra.Command{ return fmt.Errorf("Missing arguments: ID is not defined") } current := lagoonCLIConfig.Current - lc := client.New( + token := lagoonCLIConfig.Lagoons[current].Token + lc := lclient.New( lagoonCLIConfig.Lagoons[current].GraphQL, - lagoonCLIConfig.Lagoons[current].Token, - lagoonCLIConfig.Lagoons[current].Version, lagoonCLIVersion, + &token, debug) - result, err := lagoon.TaskByID(context.TODO(), taskID, lc) + result, err := l.TaskByID(context.TODO(), taskID, lc) if err != nil { return err } @@ -100,13 +100,13 @@ If the task fails or fails to update, contact your Lagoon administrator for assi } if yesNo(fmt.Sprintf("You are attempting to run the active/standby switch for project '%s', are you sure?", cmdProjectName)) { current := lagoonCLIConfig.Current - lc := client.New( + token := lagoonCLIConfig.Lagoons[current].Token + lc := lclient.New( lagoonCLIConfig.Lagoons[current].GraphQL, - lagoonCLIConfig.Lagoons[current].Token, - lagoonCLIConfig.Lagoons[current].Version, lagoonCLIVersion, + &token, debug) - result, err := lagoon.ActiveStandbySwitch(context.TODO(), cmdProjectName, lc) + result, err := l.ActiveStandbySwitch(context.TODO(), cmdProjectName, lc) if err != nil { return err } diff --git a/go.mod b/go.mod index 4ec1069e..2d25de43 100644 --- a/go.mod +++ b/go.mod @@ -30,7 +30,7 @@ require ( github.com/guregu/null v4.0.0+incompatible // workaround for https://github.com/manifoldco/promptui/issues/98 github.com/nicksnyder/go-i18n v1.10.1 // indirect - github.com/uselagoon/machinery v0.0.11 + github.com/uselagoon/machinery v0.0.13 golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3 // indirect golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect gopkg.in/alecthomas/kingpin.v3-unstable v3.0.0-20191105091915-95d230a53780 // indirect @@ -41,4 +41,4 @@ replace github.com/olekukonko/tablewriter => github.com/shreddedbacon/tablewrite // replace github.com/machinebox/graphql => ../../shreddedbacon/graphql -// replace github.com/olekukonko/tablewriter => ../../shreddedbacon/tablewriter \ No newline at end of file +// replace github.com/olekukonko/tablewriter => ../../shreddedbacon/tablewriter diff --git a/go.sum b/go.sum index fe18d60a..ce748682 100644 --- a/go.sum +++ b/go.sum @@ -27,6 +27,7 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/go-bindata/go-bindata v3.1.2+incompatible h1:5vjJMVhowQdPzjE1LdxyFF7YFTXg5IgGVW4gBr5IbvE= github.com/go-bindata/go-bindata v3.1.2+incompatible/go.mod h1:xK8Dsgwmeed+BBsSy2XTopBn/8uK2HWuGSnA11C3Joo= +github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang/lint v0.0.0-20181026193005-c67002cb31c3 h1:I4BOK3PBMjhWfQM2zPJKK7lOBGsrsvOB7kBELP33hiE= github.com/golang/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= @@ -107,6 +108,10 @@ github.com/tsenart/deadcode v0.0.0-20160724212837-210d2dc333e9/go.mod h1:q+QjxYv github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/uselagoon/machinery v0.0.11 h1:s6EhyU/pj1+C4FdS0EqmR6C0dLsoeCd9n+5xHL1YDag= github.com/uselagoon/machinery v0.0.11/go.mod h1:IXLxlkahEAEgpCmu9Xa/Wmjo6ja4Aoq7tf8G7VrileE= +github.com/uselagoon/machinery v0.0.12 h1:TJnA+FrL1uEhRTjJ6dExiL4G7SOQ+hUfGuWDmbW2HBA= +github.com/uselagoon/machinery v0.0.12/go.mod h1:h/qeMWQR4Qqu33x+8AulNDeolEwvb/G+aIsn/jyUtwk= +github.com/uselagoon/machinery v0.0.13 h1:ZCLBNWJmDr3wikaHs3pWhQ1j8MprhIqRuChgSqmLyZc= +github.com/uselagoon/machinery v0.0.13/go.mod h1:h/qeMWQR4Qqu33x+8AulNDeolEwvb/G+aIsn/jyUtwk= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= diff --git a/internal/lagoon/client/_lgraphql/addDeployTargetConfig.graphql b/internal/lagoon/client/_lgraphql/addDeployTargetConfig.graphql deleted file mode 100644 index b2ae21dd..00000000 --- a/internal/lagoon/client/_lgraphql/addDeployTargetConfig.graphql +++ /dev/null @@ -1,61 +0,0 @@ -{{ if apiVerGreaterThanOrEqual . "2.10.0" }} -mutation ( - $project: Int! - $weight: Int - $branches: String! - $pullrequests: String! - $deployTarget: Int! - $deployTargetProjectPattern: String -){ - addDeployTargetConfig(input:{ - deployTarget: $deployTarget - weight: $weight - branches: $branches - pullrequests: $pullrequests - project: $project - deployTargetProjectPattern: $deployTargetProjectPattern - }){ - id - deployTarget{ - id - name - friendlyName - cloudProvider - cloudRegion - } - branches - pullrequests - weight - } -} -{{ else }} -mutation ( - $project: Int! - $weight: Int - $branches: String - $pullrequests: String - $deployTarget: Int! - $deployTargetProjectPattern: String -){ - addDeployTargetConfig(input:{ - deployTarget: $deployTarget - weight: $weight - branches: $branches - pullrequests: $pullrequests - project: $project - deployTargetProjectPattern: $deployTargetProjectPattern - }){ - id - deployTarget{ - id - name - friendlyName - cloudProvider - cloudRegion - } - branches - pullrequests - weight - } -} -{{ end }} \ No newline at end of file diff --git a/internal/lagoon/client/_lgraphql/projectsByMetadata.graphql b/internal/lagoon/client/_lgraphql/projectsByMetadata.graphql deleted file mode 100644 index f72b3120..00000000 --- a/internal/lagoon/client/_lgraphql/projectsByMetadata.graphql +++ /dev/null @@ -1,27 +0,0 @@ -{{ if apiVerGreaterThanOrEqual . "1.6.0" }} -query ( - $key: String! - $value: String){ - projectsByMetadata( - metadata: { - key: $key - value: $value - } - ){ - id - name - autoIdle - branches - pullrequests - metadata - productionEnvironment - openshiftProjectPattern - developmentEnvironmentsLimit - gitUrl - autoIdle - openshift{ - id - } - } -} -{{ end }} \ No newline at end of file diff --git a/internal/lagoon/client/_lgraphql/removeProjectMetadataByKey.graphql b/internal/lagoon/client/_lgraphql/removeProjectMetadataByKey.graphql deleted file mode 100644 index b9226177..00000000 --- a/internal/lagoon/client/_lgraphql/removeProjectMetadataByKey.graphql +++ /dev/null @@ -1,16 +0,0 @@ -{{ if apiVerGreaterThanOrEqual . "1.6.0" }} -mutation ( - $id: Int! - $key: String!){ - removeProjectMetadataByKey( - input:{ - id: $id - key: $key - } - ){ - id - name - metadata - } -} -{{ end }} \ No newline at end of file diff --git a/internal/lagoon/client/_lgraphql/switchActiveStandby.graphql b/internal/lagoon/client/_lgraphql/switchActiveStandby.graphql deleted file mode 100644 index 4b2586cb..00000000 --- a/internal/lagoon/client/_lgraphql/switchActiveStandby.graphql +++ /dev/null @@ -1,15 +0,0 @@ -{{ if apiVerGreaterThanOrEqual . "1.9.0" }} -mutation ( - $project: String! - ) { - switchActiveStandby( - input: { - project:{ - name: $project - } - } - ) { - id - } -} -{{ end }} \ No newline at end of file diff --git a/internal/lagoon/client/_lgraphql/taskByID.graphql b/internal/lagoon/client/_lgraphql/taskByID.graphql deleted file mode 100644 index 8f836ec0..00000000 --- a/internal/lagoon/client/_lgraphql/taskByID.graphql +++ /dev/null @@ -1,18 +0,0 @@ -{{ if apiVerGreaterThanOrEqual . "1.9.0" }} -query ( - $id: Int! - ){ - taskById(id: $id){ - id - name - command - status - started - completed - created - logs - remoteId - service - } -} -{{ end }} \ No newline at end of file diff --git a/internal/lagoon/client/_lgraphql/updateProjectMetadata.graphql b/internal/lagoon/client/_lgraphql/updateProjectMetadata.graphql deleted file mode 100644 index 1a190c48..00000000 --- a/internal/lagoon/client/_lgraphql/updateProjectMetadata.graphql +++ /dev/null @@ -1,20 +0,0 @@ -{{ if apiVerGreaterThanOrEqual . "1.6.0" }} -mutation ( - $id: Int! - $key: String! - $value: String){ - updateProjectMetadata( - input:{ - id: $id - patch: { - key: $key - value: $value - } - } - ){ - id - name - metadata - } -} -{{ end }} \ No newline at end of file diff --git a/internal/lagoon/client/lgraphql/lgraphql.go b/internal/lagoon/client/lgraphql/lgraphql.go index 15b4f101..f246b0f1 100644 --- a/internal/lagoon/client/lgraphql/lgraphql.go +++ b/internal/lagoon/client/lgraphql/lgraphql.go @@ -1,7 +1,6 @@ // 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 @@ -27,14 +26,9 @@ // _lgraphql/minimalProjectByName.graphql // _lgraphql/projectByName.graphql // _lgraphql/projectByNameMetadata.graphql -// _lgraphql/projectsByMetadata.graphql -// _lgraphql/removeProjectMetadataByKey.graphql // _lgraphql/sshEndpointsByProject.graphql -// _lgraphql/switchActiveStandby.graphql -// _lgraphql/taskByID.graphql // _lgraphql/updateDeployTarget.graphql // _lgraphql/updateDeployTargetConfig.graphql -// _lgraphql/updateProjectMetadata.graphql // _lgraphql/variables/addOrUpdateEnvVariableByName.graphql // _lgraphql/variables/deleteEnvVariableByName.graphql // _lgraphql/variables/getEnvVariablesByProjectEnvironmentName.graphql @@ -161,26 +155,6 @@ func _lgraphqlAdddeploytargetGraphql() (*asset, error) { return a, nil } -var __lgraphqlAdddeploytargetconfigGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x92\x31\x4f\xfb\x30\x10\xc5\xf7\x7c\x8a\xfb\x57\xff\xa1\x5d\xaa\xc2\x98\x15\x10\x62\x81\x08\x2a\x76\x13\x5f\x12\x23\xf7\x9c\x5e\x6c\x50\x15\xf9\xbb\xa3\xd6\x4d\x52\xa7\x29\x13\x63\x3d\xbe\x7b\xb9\xcb\xef\xe9\xb5\x2d\xa8\x02\x44\xad\xde\x91\x1f\x19\x85\x45\x5e\x57\x82\x5e\xf8\x61\xeb\x84\x86\x25\xcc\x6e\x97\x37\xab\xe5\x6a\x06\xde\x27\x1b\x67\x85\x55\x86\x60\x9e\x00\x00\xfc\xaf\xd9\x7c\x62\x6e\x53\x78\x22\xfb\x2f\x48\xdf\xa8\xca\x2a\x28\x41\xf8\x60\x41\x79\x85\x4d\x0a\x6f\x96\x15\x95\x47\x5f\xed\xb4\x66\xdc\x3a\x6c\xec\x78\x24\xb1\xd6\x66\xb7\x16\x5c\x62\xb4\xfa\x54\xcf\xc2\xe5\x4c\x58\x8b\x4c\xdd\x82\x64\xd1\x1e\xac\x42\xca\xfb\x13\xf3\x9d\xa1\x42\x95\x73\x45\xb5\xb3\x69\x70\xec\x5f\x7c\x27\x5a\xdf\x7b\x3a\x9c\x23\x57\xaf\x0f\x54\x3d\x60\x3f\x8b\xd1\x22\xd2\xc1\xd3\x25\xd7\x65\x38\xf9\x57\x63\xca\x5f\x22\x38\x7c\xef\x17\x03\x9d\x92\x93\x2b\x07\xc3\xc8\xb4\x7f\x24\x36\x18\x09\x05\x2b\x24\xa9\x77\xcf\xe3\x41\xae\x8d\x93\x19\x9b\x2f\x25\x91\xcf\x27\xaf\x58\x2a\x43\xbd\xee\xcf\x72\x9b\x0c\x6b\x94\x7a\x40\x4a\x7c\xd2\xb6\x80\xba\xc1\xbf\x6a\xe0\xe5\x02\x5e\xfb\x77\xed\xdf\x85\xfe\x91\x04\xef\x7f\x02\x00\x00\xff\xff\x06\x39\x95\x1a\x2d\x05\x00\x00") - -func _lgraphqlAdddeploytargetconfigGraphqlBytes() ([]byte, error) { - return bindataRead( - __lgraphqlAdddeploytargetconfigGraphql, - "_lgraphql/addDeployTargetConfig.graphql", - ) -} - -func _lgraphqlAdddeploytargetconfigGraphql() (*asset, error) { - bytes, err := _lgraphqlAdddeploytargetconfigGraphqlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "_lgraphql/addDeployTargetConfig.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - var __lgraphqlAddenvvariableGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x5c\x8e\xb1\xca\xc3\x20\x14\x46\xf7\x3c\xc5\xf7\xc3\x3f\x24\x90\x27\x70\xef\x90\x39\xa5\xfb\x6d\x95\x22\x24\x37\x21\xbd\x06\x42\xe9\xbb\x17\xbd\xda\x4a\x07\x97\x73\xd4\xef\xcc\x41\x48\xfc\xc2\x68\x1b\xe0\x5f\x8e\xd5\x19\x9c\x78\xbf\xd0\xe6\xe9\x3a\xb9\xf3\xb1\xba\xbf\xbe\xa8\xc1\x1a\x0c\x2c\x0a\x1e\xb7\xe5\xe7\xf2\x18\x89\x4a\xa6\xd9\x19\x8c\xb2\x79\xbe\x2b\xd9\x69\x0a\x5f\xd4\xe1\xd9\x00\x00\x59\x5b\x7d\xd0\x7a\x5e\x83\x98\xec\x00\xcd\x49\xd3\x7d\x85\x62\x46\xee\x29\x38\xc7\x68\x54\x81\x1a\x91\x5a\x0a\xca\x15\x5a\x93\xd8\xab\xfb\xcc\x79\x5b\x3d\x54\xd9\xc4\xf3\x0e\x00\x00\xff\xff\x1d\x4f\x13\xd7\x24\x01\x00\x00") func _lgraphqlAddenvvariableGraphqlBytes() ([]byte, error) { @@ -681,46 +655,6 @@ func _lgraphqlProjectbynamemetadataGraphql() (*asset, error) { return a, nil } -var __lgraphqlProjectsbymetadataGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x74\x90\x4d\x4b\xc4\x30\x10\x86\xef\xfd\x15\xe3\xe2\xc1\xbd\x14\xbd\x78\xd8\xa3\xb0\x88\xa0\xb8\xe0\xc7\x7d\x6c\x66\xb7\xd1\x34\x69\x27\x93\x42\x09\xf9\xef\xd2\x76\x4d\x2b\xe2\x9c\x86\x67\xe6\x7d\xe7\x23\x46\xd0\x47\xc0\x56\xbf\x13\xdf\x33\xa1\x10\xbf\xd6\x68\x9f\x79\xdf\x05\x34\x50\xc2\xe6\xa6\xbc\x2d\xaf\x37\x90\x52\xd1\x05\xe2\x01\xae\x0a\x00\x80\xcb\x2f\x1a\x76\xf0\x22\xac\xed\xe9\x62\x26\x3d\x9a\x40\x3f\x6c\x1b\x27\xd8\xb2\xfb\xa4\x4a\xfc\xdd\xf0\x44\x82\x0a\x05\x67\xf9\x18\xcd\x99\xec\x20\x66\x36\xc6\xe4\x3c\xfa\xff\xa2\x67\xf7\x79\x4a\xae\xa4\x29\xdb\x2e\x06\x5a\xe5\xd4\x62\xb3\x34\x62\x10\xf7\xa0\xcc\x02\x3e\x18\x6d\x55\x93\xcf\xa0\x0d\xc6\x30\x75\x81\xbc\xf8\x3f\x3b\x2e\x5d\xec\x54\xa8\x44\x3b\xbb\xb7\xbd\x66\x67\x1b\xb2\x92\xab\xae\x25\xeb\x6b\x7d\x94\xc3\x7c\xf7\x01\x45\x88\x6d\xae\x2b\xea\xc9\xb8\x76\xd4\xac\xe4\xfe\x51\x37\x7a\x31\x39\x69\x79\x63\xf3\xff\xe6\x79\xc8\xfa\x6d\xab\xbb\xe7\x9f\xa4\x22\x15\x31\x02\x59\x05\x29\x7d\x07\x00\x00\xff\xff\x88\xf4\xc3\xb2\xe6\x01\x00\x00") - -func _lgraphqlProjectsbymetadataGraphqlBytes() ([]byte, error) { - return bindataRead( - __lgraphqlProjectsbymetadataGraphql, - "_lgraphql/projectsByMetadata.graphql", - ) -} - -func _lgraphqlProjectsbymetadataGraphql() (*asset, error) { - bytes, err := _lgraphqlProjectsbymetadataGraphqlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "_lgraphql/projectsByMetadata.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var __lgraphqlRemoveprojectmetadatabykeyGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x54\x8d\x31\x0b\xc2\x30\x10\x85\xf7\xfc\x8a\x6b\x71\xb0\x4b\xd1\xc5\x21\xa3\x20\x22\x22\x0a\x8a\xfb\x61\x4e\x8d\x9a\xb4\x1e\x57\xa1\x84\xfc\x77\x69\x2a\x55\x6f\xba\xf7\xc1\xfb\x5e\x08\x60\xcf\x80\xb5\x3d\x12\x2f\x99\x50\x88\x0f\x57\xf4\x5b\x5e\x3c\x1b\x7c\x40\x09\xf9\xb4\x9c\x95\x93\x1c\x62\x54\xae\x11\x14\x5b\x79\x18\x2b\x00\x80\x91\x35\x1a\x56\x5e\xb2\x3e\xdd\xa9\xd5\xb0\x17\xb6\xfe\x92\x15\x21\x31\x26\x57\xbd\x68\xc7\xd5\x8d\x4e\xb2\x21\x41\x83\x82\xf3\x76\x4d\x6d\x6f\xe8\xce\xfa\xba\x11\x1d\x86\x9c\x98\xd1\x9d\xfd\x8f\x25\x7d\x37\x32\xd0\x98\xbe\xe2\x5b\xfd\x69\x78\x74\x34\x04\xf7\x59\x56\x7d\x2b\xaa\x10\x80\xbc\x81\x18\xdf\x01\x00\x00\xff\xff\x82\x2b\x13\x86\xfe\x00\x00\x00") - -func _lgraphqlRemoveprojectmetadatabykeyGraphqlBytes() ([]byte, error) { - return bindataRead( - __lgraphqlRemoveprojectmetadatabykeyGraphql, - "_lgraphql/removeProjectMetadataByKey.graphql", - ) -} - -func _lgraphqlRemoveprojectmetadatabykeyGraphql() (*asset, error) { - bytes, err := _lgraphqlRemoveprojectmetadatabykeyGraphqlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "_lgraphql/removeProjectMetadataByKey.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - var __lgraphqlSshendpointsbyprojectGraphql = []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\x28\x28\xca\xcf\x4a\x4d\x2e\x71\xaa\xf4\x4b\xcc\x4d\xd5\x80\x28\x00\xab\x83\x48\x2b\x28\x64\xa6\x80\x29\x90\x10\x98\x91\x9a\x57\x96\x59\x94\x9f\x97\x9b\x9a\x57\x52\x0c\x55\x02\x57\x84\xa4\x4c\x41\x21\xbf\x20\x35\xaf\x38\x23\x33\xad\x24\x00\x62\x85\x1f\x16\x29\x98\x7e\x24\x13\x14\x14\x8a\x8b\x33\x3c\xf2\x8b\x4b\x90\xf9\x01\xf9\x45\x30\x7e\x2d\x17\x8c\xac\xe5\xaa\xe5\x02\x04\x00\x00\xff\xff\x54\x7c\x7d\xf6\xda\x00\x00\x00") func _lgraphqlSshendpointsbyprojectGraphqlBytes() ([]byte, error) { @@ -741,46 +675,6 @@ func _lgraphqlSshendpointsbyprojectGraphql() (*asset, error) { return a, nil } -var __lgraphqlSwitchactivestandbyGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x3c\x8c\xb1\x8f\x82\x50\x0c\x87\xf7\xfe\x15\xbf\x23\x37\x1c\x0b\xb9\x1b\x8f\xcd\xc1\x38\x3a\x60\xdc\x2b\x54\xa9\x91\x82\xcf\xa2\x31\x2f\xef\x7f\x37\x18\xb0\x43\x93\x7e\xe9\xf7\xc5\x08\x3d\x82\x07\xdd\x4b\xd8\x04\x61\x97\xb0\x6b\xd9\xb6\x61\x7d\x1d\xf9\x82\x02\xd9\x5f\xf1\x5f\xfc\x66\x48\x89\xba\xd1\xd9\xb5\x37\xfc\x10\xf0\x3d\x84\xfe\x2c\xb5\x97\xa8\x3c\xa8\x9d\xbe\x08\xc8\x11\x09\xb8\x3d\xd4\xeb\x76\x55\xbb\xde\xa5\x72\xb6\xe6\xf0\x9c\x04\x40\x6d\x18\xbd\x7c\xff\x4c\xb3\x04\x96\x1b\x30\xee\xa4\xfc\x94\x67\x9c\x68\xd9\xf9\xac\x6a\x43\x13\x48\x14\x23\xc4\x1a\xa4\xf4\x0a\x00\x00\xff\xff\xf9\xe3\xea\x42\xc6\x00\x00\x00") - -func _lgraphqlSwitchactivestandbyGraphqlBytes() ([]byte, error) { - return bindataRead( - __lgraphqlSwitchactivestandbyGraphql, - "_lgraphql/switchActiveStandby.graphql", - ) -} - -func _lgraphqlSwitchactivestandbyGraphql() (*asset, error) { - bytes, err := _lgraphqlSwitchactivestandbyGraphqlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "_lgraphql/switchActiveStandby.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var __lgraphqlTaskbyidGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x3c\x8e\x31\x0f\x82\x30\x10\x85\xf7\xfe\x8a\x27\x61\xc0\x85\xe8\xa8\xa3\x89\x31\x4c\x2e\xc6\xfd\x42\x4f\x6d\xa4\x05\x8e\x62\x42\x9a\xfe\x77\x43\x11\xa7\xfb\xee\xdd\xcb\x97\x0b\x01\xe6\x01\xea\xcc\x9d\xe5\x22\x4c\x9e\xe5\xf6\x22\x77\x95\x73\x3f\x52\x83\x12\xd9\xbe\x3c\x94\xbb\x0c\x31\xaa\x7e\x64\x99\x50\x28\x20\x37\xfa\x88\xca\xf9\x8d\x02\xb6\x41\x01\x9e\x86\xf7\x69\xaa\x74\x31\x1f\x72\xa3\x53\x08\x18\x9d\x86\x23\xcb\x09\xea\xd6\x5a\x72\x4b\x38\x78\xf2\xe3\xb0\xa2\x78\xd6\x6b\xa5\x6b\xf8\xbf\xa5\x97\x16\x6e\xda\xe7\x52\x17\xb6\xad\xe7\xea\xa7\x61\xf9\x98\x7a\xd6\x47\x15\x55\x08\x60\xa7\x11\xe3\x37\x00\x00\xff\xff\xb1\xdc\x9e\x8c\xd8\x00\x00\x00") - -func _lgraphqlTaskbyidGraphqlBytes() ([]byte, error) { - return bindataRead( - __lgraphqlTaskbyidGraphql, - "_lgraphql/taskByID.graphql", - ) -} - -func _lgraphqlTaskbyidGraphql() (*asset, error) { - bytes, err := _lgraphqlTaskbyidGraphqlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "_lgraphql/taskByID.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - var __lgraphqlUpdatedeploytargetGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x91\x41\x6e\xea\x30\x10\x86\xf7\x73\x8a\x79\x12\x0b\x90\x38\x41\xb6\xaf\x8b\xd2\x05\xa0\xd2\x1e\xc0\xc5\x43\xb0\x9a\x78\x22\x67\x52\x09\x55\xdc\xbd\x0a\x24\xb1\x27\xce\x2a\xf1\xff\x8f\xa5\xf1\xf7\xd5\x9d\x18\x71\xec\x71\x0d\x88\x2b\x67\x0b\xdc\x79\xf9\xd7\xff\x7b\x53\x53\x81\x27\x09\xce\x97\xdb\x3e\x38\xb3\x6f\xb9\xa2\xcf\x50\xa9\x58\xf8\x9b\xbc\x4a\x02\x77\x42\xe1\x68\x44\x28\xe8\xa6\x6d\xaf\xaf\xdc\xca\x3c\x3b\x72\xd0\x59\xcd\xde\x09\xf7\xc7\xff\xec\x2f\xae\x2c\xf0\xed\x74\xd8\x3f\xaa\xaf\xce\x55\x76\x57\x9b\x52\x2f\x77\x09\x8e\xbc\xad\x6e\xfb\x6c\xeb\x8a\x3b\x7b\x0c\xfc\xe3\x2c\x85\xbc\x79\xa7\xd2\xf1\xb4\xe4\x06\x7f\x01\x11\xb1\x6b\xac\x11\x7a\xa1\xa6\xe2\xdb\x87\x09\x25\x49\x31\x64\x87\x86\x7c\x7b\x75\x17\x59\x3b\xdf\x74\x52\x0c\x17\x10\x7b\x74\x2b\x67\x87\x53\x63\xe4\x7c\x8d\x25\xe2\x93\xe6\x03\xea\x76\x0a\x53\xa2\x09\xde\x38\x30\xb0\x7d\x32\x9e\xd2\x19\x5f\xcd\x3b\x5e\x9e\x60\x8f\xd8\x55\xf5\x64\x3e\xd2\x8f\x55\xca\x37\x81\x1d\x07\x72\x37\x99\xae\x38\xac\xb5\x28\x4b\x09\x06\xad\x48\x2b\x9b\x8d\x8d\xbe\x52\x7b\xc3\xc4\xfd\xf1\xbd\x6f\x12\x25\x10\xe1\x0f\xbf\xe7\x40\x46\x68\x2c\x52\xae\x91\x3f\x28\x7e\xa0\x90\xc1\x9c\x12\x2c\xbc\x01\xb2\x85\x21\xc7\x01\x0b\x32\x61\x19\x31\x8c\xcf\xbb\xc3\x5f\x00\x00\x00\xff\xff\x7f\xe0\xea\x58\xb0\x03\x00\x00") func _lgraphqlUpdatedeploytargetGraphqlBytes() ([]byte, error) { @@ -821,26 +715,6 @@ func _lgraphqlUpdatedeploytargetconfigGraphql() (*asset, error) { return a, nil } -var __lgraphqlUpdateprojectmetadataGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x64\x8e\xb1\x6e\xc2\x30\x10\x86\x77\x3f\xc5\x35\xea\xd0\x2c\x51\xbb\x74\xf0\x5e\x55\x1d\x2a\x90\x40\xec\xa7\xf8\x20\x86\xc4\x31\xd6\x19\x09\x59\x7e\x77\xe4\x38\x10\x2c\x6e\xf2\x7d\xe7\xbb\xff\x0b\x01\xf4\x1e\xd0\xea\x1d\xb9\x5f\x47\xc8\xe4\xb6\x1d\x9a\x95\xfb\x39\x7b\xec\xa1\x81\xea\xab\xf9\x6e\x3e\x2b\x88\x51\x0c\x9e\x91\xf5\x68\xe0\x43\x00\x00\xbc\x6b\x25\xe1\xcf\xf0\x5b\xee\x4e\x74\x95\xb0\x61\xa7\xcd\x61\x26\x17\xec\x3d\xdd\x59\x1d\x26\xe8\xad\x42\xa6\xb5\x1b\x8f\xd4\xf2\x3f\x31\x2a\x64\xcc\xf7\x52\x69\x63\x3d\xcb\xf0\xe8\x27\xa6\x64\xca\x2a\x98\x45\x6e\x3b\x09\xe5\xc7\x54\x93\x45\x72\x79\x99\xcc\x36\xd9\xaa\x98\x46\x51\xbe\xea\xe5\xec\x53\xac\xc1\x61\x59\x1b\x66\x73\x91\xb7\xa2\x08\x01\xc8\x28\x88\xf1\x16\x00\x00\xff\xff\xa5\x4e\x06\xe0\x51\x01\x00\x00") - -func _lgraphqlUpdateprojectmetadataGraphqlBytes() ([]byte, error) { - return bindataRead( - __lgraphqlUpdateprojectmetadataGraphql, - "_lgraphql/updateProjectMetadata.graphql", - ) -} - -func _lgraphqlUpdateprojectmetadataGraphql() (*asset, error) { - bytes, err := _lgraphqlUpdateprojectmetadataGraphqlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "_lgraphql/updateProjectMetadata.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - var __lgraphqlVariablesAddorupdateenvvariablebynameGraphql = []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\xcc\x2b\x28\x2d\xb1\x52\x70\xcd\x2b\x0b\x4b\x2c\xca\x4c\x4c\xca\x49\x75\xaa\xf4\x4b\xcc\x4d\xf5\x04\x89\x2b\x72\x69\x2a\x54\x73\x29\x28\x28\x28\x24\xa6\xa4\xf8\x17\x85\x16\xa4\x24\x96\xa4\x62\x28\xd5\x80\x9a\x01\x31\x0b\xa6\x03\x04\x32\x53\xe0\xcc\xbc\xc4\xdc\x54\x38\xa7\x2c\x31\xa7\x14\xc1\x2b\x4e\xce\x2f\x80\xf0\x6a\xb9\x6a\xb9\x00\x01\x00\x00\xff\xff\x2e\x2c\x3b\xed\x9f\x00\x00\x00") func _lgraphqlVariablesAddorupdateenvvariablebynameGraphqlBytes() ([]byte, error) { @@ -1494,7 +1368,6 @@ func AssetNames() []string { // _bindata is a table, holding each asset generator, mapped to its name. var _bindata = map[string]func() (*asset, error){ "_lgraphql/addDeployTarget.graphql": _lgraphqlAdddeploytargetGraphql, - "_lgraphql/addDeployTargetConfig.graphql": _lgraphqlAdddeploytargetconfigGraphql, "_lgraphql/addEnvVariable.graphql": _lgraphqlAddenvvariableGraphql, "_lgraphql/addGroup.graphql": _lgraphqlAddgroupGraphql, "_lgraphql/addGroupsToProject.graphql": _lgraphqlAddgroupstoprojectGraphql, @@ -1520,14 +1393,9 @@ var _bindata = map[string]func() (*asset, error){ "_lgraphql/minimalProjectByName.graphql": _lgraphqlMinimalprojectbynameGraphql, "_lgraphql/projectByName.graphql": _lgraphqlProjectbynameGraphql, "_lgraphql/projectByNameMetadata.graphql": _lgraphqlProjectbynamemetadataGraphql, - "_lgraphql/projectsByMetadata.graphql": _lgraphqlProjectsbymetadataGraphql, - "_lgraphql/removeProjectMetadataByKey.graphql": _lgraphqlRemoveprojectmetadatabykeyGraphql, "_lgraphql/sshEndpointsByProject.graphql": _lgraphqlSshendpointsbyprojectGraphql, - "_lgraphql/switchActiveStandby.graphql": _lgraphqlSwitchactivestandbyGraphql, - "_lgraphql/taskByID.graphql": _lgraphqlTaskbyidGraphql, "_lgraphql/updateDeployTarget.graphql": _lgraphqlUpdatedeploytargetGraphql, "_lgraphql/updateDeployTargetConfig.graphql": _lgraphqlUpdatedeploytargetconfigGraphql, - "_lgraphql/updateProjectMetadata.graphql": _lgraphqlUpdateprojectmetadataGraphql, "_lgraphql/variables/addOrUpdateEnvVariableByName.graphql": _lgraphqlVariablesAddorupdateenvvariablebynameGraphql, "_lgraphql/variables/deleteEnvVariableByName.graphql": _lgraphqlVariablesDeleteenvvariablebynameGraphql, "_lgraphql/variables/getEnvVariablesByProjectEnvironmentName.graphql": _lgraphqlVariablesGetenvvariablesbyprojectenvironmentnameGraphql, @@ -1603,7 +1471,6 @@ type bintree struct { var _bintree = &bintree{nil, map[string]*bintree{ "_lgraphql": &bintree{nil, map[string]*bintree{ "addDeployTarget.graphql": &bintree{_lgraphqlAdddeploytargetGraphql, map[string]*bintree{}}, - "addDeployTargetConfig.graphql": &bintree{_lgraphqlAdddeploytargetconfigGraphql, map[string]*bintree{}}, "addEnvVariable.graphql": &bintree{_lgraphqlAddenvvariableGraphql, map[string]*bintree{}}, "addGroup.graphql": &bintree{_lgraphqlAddgroupGraphql, map[string]*bintree{}}, "addGroupsToProject.graphql": &bintree{_lgraphqlAddgroupstoprojectGraphql, map[string]*bintree{}}, @@ -1656,16 +1523,11 @@ var _bintree = &bintree{nil, 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{}}, - "sshEndpointsByProject.graphql": &bintree{_lgraphqlSshendpointsbyprojectGraphql, 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{}}, + "projectByName.graphql": &bintree{_lgraphqlProjectbynameGraphql, map[string]*bintree{}}, + "projectByNameMetadata.graphql": &bintree{_lgraphqlProjectbynamemetadataGraphql, map[string]*bintree{}}, + "sshEndpointsByProject.graphql": &bintree{_lgraphqlSshendpointsbyprojectGraphql, map[string]*bintree{}}, + "updateDeployTarget.graphql": &bintree{_lgraphqlUpdatedeploytargetGraphql, map[string]*bintree{}}, + "updateDeployTargetConfig.graphql": &bintree{_lgraphqlUpdatedeploytargetconfigGraphql, map[string]*bintree{}}, "variables": &bintree{nil, map[string]*bintree{ "addOrUpdateEnvVariableByName.graphql": &bintree{_lgraphqlVariablesAddorupdateenvvariablebynameGraphql, map[string]*bintree{}}, "deleteEnvVariableByName.graphql": &bintree{_lgraphqlVariablesDeleteenvvariablebynameGraphql, map[string]*bintree{}}, diff --git a/internal/lagoon/client/mutation.go b/internal/lagoon/client/mutation.go index 1dba8f61..a4917238 100644 --- a/internal/lagoon/client/mutation.go +++ b/internal/lagoon/client/mutation.go @@ -208,65 +208,6 @@ func (c *Client) DeployEnvironmentBranch(ctx context.Context, return c.client.Run(ctx, req, &out) } -// RunActiveStandbySwitch deploys a branch. -func (c *Client) RunActiveStandbySwitch(ctx context.Context, - project string, out *schema.Task) error { - req, err := c.newVersionedRequest("_lgraphql/switchActiveStandby.graphql", map[string]interface{}{ - "project": project, - }) - if err != nil { - return err - } - - // return c.client.Run(ctx, req, &out) - return c.client.Run(ctx, req, &struct { - Response *schema.Task `json:"switchActiveStandby"` - }{ - Response: out, - }) -} - -// UpdateProjectMetadata updates a projects metadata. -func (c *Client) UpdateProjectMetadata( - ctx context.Context, id int, key string, value string, projects *schema.ProjectMetadata) error { - - req, err := c.newVersionedRequest("_lgraphql/updateProjectMetadata.graphql", - map[string]interface{}{ - "id": id, - "key": key, - "value": value, - }) - if err != nil { - return err - } - - return c.client.Run(ctx, req, &struct { - Response *schema.ProjectMetadata `json:"updateProjectMetadata"` - }{ - Response: projects, - }) -} - -// RemoveProjectMetadataByKey removes metadata from a project for given key. -func (c *Client) RemoveProjectMetadataByKey( - ctx context.Context, id int, key string, projects *schema.ProjectMetadata) error { - - req, err := c.newVersionedRequest("_lgraphql/removeProjectMetadataByKey.graphql", - map[string]interface{}{ - "id": id, - "key": key, - }) - if err != nil { - return err - } - - return c.client.Run(ctx, req, &struct { - Response *schema.ProjectMetadata `json:"removeProjectMetadataByKey"` - }{ - Response: projects, - }) -} - // AddRestore adds a restore. func (c *Client) AddRestore( ctx context.Context, backupID string, out *schema.Restore) error { @@ -284,20 +225,6 @@ func (c *Client) AddRestore( }) } -// AddDeployTargetConfiguration adds a deploytarget configuration to a project. -func (c *Client) AddDeployTargetConfiguration(ctx context.Context, - in *schema.AddDeployTargetConfigInput, out *schema.DeployTargetConfig) error { - req, err := c.newVersionedRequest("_lgraphql/addDeployTargetConfig.graphql", in) - if err != nil { - return err - } - return c.client.Run(ctx, req, &struct { - Response *schema.DeployTargetConfig `json:"addDeployTargetConfig"` - }{ - Response: out, - }) -} - // UpdateDeployTargetConfiguration adds a deploytarget configuration to a project. func (c *Client) UpdateDeployTargetConfiguration(ctx context.Context, in *schema.UpdateDeployTargetConfigInput, out *schema.DeployTargetConfig) error { diff --git a/internal/lagoon/client/query.go b/internal/lagoon/client/query.go index b46ed451..2957d21c 100644 --- a/internal/lagoon/client/query.go +++ b/internal/lagoon/client/query.go @@ -118,26 +118,6 @@ func (c *Client) LagoonSchema( }) } -// GetTaskByID queries the Lagoon API for a task by its ID, and -// unmarshals the response. -func (c *Client) GetTaskByID( - ctx context.Context, id int, task *schema.Task) error { - - req, err := c.newVersionedRequest("_lgraphql/taskByID.graphql", - map[string]interface{}{ - "id": id, - }) - if err != nil { - return err - } - - return c.client.Run(ctx, req, &struct { - Response *schema.Task `json:"taskById"` - }{ - Response: task, - }) -} - // MinimalProjectByName queries the Lagoon API for a project by its name, and // unmarshals the response into project. func (c *Client) MinimalProjectByName( @@ -178,27 +158,6 @@ func (c *Client) ProjectByNameMetadata( }) } -// ProjectsByMetadata queries the Lagoon API for a project by its name, and -// unmarshals the response into project. -func (c *Client) ProjectsByMetadata( - ctx context.Context, key string, value string, projects *[]schema.ProjectMetadata) error { - - req, err := c.newVersionedRequest("_lgraphql/projectsByMetadata.graphql", - map[string]interface{}{ - "key": key, - "value": value, - }) - if err != nil { - return err - } - - return c.client.Run(ctx, req, &struct { - Response *[]schema.ProjectMetadata `json:"projectsByMetadata"` - }{ - Response: projects, - }) -} - // DeployTargetConfigsByProjectID queries the Lagoon API for a projects deploytarget configs by its id, and // unmarshals the response into deploytargetconfigs. func (c *Client) DeployTargetConfigsByProjectID( diff --git a/internal/lagoon/deploytargetconfig.go b/internal/lagoon/deploytargetconfig.go index 29b2b629..35c5ddf5 100644 --- a/internal/lagoon/deploytargetconfig.go +++ b/internal/lagoon/deploytargetconfig.go @@ -11,7 +11,6 @@ import ( // DeployTargetConfigs interface contains methods for getting info on deploytarget configs. type DeployTargetConfigs interface { DeployTargetConfigsByProjectID(ctx context.Context, project int, deployTargets *[]schema.DeployTargetConfig) error - AddDeployTargetConfiguration(ctx context.Context, in *schema.AddDeployTargetConfigInput, deployTargets *schema.DeployTargetConfig) error UpdateDeployTargetConfiguration(ctx context.Context, in *schema.UpdateDeployTargetConfigInput, deployTargets *schema.DeployTargetConfig) error DeleteDeployTargetConfiguration(ctx context.Context, id int, project int, deployTargets *schema.DeleteDeployTargetConfig) error } @@ -22,12 +21,6 @@ func GetDeployTargetConfigs(ctx context.Context, project int, dtc DeployTargetCo return &deployTargets, dtc.DeployTargetConfigsByProjectID(ctx, project, &deployTargets) } -// AddDeployTargetConfiguration adds a deploytarget config to a specific project. -func AddDeployTargetConfiguration(ctx context.Context, in *schema.AddDeployTargetConfigInput, dtc DeployTargetConfigs) (*schema.DeployTargetConfig, error) { - deployTarget := schema.DeployTargetConfig{} - return &deployTarget, dtc.AddDeployTargetConfiguration(ctx, in, &deployTarget) -} - // UpdateDeployTargetConfiguration adds a deploytarget config to a specific project. func UpdateDeployTargetConfiguration(ctx context.Context, in *schema.UpdateDeployTargetConfigInput, dtc DeployTargetConfigs) (*schema.DeployTargetConfig, error) { deployTarget := schema.DeployTargetConfig{} diff --git a/internal/lagoon/projects.go b/internal/lagoon/projects.go index 276b7038..b236ca5f 100644 --- a/internal/lagoon/projects.go +++ b/internal/lagoon/projects.go @@ -12,9 +12,6 @@ import ( type Projects interface { MinimalProjectByName(ctx context.Context, name string, project *schema.Project) error ProjectByNameMetadata(ctx context.Context, name string, project *schema.ProjectMetadata) error - ProjectsByMetadata(ctx context.Context, key string, value string, project *[]schema.ProjectMetadata) error - UpdateProjectMetadata(ctx context.Context, id int, key string, value string, project *schema.ProjectMetadata) error - RemoveProjectMetadataByKey(ctx context.Context, id int, key string, project *schema.ProjectMetadata) error SSHEndpointsByProject(ctx context.Context, name string, project *schema.Project) error } @@ -24,30 +21,12 @@ func GetMinimalProjectByName(ctx context.Context, name string, p Projects) (*sch return &project, p.MinimalProjectByName(ctx, name, &project) } -// GetProjectsByMetadata gets info of projects in lagoon that have matching metadata. -func GetProjectsByMetadata(ctx context.Context, key string, value string, p Projects) (*[]schema.ProjectMetadata, error) { - project := []schema.ProjectMetadata{} - return &project, p.ProjectsByMetadata(ctx, key, value, &project) -} - // GetProjectMetadata gets the metadata key:values for a lagoon project. func GetProjectMetadata(ctx context.Context, name string, p Projects) (*schema.ProjectMetadata, error) { project := schema.ProjectMetadata{} return &project, p.ProjectByNameMetadata(ctx, name, &project) } -// UpdateProjectMetadata updates a project with provided metadata. -func UpdateProjectMetadata(ctx context.Context, id int, key string, value string, p Projects) (*schema.ProjectMetadata, error) { - project := schema.ProjectMetadata{} - return &project, p.UpdateProjectMetadata(ctx, id, key, value, &project) -} - -// RemoveProjectMetadataByKey remove metadata from a project by key. -func RemoveProjectMetadataByKey(ctx context.Context, id int, key string, p Projects) (*schema.ProjectMetadata, error) { - project := schema.ProjectMetadata{} - return &project, p.RemoveProjectMetadataByKey(ctx, id, key, &project) -} - // GetSSHEndpointsByProject gets info of projects in lagoon that have matching metadata. func GetSSHEndpointsByProject(ctx context.Context, name string, p Projects) (*schema.Project, error) { project := schema.Project{} diff --git a/internal/lagoon/tasks.go b/internal/lagoon/tasks.go deleted file mode 100644 index cce1a113..00000000 --- a/internal/lagoon/tasks.go +++ /dev/null @@ -1,27 +0,0 @@ -// Package lagoon implements high-level functions for interacting with the -// Lagoon API. -package lagoon - -import ( - "context" - - "github.com/uselagoon/lagoon-cli/internal/schema" -) - -// Tasks interface contains methods for running tasks in projects and environments in lagoon. -type Tasks interface { - RunActiveStandbySwitch(ctx context.Context, project string, result *schema.Task) error - GetTaskByID(ctx context.Context, id int, result *schema.Task) error -} - -// ActiveStandbySwitch runs the activestandby switch. -func ActiveStandbySwitch(ctx context.Context, project string, t Tasks) (*schema.Task, error) { - result := schema.Task{} - return &result, t.RunActiveStandbySwitch(ctx, project, &result) -} - -// TaskByID returns a task by the associated id -func TaskByID(ctx context.Context, id int, t Tasks) (*schema.Task, error) { - result := schema.Task{} - return &result, t.GetTaskByID(ctx, id, &result) -}