diff --git a/cmd/plural/cd.go b/cmd/plural/cd.go index b6d7b5671..e51382cf5 100644 --- a/cmd/plural/cd.go +++ b/cmd/plural/cd.go @@ -27,6 +27,7 @@ func (p *Plural) cdCommands() []cli.Command { p.cdCredentials(), p.cdClusters(), p.cdServices(), + p.cdContexts(), p.cdRepositories(), p.cdPipelines(), { diff --git a/cmd/plural/cd_contexts.go b/cmd/plural/cd_contexts.go new file mode 100644 index 000000000..3210a17aa --- /dev/null +++ b/cmd/plural/cd_contexts.go @@ -0,0 +1,108 @@ +package plural + +import ( + "encoding/json" + "fmt" + gqlclient "github.com/pluralsh/console-client-go" + "github.com/pluralsh/plural-cli/pkg/console" + "github.com/pluralsh/plural-cli/pkg/utils" + "github.com/urfave/cli" +) + +func (p *Plural) cdContexts() cli.Command { + return cli.Command{ + Name: "contexts", + Subcommands: p.cdServiceContextCommands(), + Usage: "manage CD service contexts", + } +} + +func (p *Plural) cdServiceContextCommands() []cli.Command { + return []cli.Command{ + { + Name: "upsert", + ArgsUsage: "NAME", + Flags: []cli.Flag{ + cli.StringFlag{Name: "config-file", Usage: "path for json configuration file with the context blob", Required: true}, + cli.StringFlag{Name: "name", Usage: "context name", Required: true}, + }, + Action: latestVersion(requireArgs(p.handleUpsertServiceContext, []string{"NAME"})), + Usage: "upsert service context", + }, + { + Name: "get", + ArgsUsage: "NAME", + Action: latestVersion(requireArgs(p.handleGetServiceContext, []string{"NAME"})), + Usage: "get service context", + }, + } +} + +func (p *Plural) handleUpsertServiceContext(c *cli.Context) error { + if err := p.InitConsoleClient(consoleToken, consoleURL); err != nil { + return err + } + + contextName := c.String("name") + serviceContextName := c.Args().Get(0) + attributes := gqlclient.ServiceContextAttributes{} + + configFile, err := utils.ReadFile(c.String("config-file")) + if err != nil { + return err + } + + // validate + conf := map[string]interface{}{} + if err := json.Unmarshal([]byte(configFile), &conf); err != nil { + return err + } + + configuration := map[string]map[string]interface{}{} + configuration[contextName] = conf + + configurationJson, err := json.Marshal(configuration) + if err != nil { + return err + } + configurationJsonString := string(configurationJson) + attributes.Configuration = &configurationJsonString + + sc, err := p.ConsoleClient.SaveServiceContext(serviceContextName, attributes) + if err != nil { + return err + } + if sc == nil { + return fmt.Errorf("the returned object is empty, check if all fields are set") + } + + desc, err := console.DescribeServiceContext(sc) + if err != nil { + return err + } + fmt.Print(desc) + return nil +} + +func (p *Plural) handleGetServiceContext(c *cli.Context) error { + if err := p.InitConsoleClient(consoleToken, consoleURL); err != nil { + return err + } + + contextName := c.Args().Get(0) + + sc, err := p.ConsoleClient.GetServiceContext(contextName) + if err != nil { + return err + } + if sc == nil { + return fmt.Errorf("the returned object is empty, check if all fields are set") + } + + desc, err := console.DescribeServiceContext(sc) + if err != nil { + return err + } + fmt.Print(desc) + return nil +} diff --git a/cmd/plural/cd_services.go b/cmd/plural/cd_services.go index 30115b2d9..59301b915 100644 --- a/cmd/plural/cd_services.go +++ b/cmd/plural/cd_services.go @@ -7,6 +7,7 @@ import ( gqlclient "github.com/pluralsh/console-client-go" "github.com/pluralsh/plural-cli/pkg/console" "github.com/pluralsh/plural-cli/pkg/utils" + "github.com/pluralsh/polly/containers" "github.com/samber/lo" "github.com/urfave/cli" "k8s.io/apimachinery/pkg/util/yaml" @@ -64,6 +65,10 @@ func (p *Plural) cdServiceCommands() []cli.Command { Usage: "config name value", }, cli.BoolFlag{Name: "dry-run", Usage: "dry run mode"}, + cli.StringSliceFlag{ + Name: "context-id", + Usage: "bind service context", + }, }, }, { @@ -111,7 +116,17 @@ func (p *Plural) handleListClusterServices(c *cli.Context) error { } headers := []string{"Id", "Name", "Namespace", "Git Ref", "Git Folder", "Repo"} return utils.PrintTable(sd, headers, func(sd *gqlclient.ServiceDeploymentEdgeFragment) ([]string, error) { - return []string{sd.Node.ID, sd.Node.Name, sd.Node.Namespace, sd.Node.Git.Ref, sd.Node.Git.Folder, sd.Node.Repository.URL}, nil + ref := "" + folder := "" + url := "" + if sd.Node.Git != nil { + ref = sd.Node.Git.Ref + folder = sd.Node.Git.Folder + } + if sd.Node.Repository != nil { + url = sd.Node.Repository.URL + } + return []string{sd.Node.ID, sd.Node.Name, sd.Node.Namespace, ref, folder, url}, nil }) } @@ -249,6 +264,7 @@ func (p *Plural) handleUpdateClusterService(c *cli.Context) error { if err := p.InitConsoleClient(consoleToken, consoleURL); err != nil { return err } + contextBindings := containers.NewSet[string]() serviceId, clusterName, serviceName, err := getServiceIdClusterNameServiceName(c.Args().Get(0)) if err != nil { return err @@ -270,6 +286,10 @@ func (p *Plural) handleUpdateClusterService(c *cli.Context) error { }, Configuration: []*gqlclient.ConfigAttributes{}, } + for _, context := range existing.Contexts { + contextBindings.Add(context.ID) + } + if existing.DryRun != nil { attributes.DryRun = existing.DryRun } @@ -297,6 +317,21 @@ func (p *Plural) handleUpdateClusterService(c *cli.Context) error { if c.IsSet("conf") { confArgs = append(confArgs, c.StringSlice("conf")...) } + var contextArgs []string + if c.IsSet("context-id") { + contextArgs = append(contextArgs, c.StringSlice("context-id")...) + } + for _, context := range contextArgs { + contextBindings.Add(context) + } + if contextBindings.Len() > 0 { + attributes.ContextBindings = make([]*gqlclient.ContextBindingAttributes, 0) + for _, context := range contextBindings.List() { + attributes.ContextBindings = append(attributes.ContextBindings, &gqlclient.ContextBindingAttributes{ + ContextID: context, + }) + } + } updateConfigurations := map[string]string{} for _, conf := range confArgs { diff --git a/go.mod b/go.mod index 0d1287861..eb2738c30 100644 --- a/go.mod +++ b/go.mod @@ -19,7 +19,7 @@ require ( github.com/Azure/go-autorest/autorest v0.11.29 github.com/Masterminds/semver v1.5.0 github.com/Masterminds/sprig/v3 v3.2.3 - github.com/Yamashou/gqlgenc v0.14.0 + github.com/Yamashou/gqlgenc v0.18.1 github.com/aws/aws-sdk-go-v2 v1.18.0 github.com/aws/aws-sdk-go-v2/service/iam v1.19.12 github.com/aws/aws-sdk-go-v2/service/sts v1.19.0 @@ -55,7 +55,7 @@ require ( github.com/packethost/packngo v0.29.0 github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 github.com/pluralsh/cluster-api-migration v0.2.15 - github.com/pluralsh/console-client-go v0.0.80 + github.com/pluralsh/console-client-go v0.0.92 github.com/pluralsh/gqlclient v1.11.0 github.com/pluralsh/plural-operator v0.5.5 github.com/pluralsh/polly v0.1.1 @@ -72,7 +72,7 @@ require ( go.mercari.io/hcledit v0.0.8 golang.org/x/crypto v0.16.0 golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e - golang.org/x/mod v0.10.0 + golang.org/x/mod v0.12.0 golang.org/x/oauth2 v0.8.0 gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v3 v3.0.1 @@ -93,6 +93,7 @@ require ( cloud.google.com/go/compute/metadata v0.2.3 // indirect cloud.google.com/go/container v1.18.1 // indirect cloud.google.com/go/longrunning v0.4.1 // indirect + github.com/99designs/gqlgen v0.17.43 // indirect github.com/Azure/azure-sdk-for-go v68.0.0+incompatible // indirect github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization v1.0.0 // indirect @@ -186,7 +187,7 @@ require ( github.com/google/s2a-go v0.1.3 // indirect github.com/google/safetext v0.0.0-20220905092116-b49f7bc46da2 // indirect github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect - github.com/gorilla/websocket v1.4.2 // indirect + github.com/gorilla/websocket v1.5.0 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect @@ -233,6 +234,7 @@ require ( github.com/sanathkr/go-yaml v0.0.0-20170819195128-ed9d249f429b // indirect github.com/sanathkr/yaml v0.0.0-20170819201035-0056894fa522 // indirect github.com/soheilhy/cmux v0.1.5 // indirect + github.com/sosodev/duration v1.2.0 // indirect github.com/spf13/afero v1.9.5 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/stoewer/go-strcase v1.2.0 // indirect @@ -248,7 +250,7 @@ require ( github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fastjson v1.6.4 // indirect github.com/valyala/fasttemplate v1.2.1 // indirect - github.com/vektah/gqlparser/v2 v2.5.1 // indirect + github.com/vektah/gqlparser/v2 v2.5.11 // indirect github.com/wailsapp/mimetype v1.4.1 // indirect github.com/weaveworks/eksctl v0.143.0 // indirect github.com/weaveworks/goformation/v4 v4.10.2-0.20221208090411-a71cb48c37d5 // indirect @@ -279,7 +281,7 @@ require ( go.uber.org/multierr v1.8.0 // indirect go.uber.org/zap v1.24.0 // indirect golang.org/x/arch v0.3.0 // indirect - golang.org/x/tools v0.9.1 // indirect + golang.org/x/tools v0.13.0 // indirect gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect gopkg.in/cheggaaa/pb.v1 v1.0.28 // indirect @@ -358,7 +360,7 @@ require ( github.com/google/go-cmp v0.6.0 github.com/google/go-querystring v1.1.0 // indirect github.com/google/gofuzz v1.2.0 // indirect - github.com/google/uuid v1.3.1 // indirect + github.com/google/uuid v1.6.0 // indirect github.com/googleapis/gax-go/v2 v2.8.0 // indirect github.com/gorilla/mux v1.8.0 // indirect github.com/gosuri/uitable v0.0.4 // indirect @@ -385,7 +387,7 @@ require ( github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-ieproxy v0.0.1 // indirect - github.com/mattn/go-isatty v0.0.19 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.14 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect @@ -412,10 +414,10 @@ require ( github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect - github.com/rivo/uniseg v0.4.3 // indirect + github.com/rivo/uniseg v0.4.7 // indirect github.com/rubenv/sql-migrate v1.3.1 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect - github.com/schollz/progressbar/v3 v3.8.6 // indirect + github.com/schollz/progressbar/v3 v3.14.1 // indirect github.com/sergi/go-diff v1.3.1 // indirect github.com/shopspring/decimal v1.3.1 // indirect github.com/sirupsen/logrus v1.9.3 @@ -432,9 +434,9 @@ require ( go.opencensus.io v0.24.0 // indirect go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect golang.org/x/net v0.19.0 // indirect - golang.org/x/sync v0.2.0 // indirect - golang.org/x/sys v0.15.0 // indirect - golang.org/x/term v0.15.0 + golang.org/x/sync v0.3.0 // indirect + golang.org/x/sys v0.17.0 // indirect + golang.org/x/term v0.17.0 golang.org/x/text v0.14.0 golang.org/x/time v0.3.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect diff --git a/go.sum b/go.sum index 372734bf5..bbdbfa565 100644 --- a/go.sum +++ b/go.sum @@ -72,6 +72,8 @@ contrib.go.opencensus.io/resource v0.1.1/go.mod h1:F361eGI91LCmW1I/Saf+rX0+OFcig dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/age v1.1.1 h1:pIpO7l151hCnQ4BdyBujnGP2YlUo0uj6sAVNHGBvXHg= filippo.io/age v1.1.1/go.mod h1:l03SrzDUrBkdBx8+IILdnn2KZysqQdbEBUQ4p3sqEQE= +github.com/99designs/gqlgen v0.17.43 h1:I4SYg6ahjowErAQcHFVKy5EcWuwJ3+Xw9z2fLpuFCPo= +github.com/99designs/gqlgen v0.17.43/go.mod h1:lO0Zjy8MkZgBdv4T1U91x09r0e0WFOdhVUutlQs1Rsc= github.com/AlecAivazis/survey/v2 v2.3.5 h1:A8cYupsAZkjaUmhtTYv3sSqc7LO5mp1XDfqe5E/9wRQ= github.com/AlecAivazis/survey/v2 v2.3.5/go.mod h1:4AuI9b7RjAR+G7v9+C4YSlX/YL3K3cWNXgWXOhllqvI= github.com/Azure/azure-amqp-common-go/v2 v2.1.0/go.mod h1:R8rea+gJRuJR6QxTir/XuEd+YuKoUiazDC/N96FiDEU= @@ -200,8 +202,8 @@ github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d/go.mod h1:H github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= -github.com/Yamashou/gqlgenc v0.14.0 h1:KVzUuVQKfl4Phm5Cw4yeFThDAxZoIBR9XLoK/4O1O6U= -github.com/Yamashou/gqlgenc v0.14.0/go.mod h1:+z+FRCtGrNmgTxweAUiCodOmQJLTCNtnRNAqhewf1Q8= +github.com/Yamashou/gqlgenc v0.18.1 h1:oO8Ao2bV6UlGhe6NcTcJRz3RrstfgDCRPwAxrl+urzc= +github.com/Yamashou/gqlgenc v0.18.1/go.mod h1:CwDJlhl8ZEP2mQarkhnqHn/U26ocokGM8hHmxG426NM= github.com/a8m/expect v1.0.0/go.mod h1:4IwSCMumY49ScypDnjNbYEjgVeqy1/U2cEs3Lat96eA= github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk= github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= @@ -896,8 +898,8 @@ github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= -github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/wire v0.3.0/go.mod h1:i1DMg/Lu8Sz5yYl25iOdmc5CT5qusaa+zmRWs16741s= github.com/googleapis/enterprise-certificate-proxy v0.2.3 h1:yk9/cqRKtT9wXZSsRH9aurXEpJX+U6FLtpYTdC3R06k= github.com/googleapis/enterprise-certificate-proxy v0.2.3/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= @@ -923,8 +925,9 @@ github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gosuri/uitable v0.0.4 h1:IG2xLKRvErL3uhY6e1BylFzG+aJiwQviDDTfOKeKTpY= github.com/gosuri/uitable v0.0.4/go.mod h1:tKR86bXuXPZazfOTG1FIzvjIdXzd0mo4Vtn16vt0PJo= github.com/gregjones/httpcache v0.0.0-20170728041850-787624de3eb7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= @@ -1202,8 +1205,8 @@ github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Ky github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= -github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-oci8 v0.1.1/go.mod h1:wjDx6Xm9q7dFtHJvIlrI99JytznLw5wQ4R+9mNXJwGI= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= @@ -1428,8 +1431,8 @@ github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZ github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= github.com/pluralsh/cluster-api-migration v0.2.15 h1:TIfusD+wnhZTGmwNfIlKlKJOT2dE3rUaZawDJw98GjY= github.com/pluralsh/cluster-api-migration v0.2.15/go.mod h1:J6lEvC/70KouikX16mE331cxc3y3sBwtmfHGwZqu06w= -github.com/pluralsh/console-client-go v0.0.80 h1:jL0LE6YnddXz4j6LLBt7hRyIOOhxdVbvC6fvLlm8lMA= -github.com/pluralsh/console-client-go v0.0.80/go.mod h1:u/RjzXE3wtl3L6wiWxwhQHSpxFX46+EYvpkss2mALN4= +github.com/pluralsh/console-client-go v0.0.92 h1:PMSF05Zp5gLejeEWXbwe17CfXNLJ55dGlFPAAVucfCM= +github.com/pluralsh/console-client-go v0.0.92/go.mod h1:eyCiLA44YbXiYyJh8303jk5JdPkt9McgCo5kBjk4lKo= github.com/pluralsh/controller-reconcile-helper v0.0.4 h1:1o+7qYSyoeqKFjx+WgQTxDz4Q2VMpzprJIIKShxqG0E= github.com/pluralsh/controller-reconcile-helper v0.0.4/go.mod h1:AfY0gtteD6veBjmB6jiRx/aR4yevEf6K0M13/pGan/s= github.com/pluralsh/gqlclient v1.11.0 h1:FfXW7FiEJLHOfTAa7NxDb8jb3aMZNIpCAcG+bg8uHYA= @@ -1511,8 +1514,10 @@ github.com/rivo/tview v0.0.0-20230615085408-bb9595ee0f4d h1:meetFLuP+bgn5G55WXzx github.com/rivo/tview v0.0.0-20230615085408-bb9595ee0f4d/go.mod h1:nVwGv4MP47T0jvlk7KuTTjjuSmrGO4JF0iaiNt4bufE= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.3 h1:utMvzDsuh3suAEnhH0RdHmoPbU648o6CvXxTx4SBMOw= github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= +github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= +github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= +github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rodaine/hclencoder v0.0.1 h1:1jK2rGFxSDT1eU9oVjK4ewrIhMWTcc0yCfZMiN6xRJM= github.com/rodaine/hclencoder v0.0.1/go.mod h1:XKt85p0Ifyt0pr1KVeB3eL+dUFAKa+IA637lLahBcOQ= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= @@ -1542,8 +1547,8 @@ github.com/sanathkr/go-yaml v0.0.0-20170819195128-ed9d249f429b/go.mod h1:8458kAa github.com/sanathkr/yaml v0.0.0-20170819201035-0056894fa522 h1:fOCp11H0yuyAt2wqlbJtbyPzSgaxHTv8uN1pMpkG1t8= github.com/sanathkr/yaml v0.0.0-20170819201035-0056894fa522/go.mod h1:tQTYKOQgxoH3v6dEmdHiz4JG+nbxWwM5fgPQUpSZqVQ= github.com/sassoftware/go-rpmutils v0.0.0-20190420191620-a8f1baeba37b/go.mod h1:am+Fp8Bt506lA3Rk3QCmSqmYmLMnPDhdDUcosQCAx+I= -github.com/schollz/progressbar/v3 v3.8.6 h1:QruMUdzZ1TbEP++S1m73OqRJk20ON11m6Wqv4EoGg8c= -github.com/schollz/progressbar/v3 v3.8.6/go.mod h1:W5IEwbJecncFGBvuEh4A7HT1nZZ6WNIL2i3qbnI0WKY= +github.com/schollz/progressbar/v3 v3.14.1 h1:VD+MJPCr4s3wdhTc7OEJ/Z3dAeBzJ7yKH/P4lC5yRTI= +github.com/schollz/progressbar/v3 v3.14.1/go.mod h1:Zc9xXneTzWXF81TGoqL71u0sBPjULtEHYtj/WVgVy8E= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= @@ -1574,6 +1579,8 @@ github.com/soheilhy/cmux v0.1.5-0.20210205191134-5ec6847320e5/go.mod h1:T7TcVDs9 github.com/soheilhy/cmux v0.1.5 h1:jjzc5WVemNEDTLwv9tlmemhC73tI08BNOIGwBOo10Js= github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE1GqG0= github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= +github.com/sosodev/duration v1.2.0 h1:pqK/FLSjsAADWY74SyWDCjOcd5l7H8GSnnOGEB9A1Us= +github.com/sosodev/duration v1.2.0/go.mod h1:RQIBBX0+fMLc/D9+Jb/fwvVmo0eZvDDEERAikUR6SDg= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= @@ -1686,8 +1693,8 @@ github.com/valyala/fastjson v1.6.4/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLr github.com/valyala/fasttemplate v1.2.1 h1:TVEnxayobAdVkhQfrfes2IzOB6o+z4roRkPF52WA1u4= github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= github.com/vektah/gqlparser v1.1.2/go.mod h1:1ycwN7Ij5njmMkPPAOaRFY4rET2Enx7IkVv3vaXspKw= -github.com/vektah/gqlparser/v2 v2.5.1 h1:ZGu+bquAY23jsxDRcYpWjttRZrUz07LbiY77gUOHcr4= -github.com/vektah/gqlparser/v2 v2.5.1/go.mod h1:mPgqFBu/woKTVYWyNk8cO3kh4S/f4aRFZrvOnp3hmCs= +github.com/vektah/gqlparser/v2 v2.5.11 h1:JJxLtXIoN7+3x6MBdtIP59TP1RANnY7pXOaDnADQSf8= +github.com/vektah/gqlparser/v2 v2.5.11/go.mod h1:1rCcfwB2ekJofmluGWXMSEnPMZgbxzwj6FaZ/4OT8Cc= github.com/vektra/mockery v1.1.2 h1:uc0Yn67rJpjt8U/mAZimdCKn9AeA97BOkjpmtBSlfP4= github.com/vektra/mockery v1.1.2/go.mod h1:VcfZjKaFOPO+MpN4ZvwPjs4c48lkq1o3Ym8yHZJu0jU= github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= @@ -1902,7 +1909,6 @@ golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= @@ -1957,8 +1963,8 @@ golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2 golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk= -golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180112015858-5ccada7d0a7b/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -2075,8 +2081,8 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= -golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20180117170059-2c42eef0765b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180224232135-f6cff0780e54/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -2176,7 +2182,6 @@ golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220204135822-1c1b9b1eba6a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -2198,8 +2203,9 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210503060354-a79de5458b56/go.mod h1:tfny5GFUkzUvx4ps4ajbZsCe5lw1metzhBm9T3x7oIY= @@ -2211,8 +2217,9 @@ golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= -golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= -golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= +golang.org/x/term v0.14.0/go.mod h1:TySc+nGkYR6qt8km8wUhuFRTVSMIX3XPR58y2lC8vww= +golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U= +golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20171227012246-e19ae1496984/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -2323,8 +2330,8 @@ golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.9.1 h1:8WMNJAz3zrtPmnYC7ISf5dEn3MT0gY7jBJfw27yrrLo= -golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= +golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/hack/gen-client-mocks.sh b/hack/gen-client-mocks.sh index 8d1ae526e..c48cf74ee 100755 --- a/hack/gen-client-mocks.sh +++ b/hack/gen-client-mocks.sh @@ -6,7 +6,7 @@ cd $(dirname $0)/.. source hack/lib.sh -CONTAINERIZE_IMAGE=golang:1.21.1 containerize ./hack/gen-client-mocks.sh +CONTAINERIZE_IMAGE=golang:1.22.0 containerize ./hack/gen-client-mocks.sh go run github.com/vektra/mockery/v2@latest --dir=pkg/api/ --name=Client --output=pkg/test/mocks go run github.com/vektra/mockery/v2@latest --dir=pkg/kubernetes --name=Kube --output=pkg/test/mocks diff --git a/pkg/console/console.go b/pkg/console/console.go index bb3d27eb4..c656834c1 100644 --- a/pkg/console/console.go +++ b/pkg/console/console.go @@ -10,7 +10,7 @@ import ( type consoleClient struct { ctx context.Context - client *consoleclient.Client + client consoleclient.ConsoleClient url string token string } @@ -40,16 +40,34 @@ type ConsoleClient interface { CreateCluster(attributes consoleclient.ClusterAttributes) (*consoleclient.CreateCluster, error) CreateProvider(attr consoleclient.ClusterProviderAttributes) (*consoleclient.CreateClusterProvider, error) MyCluster() (*consoleclient.MyCluster, error) + SaveServiceContext(name string, attributes consoleclient.ServiceContextAttributes) (*consoleclient.ServiceContextFragment, error) + GetServiceContext(name string) (*consoleclient.ServiceContextFragment, error) +} + +type authedTransport struct { + token string + wrapped http.RoundTripper +} + +func (t *authedTransport) RoundTrip(req *http.Request) (*http.Response, error) { + req.Header.Set("Authorization", "Token "+t.token) + return t.wrapped.RoundTrip(req) } func NewConsoleClient(token, url string) (ConsoleClient, error) { + + httpClient := http.Client{ + Transport: &authedTransport{ + token: token, + wrapped: http.DefaultTransport, + }, + } + return &consoleClient{ - url: url, - token: token, - client: consoleclient.NewClient(http.DefaultClient, fmt.Sprintf("%s/gql", url), func(req *http.Request) { - req.Header.Set("Authorization", fmt.Sprintf("Token %s", token)) - }), - ctx: context.Background(), + url: url, + token: token, + client: consoleclient.NewClient(&httpClient, fmt.Sprintf("%s/gql", url), nil), + ctx: context.Background(), }, nil } diff --git a/pkg/console/contexts.go b/pkg/console/contexts.go new file mode 100644 index 000000000..2975c27dd --- /dev/null +++ b/pkg/console/contexts.go @@ -0,0 +1,30 @@ +package console + +import ( + "fmt" + + gqlclient "github.com/pluralsh/console-client-go" + "github.com/pluralsh/plural-cli/pkg/api" +) + +func (c *consoleClient) SaveServiceContext(name string, attributes gqlclient.ServiceContextAttributes) (*gqlclient.ServiceContextFragment, error) { + result, err := c.client.SaveServiceContext(c.ctx, name, attributes) + if err != nil { + return nil, api.GetErrorResponse(err, "SaveServiceContext") + } + if result == nil { + return nil, fmt.Errorf("the result from SaveServiceContext is null") + } + return result.SaveServiceContext, nil +} + +func (c *consoleClient) GetServiceContext(name string) (*gqlclient.ServiceContextFragment, error) { + result, err := c.client.GetServiceContext(c.ctx, name) + if err != nil { + return nil, api.GetErrorResponse(err, "GetServiceContext") + } + if result == nil { + return nil, fmt.Errorf("the result from GetServiceContext is null") + } + return result.ServiceContext, nil +} diff --git a/pkg/console/describe.go b/pkg/console/describe.go index 142349108..b02caa9b6 100644 --- a/pkg/console/describe.go +++ b/pkg/console/describe.go @@ -2,6 +2,7 @@ package console import ( "bytes" + "encoding/json" "fmt" "io" "sort" @@ -21,6 +22,20 @@ const ( LEVEL_4 ) +func DescribeServiceContext(sc *consoleclient.ServiceContextFragment) (string, error) { + return tabbedString(func(out io.Writer) error { + w := NewPrefixWriter(out) + w.Write(LEVEL_0, "Id:\t%s\n", sc.ID) + w.Write(LEVEL_0, "Configuration:\n \tName\tContext\n") + w.Write(LEVEL_1, "\t----\t------\n") + for name, value := range sc.Configuration { + configurationJson, _ := json.Marshal(value) + w.Write(LEVEL_1, "\t%v \t%v\n", name, string(configurationJson)) + } + return nil + }) +} + func DescribeCluster(cluster *consoleclient.ClusterFragment) (string, error) { return tabbedString(func(out io.Writer) error { w := NewPrefixWriter(out) diff --git a/pkg/test/mocks/Client.go b/pkg/test/mocks/Client.go index 9ceed0585..c8d420a7f 100644 --- a/pkg/test/mocks/Client.go +++ b/pkg/test/mocks/Client.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.36.1. DO NOT EDIT. +// Code generated by mockery v2.41.0. DO NOT EDIT. package mocks @@ -18,6 +18,10 @@ type Client struct { func (_m *Client) AcquireLock(repo string) (*api.ApplyLock, error) { ret := _m.Called(repo) + if len(ret) == 0 { + panic("no return value specified for AcquireLock") + } + var r0 *api.ApplyLock var r1 error if rf, ok := ret.Get(0).(func(string) (*api.ApplyLock, error)); ok { @@ -44,6 +48,10 @@ func (_m *Client) AcquireLock(repo string) (*api.ApplyLock, error) { func (_m *Client) Chat(history []*api.ChatMessage) (*api.ChatMessage, error) { ret := _m.Called(history) + if len(ret) == 0 { + panic("no return value specified for Chat") + } + var r0 *api.ChatMessage var r1 error if rf, ok := ret.Get(0).(func([]*api.ChatMessage) (*api.ChatMessage, error)); ok { @@ -70,6 +78,10 @@ func (_m *Client) Chat(history []*api.ChatMessage) (*api.ChatMessage, error) { func (_m *Client) Cluster(id string) (*api.Cluster, error) { ret := _m.Called(id) + if len(ret) == 0 { + panic("no return value specified for Cluster") + } + var r0 *api.Cluster var r1 error if rf, ok := ret.Get(0).(func(string) (*api.Cluster, error)); ok { @@ -96,6 +108,10 @@ func (_m *Client) Cluster(id string) (*api.Cluster, error) { func (_m *Client) Clusters() ([]*api.Cluster, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Clusters") + } + var r0 []*api.Cluster var r1 error if rf, ok := ret.Get(0).(func() ([]*api.Cluster, error)); ok { @@ -122,6 +138,10 @@ func (_m *Client) Clusters() ([]*api.Cluster, error) { func (_m *Client) CreateAccessToken() (string, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for CreateAccessToken") + } + var r0 string var r1 error if rf, ok := ret.Get(0).(func() (string, error)); ok { @@ -146,6 +166,10 @@ func (_m *Client) CreateAccessToken() (string, error) { func (_m *Client) CreateArtifact(repo string, attrs api.ArtifactAttributes) (api.Artifact, error) { ret := _m.Called(repo, attrs) + if len(ret) == 0 { + panic("no return value specified for CreateArtifact") + } + var r0 api.Artifact var r1 error if rf, ok := ret.Get(0).(func(string, api.ArtifactAttributes) (api.Artifact, error)); ok { @@ -170,6 +194,10 @@ func (_m *Client) CreateArtifact(repo string, attrs api.ArtifactAttributes) (api func (_m *Client) CreateCrd(repo string, chart string, file string) error { ret := _m.Called(repo, chart, file) + if len(ret) == 0 { + panic("no return value specified for CreateCrd") + } + var r0 error if rf, ok := ret.Get(0).(func(string, string, string) error); ok { r0 = rf(repo, chart, file) @@ -184,6 +212,10 @@ func (_m *Client) CreateCrd(repo string, chart string, file string) error { func (_m *Client) CreateDependency(source string, dest string) error { ret := _m.Called(source, dest) + if len(ret) == 0 { + panic("no return value specified for CreateDependency") + } + var r0 error if rf, ok := ret.Get(0).(func(string, string) error); ok { r0 = rf(source, dest) @@ -198,6 +230,10 @@ func (_m *Client) CreateDependency(source string, dest string) error { func (_m *Client) CreateDomain(name string) error { ret := _m.Called(name) + if len(ret) == 0 { + panic("no return value specified for CreateDomain") + } + var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { r0 = rf(name) @@ -212,6 +248,10 @@ func (_m *Client) CreateDomain(name string) error { func (_m *Client) CreateEvent(event *api.UserEventAttributes) error { ret := _m.Called(event) + if len(ret) == 0 { + panic("no return value specified for CreateEvent") + } + var r0 error if rf, ok := ret.Get(0).(func(*api.UserEventAttributes) error); ok { r0 = rf(event) @@ -226,6 +266,10 @@ func (_m *Client) CreateEvent(event *api.UserEventAttributes) error { func (_m *Client) CreateInstallation(id string) (string, error) { ret := _m.Called(id) + if len(ret) == 0 { + panic("no return value specified for CreateInstallation") + } + var r0 string var r1 error if rf, ok := ret.Get(0).(func(string) (string, error)); ok { @@ -250,6 +294,10 @@ func (_m *Client) CreateInstallation(id string) (string, error) { func (_m *Client) CreateKey(name string, content string) error { ret := _m.Called(name, content) + if len(ret) == 0 { + panic("no return value specified for CreateKey") + } + var r0 error if rf, ok := ret.Get(0).(func(string, string) error); ok { r0 = rf(name, content) @@ -264,6 +312,10 @@ func (_m *Client) CreateKey(name string, content string) error { func (_m *Client) CreateKeyBackup(attrs api.KeyBackupAttributes) error { ret := _m.Called(attrs) + if len(ret) == 0 { + panic("no return value specified for CreateKeyBackup") + } + var r0 error if rf, ok := ret.Get(0).(func(api.KeyBackupAttributes) error); ok { r0 = rf(attrs) @@ -278,6 +330,10 @@ func (_m *Client) CreateKeyBackup(attrs api.KeyBackupAttributes) error { func (_m *Client) CreateRecipe(repoName string, attrs gqlclient.RecipeAttributes) (string, error) { ret := _m.Called(repoName, attrs) + if len(ret) == 0 { + panic("no return value specified for CreateRecipe") + } + var r0 string var r1 error if rf, ok := ret.Get(0).(func(string, gqlclient.RecipeAttributes) (string, error)); ok { @@ -302,6 +358,10 @@ func (_m *Client) CreateRecipe(repoName string, attrs gqlclient.RecipeAttributes func (_m *Client) CreateRepository(name string, publisher string, input *gqlclient.RepositoryAttributes) error { ret := _m.Called(name, publisher, input) + if len(ret) == 0 { + panic("no return value specified for CreateRepository") + } + var r0 error if rf, ok := ret.Get(0).(func(string, string, *gqlclient.RepositoryAttributes) error); ok { r0 = rf(name, publisher, input) @@ -316,6 +376,10 @@ func (_m *Client) CreateRepository(name string, publisher string, input *gqlclie func (_m *Client) CreateStack(attributes gqlclient.StackAttributes) (string, error) { ret := _m.Called(attributes) + if len(ret) == 0 { + panic("no return value specified for CreateStack") + } + var r0 string var r1 error if rf, ok := ret.Get(0).(func(gqlclient.StackAttributes) (string, error)); ok { @@ -340,6 +404,10 @@ func (_m *Client) CreateStack(attributes gqlclient.StackAttributes) (string, err func (_m *Client) CreateTrust(issuer string, trust string) error { ret := _m.Called(issuer, trust) + if len(ret) == 0 { + panic("no return value specified for CreateTrust") + } + var r0 error if rf, ok := ret.Get(0).(func(string, string) error); ok { r0 = rf(issuer, trust) @@ -354,6 +422,10 @@ func (_m *Client) CreateTrust(issuer string, trust string) error { func (_m *Client) CreateUpgrade(queue string, repository string, attrs gqlclient.UpgradeAttributes) error { ret := _m.Called(queue, repository, attrs) + if len(ret) == 0 { + panic("no return value specified for CreateUpgrade") + } + var r0 error if rf, ok := ret.Get(0).(func(string, string, gqlclient.UpgradeAttributes) error); ok { r0 = rf(queue, repository, attrs) @@ -368,6 +440,10 @@ func (_m *Client) CreateUpgrade(queue string, repository string, attrs gqlclient func (_m *Client) DeleteEabCredential(cluster string, provider string) error { ret := _m.Called(cluster, provider) + if len(ret) == 0 { + panic("no return value specified for DeleteEabCredential") + } + var r0 error if rf, ok := ret.Get(0).(func(string, string) error); ok { r0 = rf(cluster, provider) @@ -382,6 +458,10 @@ func (_m *Client) DeleteEabCredential(cluster string, provider string) error { func (_m *Client) DeleteInstallation(id string) error { ret := _m.Called(id) + if len(ret) == 0 { + panic("no return value specified for DeleteInstallation") + } + var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { r0 = rf(id) @@ -396,6 +476,10 @@ func (_m *Client) DeleteInstallation(id string) error { func (_m *Client) DeleteShell() error { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for DeleteShell") + } + var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() @@ -410,6 +494,10 @@ func (_m *Client) DeleteShell() error { func (_m *Client) DeleteTrust(id string) error { ret := _m.Called(id) + if len(ret) == 0 { + panic("no return value specified for DeleteTrust") + } + var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { r0 = rf(id) @@ -424,6 +512,10 @@ func (_m *Client) DeleteTrust(id string) error { func (_m *Client) DestroyCluster(domain string, name string, provider string) error { ret := _m.Called(domain, name, provider) + if len(ret) == 0 { + panic("no return value specified for DestroyCluster") + } + var r0 error if rf, ok := ret.Get(0).(func(string, string, string) error); ok { r0 = rf(domain, name, provider) @@ -438,6 +530,10 @@ func (_m *Client) DestroyCluster(domain string, name string, provider string) er func (_m *Client) DeviceLogin() (*api.DeviceLogin, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for DeviceLogin") + } + var r0 *api.DeviceLogin var r1 error if rf, ok := ret.Get(0).(func() (*api.DeviceLogin, error)); ok { @@ -464,6 +560,10 @@ func (_m *Client) DeviceLogin() (*api.DeviceLogin, error) { func (_m *Client) GetChartInstallations(repoId string) ([]*api.ChartInstallation, error) { ret := _m.Called(repoId) + if len(ret) == 0 { + panic("no return value specified for GetChartInstallations") + } + var r0 []*api.ChartInstallation var r1 error if rf, ok := ret.Get(0).(func(string) ([]*api.ChartInstallation, error)); ok { @@ -490,6 +590,10 @@ func (_m *Client) GetChartInstallations(repoId string) ([]*api.ChartInstallation func (_m *Client) GetCharts(repoId string) ([]*api.Chart, error) { ret := _m.Called(repoId) + if len(ret) == 0 { + panic("no return value specified for GetCharts") + } + var r0 []*api.Chart var r1 error if rf, ok := ret.Get(0).(func(string) ([]*api.Chart, error)); ok { @@ -516,6 +620,10 @@ func (_m *Client) GetCharts(repoId string) ([]*api.Chart, error) { func (_m *Client) GetEabCredential(cluster string, provider string) (*api.EabCredential, error) { ret := _m.Called(cluster, provider) + if len(ret) == 0 { + panic("no return value specified for GetEabCredential") + } + var r0 *api.EabCredential var r1 error if rf, ok := ret.Get(0).(func(string, string) (*api.EabCredential, error)); ok { @@ -542,6 +650,10 @@ func (_m *Client) GetEabCredential(cluster string, provider string) (*api.EabCre func (_m *Client) GetHelp(prompt string) (string, error) { ret := _m.Called(prompt) + if len(ret) == 0 { + panic("no return value specified for GetHelp") + } + var r0 string var r1 error if rf, ok := ret.Get(0).(func(string) (string, error)); ok { @@ -566,6 +678,10 @@ func (_m *Client) GetHelp(prompt string) (string, error) { func (_m *Client) GetInstallation(name string) (*api.Installation, error) { ret := _m.Called(name) + if len(ret) == 0 { + panic("no return value specified for GetInstallation") + } + var r0 *api.Installation var r1 error if rf, ok := ret.Get(0).(func(string) (*api.Installation, error)); ok { @@ -592,6 +708,10 @@ func (_m *Client) GetInstallation(name string) (*api.Installation, error) { func (_m *Client) GetInstallationById(id string) (*api.Installation, error) { ret := _m.Called(id) + if len(ret) == 0 { + panic("no return value specified for GetInstallationById") + } + var r0 *api.Installation var r1 error if rf, ok := ret.Get(0).(func(string) (*api.Installation, error)); ok { @@ -618,6 +738,10 @@ func (_m *Client) GetInstallationById(id string) (*api.Installation, error) { func (_m *Client) GetInstallations() ([]*api.Installation, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetInstallations") + } + var r0 []*api.Installation var r1 error if rf, ok := ret.Get(0).(func() ([]*api.Installation, error)); ok { @@ -644,6 +768,10 @@ func (_m *Client) GetInstallations() ([]*api.Installation, error) { func (_m *Client) GetKeyBackup(name string) (*api.KeyBackup, error) { ret := _m.Called(name) + if len(ret) == 0 { + panic("no return value specified for GetKeyBackup") + } + var r0 *api.KeyBackup var r1 error if rf, ok := ret.Get(0).(func(string) (*api.KeyBackup, error)); ok { @@ -670,6 +798,10 @@ func (_m *Client) GetKeyBackup(name string) (*api.KeyBackup, error) { func (_m *Client) GetPackageInstallations(repoId string) ([]*api.ChartInstallation, []*api.TerraformInstallation, error) { ret := _m.Called(repoId) + if len(ret) == 0 { + panic("no return value specified for GetPackageInstallations") + } + var r0 []*api.ChartInstallation var r1 []*api.TerraformInstallation var r2 error @@ -705,6 +837,10 @@ func (_m *Client) GetPackageInstallations(repoId string) ([]*api.ChartInstallati func (_m *Client) GetRecipe(repo string, name string) (*api.Recipe, error) { ret := _m.Called(repo, name) + if len(ret) == 0 { + panic("no return value specified for GetRecipe") + } + var r0 *api.Recipe var r1 error if rf, ok := ret.Get(0).(func(string, string) (*api.Recipe, error)); ok { @@ -731,6 +867,10 @@ func (_m *Client) GetRecipe(repo string, name string) (*api.Recipe, error) { func (_m *Client) GetRecipeByID(id string) (*api.Recipe, error) { ret := _m.Called(id) + if len(ret) == 0 { + panic("no return value specified for GetRecipeByID") + } + var r0 *api.Recipe var r1 error if rf, ok := ret.Get(0).(func(string) (*api.Recipe, error)); ok { @@ -757,6 +897,10 @@ func (_m *Client) GetRecipeByID(id string) (*api.Recipe, error) { func (_m *Client) GetRepository(repo string) (*api.Repository, error) { ret := _m.Called(repo) + if len(ret) == 0 { + panic("no return value specified for GetRepository") + } + var r0 *api.Repository var r1 error if rf, ok := ret.Get(0).(func(string) (*api.Repository, error)); ok { @@ -783,6 +927,10 @@ func (_m *Client) GetRepository(repo string) (*api.Repository, error) { func (_m *Client) GetShell() (api.CloudShell, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetShell") + } + var r0 api.CloudShell var r1 error if rf, ok := ret.Get(0).(func() (api.CloudShell, error)); ok { @@ -807,6 +955,10 @@ func (_m *Client) GetShell() (api.CloudShell, error) { func (_m *Client) GetStack(name string, provider string) (*api.Stack, error) { ret := _m.Called(name, provider) + if len(ret) == 0 { + panic("no return value specified for GetStack") + } + var r0 *api.Stack var r1 error if rf, ok := ret.Get(0).(func(string, string) (*api.Stack, error)); ok { @@ -833,6 +985,10 @@ func (_m *Client) GetStack(name string, provider string) (*api.Stack, error) { func (_m *Client) GetTerraform(repoId string) ([]*api.Terraform, error) { ret := _m.Called(repoId) + if len(ret) == 0 { + panic("no return value specified for GetTerraform") + } + var r0 []*api.Terraform var r1 error if rf, ok := ret.Get(0).(func(string) ([]*api.Terraform, error)); ok { @@ -859,6 +1015,10 @@ func (_m *Client) GetTerraform(repoId string) ([]*api.Terraform, error) { func (_m *Client) GetTerraformInstallations(repoId string) ([]*api.TerraformInstallation, error) { ret := _m.Called(repoId) + if len(ret) == 0 { + panic("no return value specified for GetTerraformInstallations") + } + var r0 []*api.TerraformInstallation var r1 error if rf, ok := ret.Get(0).(func(string) ([]*api.TerraformInstallation, error)); ok { @@ -885,6 +1045,10 @@ func (_m *Client) GetTerraformInstallations(repoId string) ([]*api.TerraformInst func (_m *Client) GetTerraformVersions(id string) ([]*api.Version, error) { ret := _m.Called(id) + if len(ret) == 0 { + panic("no return value specified for GetTerraformVersions") + } + var r0 []*api.Version var r1 error if rf, ok := ret.Get(0).(func(string) ([]*api.Version, error)); ok { @@ -911,6 +1075,10 @@ func (_m *Client) GetTerraformVersions(id string) ([]*api.Version, error) { func (_m *Client) GetTfProviderScaffold(name string, version string) (string, error) { ret := _m.Called(name, version) + if len(ret) == 0 { + panic("no return value specified for GetTfProviderScaffold") + } + var r0 string var r1 error if rf, ok := ret.Get(0).(func(string, string) (string, error)); ok { @@ -935,6 +1103,10 @@ func (_m *Client) GetTfProviderScaffold(name string, version string) (string, er func (_m *Client) GetTfProviders() ([]string, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetTfProviders") + } + var r0 []string var r1 error if rf, ok := ret.Get(0).(func() ([]string, error)); ok { @@ -961,6 +1133,10 @@ func (_m *Client) GetTfProviders() ([]string, error) { func (_m *Client) GetVersions(chartId string) ([]*api.Version, error) { ret := _m.Called(chartId) + if len(ret) == 0 { + panic("no return value specified for GetVersions") + } + var r0 []*api.Version var r1 error if rf, ok := ret.Get(0).(func(string) ([]*api.Version, error)); ok { @@ -987,6 +1163,10 @@ func (_m *Client) GetVersions(chartId string) ([]*api.Version, error) { func (_m *Client) GrabAccessToken() (string, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GrabAccessToken") + } + var r0 string var r1 error if rf, ok := ret.Get(0).(func() (string, error)); ok { @@ -1011,6 +1191,10 @@ func (_m *Client) GrabAccessToken() (string, error) { func (_m *Client) ImpersonateServiceAccount(email string) (string, string, error) { ret := _m.Called(email) + if len(ret) == 0 { + panic("no return value specified for ImpersonateServiceAccount") + } + var r0 string var r1 string var r2 error @@ -1042,6 +1226,10 @@ func (_m *Client) ImpersonateServiceAccount(email string) (string, string, error func (_m *Client) InstallRecipe(id string) error { ret := _m.Called(id) + if len(ret) == 0 { + panic("no return value specified for InstallRecipe") + } + var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { r0 = rf(id) @@ -1056,6 +1244,10 @@ func (_m *Client) InstallRecipe(id string) error { func (_m *Client) InstallVersion(tp string, repo string, pkg string, vsn string) error { ret := _m.Called(tp, repo, pkg, vsn) + if len(ret) == 0 { + panic("no return value specified for InstallVersion") + } + var r0 error if rf, ok := ret.Get(0).(func(string, string, string, string) error); ok { r0 = rf(tp, repo, pkg, vsn) @@ -1070,6 +1262,10 @@ func (_m *Client) InstallVersion(tp string, repo string, pkg string, vsn string) func (_m *Client) ListArtifacts(repo string) ([]api.Artifact, error) { ret := _m.Called(repo) + if len(ret) == 0 { + panic("no return value specified for ListArtifacts") + } + var r0 []api.Artifact var r1 error if rf, ok := ret.Get(0).(func(string) ([]api.Artifact, error)); ok { @@ -1096,6 +1292,10 @@ func (_m *Client) ListArtifacts(repo string) ([]api.Artifact, error) { func (_m *Client) ListKeyBackups() ([]*api.KeyBackup, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ListKeyBackups") + } + var r0 []*api.KeyBackup var r1 error if rf, ok := ret.Get(0).(func() ([]*api.KeyBackup, error)); ok { @@ -1122,6 +1322,10 @@ func (_m *Client) ListKeyBackups() ([]*api.KeyBackup, error) { func (_m *Client) ListKeys(emails []string) ([]*api.PublicKey, error) { ret := _m.Called(emails) + if len(ret) == 0 { + panic("no return value specified for ListKeys") + } + var r0 []*api.PublicKey var r1 error if rf, ok := ret.Get(0).(func([]string) ([]*api.PublicKey, error)); ok { @@ -1148,6 +1352,10 @@ func (_m *Client) ListKeys(emails []string) ([]*api.PublicKey, error) { func (_m *Client) ListRecipes(repo string, provider string) ([]*api.Recipe, error) { ret := _m.Called(repo, provider) + if len(ret) == 0 { + panic("no return value specified for ListRecipes") + } + var r0 []*api.Recipe var r1 error if rf, ok := ret.Get(0).(func(string, string) ([]*api.Recipe, error)); ok { @@ -1174,6 +1382,10 @@ func (_m *Client) ListRecipes(repo string, provider string) ([]*api.Recipe, erro func (_m *Client) ListRepositories(query string) ([]*api.Repository, error) { ret := _m.Called(query) + if len(ret) == 0 { + panic("no return value specified for ListRepositories") + } + var r0 []*api.Repository var r1 error if rf, ok := ret.Get(0).(func(string) ([]*api.Repository, error)); ok { @@ -1200,6 +1412,10 @@ func (_m *Client) ListRepositories(query string) ([]*api.Repository, error) { func (_m *Client) ListStacks(featured bool) ([]*api.Stack, error) { ret := _m.Called(featured) + if len(ret) == 0 { + panic("no return value specified for ListStacks") + } + var r0 []*api.Stack var r1 error if rf, ok := ret.Get(0).(func(bool) ([]*api.Stack, error)); ok { @@ -1226,6 +1442,10 @@ func (_m *Client) ListStacks(featured bool) ([]*api.Stack, error) { func (_m *Client) Login(email string, pwd string) (string, error) { ret := _m.Called(email, pwd) + if len(ret) == 0 { + panic("no return value specified for Login") + } + var r0 string var r1 error if rf, ok := ret.Get(0).(func(string, string) (string, error)); ok { @@ -1250,6 +1470,10 @@ func (_m *Client) Login(email string, pwd string) (string, error) { func (_m *Client) LoginMethod(email string) (*api.LoginMethod, error) { ret := _m.Called(email) + if len(ret) == 0 { + panic("no return value specified for LoginMethod") + } + var r0 *api.LoginMethod var r1 error if rf, ok := ret.Get(0).(func(string) (*api.LoginMethod, error)); ok { @@ -1276,6 +1500,10 @@ func (_m *Client) LoginMethod(email string) (*api.LoginMethod, error) { func (_m *Client) MarkSynced(repo string) error { ret := _m.Called(repo) + if len(ret) == 0 { + panic("no return value specified for MarkSynced") + } + var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { r0 = rf(repo) @@ -1290,6 +1518,10 @@ func (_m *Client) MarkSynced(repo string) error { func (_m *Client) Me() (*api.Me, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Me") + } + var r0 *api.Me var r1 error if rf, ok := ret.Get(0).(func() (*api.Me, error)); ok { @@ -1316,6 +1548,10 @@ func (_m *Client) Me() (*api.Me, error) { func (_m *Client) OIDCProvider(id string, attributes *api.OidcProviderAttributes) error { ret := _m.Called(id, attributes) + if len(ret) == 0 { + panic("no return value specified for OIDCProvider") + } + var r0 error if rf, ok := ret.Get(0).(func(string, *api.OidcProviderAttributes) error); ok { r0 = rf(id, attributes) @@ -1330,6 +1566,10 @@ func (_m *Client) OIDCProvider(id string, attributes *api.OidcProviderAttributes func (_m *Client) OidcToken(provider gqlclient.ExternalOidcProvider, token string, email string) (string, error) { ret := _m.Called(provider, token, email) + if len(ret) == 0 { + panic("no return value specified for OidcToken") + } + var r0 string var r1 error if rf, ok := ret.Get(0).(func(gqlclient.ExternalOidcProvider, string, string) (string, error)); ok { @@ -1354,6 +1594,10 @@ func (_m *Client) OidcToken(provider gqlclient.ExternalOidcProvider, token strin func (_m *Client) PollLoginToken(token string) (string, error) { ret := _m.Called(token) + if len(ret) == 0 { + panic("no return value specified for PollLoginToken") + } + var r0 string var r1 error if rf, ok := ret.Get(0).(func(string) (string, error)); ok { @@ -1378,6 +1622,10 @@ func (_m *Client) PollLoginToken(token string) (string, error) { func (_m *Client) PromoteCluster() error { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for PromoteCluster") + } + var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() @@ -1392,6 +1640,10 @@ func (_m *Client) PromoteCluster() error { func (_m *Client) Release(name string, tags []string) error { ret := _m.Called(name, tags) + if len(ret) == 0 { + panic("no return value specified for Release") + } + var r0 error if rf, ok := ret.Get(0).(func(string, []string) error); ok { r0 = rf(name, tags) @@ -1406,6 +1658,10 @@ func (_m *Client) Release(name string, tags []string) error { func (_m *Client) ReleaseLock(repo string, lock string) (*api.ApplyLock, error) { ret := _m.Called(repo, lock) + if len(ret) == 0 { + panic("no return value specified for ReleaseLock") + } + var r0 *api.ApplyLock var r1 error if rf, ok := ret.Get(0).(func(string, string) (*api.ApplyLock, error)); ok { @@ -1432,6 +1688,10 @@ func (_m *Client) ReleaseLock(repo string, lock string) (*api.ApplyLock, error) func (_m *Client) ResetInstallations() (int, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ResetInstallations") + } + var r0 int var r1 error if rf, ok := ret.Get(0).(func() (int, error)); ok { @@ -1456,6 +1716,10 @@ func (_m *Client) ResetInstallations() (int, error) { func (_m *Client) Scaffolds(in *api.ScaffoldInputs) ([]*api.ScaffoldFile, error) { ret := _m.Called(in) + if len(ret) == 0 { + panic("no return value specified for Scaffolds") + } + var r0 []*api.ScaffoldFile var r1 error if rf, ok := ret.Get(0).(func(*api.ScaffoldInputs) ([]*api.ScaffoldFile, error)); ok { @@ -1482,6 +1746,10 @@ func (_m *Client) Scaffolds(in *api.ScaffoldInputs) ([]*api.ScaffoldFile, error) func (_m *Client) TransferOwnership(name string, email string) error { ret := _m.Called(name, email) + if len(ret) == 0 { + panic("no return value specified for TransferOwnership") + } + var r0 error if rf, ok := ret.Get(0).(func(string, string) error); ok { r0 = rf(name, email) @@ -1496,6 +1764,10 @@ func (_m *Client) TransferOwnership(name string, email string) error { func (_m *Client) UninstallChart(id string) error { ret := _m.Called(id) + if len(ret) == 0 { + panic("no return value specified for UninstallChart") + } + var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { r0 = rf(id) @@ -1510,6 +1782,10 @@ func (_m *Client) UninstallChart(id string) error { func (_m *Client) UninstallTerraform(id string) error { ret := _m.Called(id) + if len(ret) == 0 { + panic("no return value specified for UninstallTerraform") + } + var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { r0 = rf(id) @@ -1524,6 +1800,10 @@ func (_m *Client) UninstallTerraform(id string) error { func (_m *Client) UnlockRepository(name string) error { ret := _m.Called(name) + if len(ret) == 0 { + panic("no return value specified for UnlockRepository") + } + var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { r0 = rf(name) @@ -1538,6 +1818,10 @@ func (_m *Client) UnlockRepository(name string) error { func (_m *Client) UpdateVersion(spec *api.VersionSpec, tags []string) error { ret := _m.Called(spec, tags) + if len(ret) == 0 { + panic("no return value specified for UpdateVersion") + } + var r0 error if rf, ok := ret.Get(0).(func(*api.VersionSpec, []string) error); ok { r0 = rf(spec, tags) @@ -1552,6 +1836,10 @@ func (_m *Client) UpdateVersion(spec *api.VersionSpec, tags []string) error { func (_m *Client) UploadTerraform(dir string, repoName string) (api.Terraform, error) { ret := _m.Called(dir, repoName) + if len(ret) == 0 { + panic("no return value specified for UploadTerraform") + } + var r0 api.Terraform var r1 error if rf, ok := ret.Get(0).(func(string, string) (api.Terraform, error)); ok { diff --git a/pkg/test/mocks/ConsoleClient.go b/pkg/test/mocks/ConsoleClient.go index 812998b64..0bbd35f0d 100644 --- a/pkg/test/mocks/ConsoleClient.go +++ b/pkg/test/mocks/ConsoleClient.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.36.1. DO NOT EDIT. +// Code generated by mockery v2.41.0. DO NOT EDIT. package mocks @@ -16,6 +16,10 @@ type ConsoleClient struct { func (_m *ConsoleClient) CloneService(clusterId string, serviceId *string, serviceName *string, clusterName *string, attributes gqlclient.ServiceCloneAttributes) (*gqlclient.ServiceDeploymentFragment, error) { ret := _m.Called(clusterId, serviceId, serviceName, clusterName, attributes) + if len(ret) == 0 { + panic("no return value specified for CloneService") + } + var r0 *gqlclient.ServiceDeploymentFragment var r1 error if rf, ok := ret.Get(0).(func(string, *string, *string, *string, gqlclient.ServiceCloneAttributes) (*gqlclient.ServiceDeploymentFragment, error)); ok { @@ -42,6 +46,10 @@ func (_m *ConsoleClient) CloneService(clusterId string, serviceId *string, servi func (_m *ConsoleClient) CreateCluster(attributes gqlclient.ClusterAttributes) (*gqlclient.CreateCluster, error) { ret := _m.Called(attributes) + if len(ret) == 0 { + panic("no return value specified for CreateCluster") + } + var r0 *gqlclient.CreateCluster var r1 error if rf, ok := ret.Get(0).(func(gqlclient.ClusterAttributes) (*gqlclient.CreateCluster, error)); ok { @@ -65,19 +73,23 @@ func (_m *ConsoleClient) CreateCluster(attributes gqlclient.ClusterAttributes) ( } // CreateClusterService provides a mock function with given fields: clusterId, clusterName, attr -func (_m *ConsoleClient) CreateClusterService(clusterId *string, clusterName *string, attr gqlclient.ServiceDeploymentAttributes) (*gqlclient.ServiceDeploymentFragment, error) { +func (_m *ConsoleClient) CreateClusterService(clusterId *string, clusterName *string, attr gqlclient.ServiceDeploymentAttributes) (*gqlclient.ServiceDeploymentExtended, error) { ret := _m.Called(clusterId, clusterName, attr) - var r0 *gqlclient.ServiceDeploymentFragment + if len(ret) == 0 { + panic("no return value specified for CreateClusterService") + } + + var r0 *gqlclient.ServiceDeploymentExtended var r1 error - if rf, ok := ret.Get(0).(func(*string, *string, gqlclient.ServiceDeploymentAttributes) (*gqlclient.ServiceDeploymentFragment, error)); ok { + if rf, ok := ret.Get(0).(func(*string, *string, gqlclient.ServiceDeploymentAttributes) (*gqlclient.ServiceDeploymentExtended, error)); ok { return rf(clusterId, clusterName, attr) } - if rf, ok := ret.Get(0).(func(*string, *string, gqlclient.ServiceDeploymentAttributes) *gqlclient.ServiceDeploymentFragment); ok { + if rf, ok := ret.Get(0).(func(*string, *string, gqlclient.ServiceDeploymentAttributes) *gqlclient.ServiceDeploymentExtended); ok { r0 = rf(clusterId, clusterName, attr) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*gqlclient.ServiceDeploymentFragment) + r0 = ret.Get(0).(*gqlclient.ServiceDeploymentExtended) } } @@ -94,6 +106,10 @@ func (_m *ConsoleClient) CreateClusterService(clusterId *string, clusterName *st func (_m *ConsoleClient) CreateProvider(attr gqlclient.ClusterProviderAttributes) (*gqlclient.CreateClusterProvider, error) { ret := _m.Called(attr) + if len(ret) == 0 { + panic("no return value specified for CreateProvider") + } + var r0 *gqlclient.CreateClusterProvider var r1 error if rf, ok := ret.Get(0).(func(gqlclient.ClusterProviderAttributes) (*gqlclient.CreateClusterProvider, error)); ok { @@ -120,6 +136,10 @@ func (_m *ConsoleClient) CreateProvider(attr gqlclient.ClusterProviderAttributes func (_m *ConsoleClient) CreateProviderCredentials(name string, attr gqlclient.ProviderCredentialAttributes) (*gqlclient.CreateProviderCredential, error) { ret := _m.Called(name, attr) + if len(ret) == 0 { + panic("no return value specified for CreateProviderCredentials") + } + var r0 *gqlclient.CreateProviderCredential var r1 error if rf, ok := ret.Get(0).(func(string, gqlclient.ProviderCredentialAttributes) (*gqlclient.CreateProviderCredential, error)); ok { @@ -146,6 +166,10 @@ func (_m *ConsoleClient) CreateProviderCredentials(name string, attr gqlclient.P func (_m *ConsoleClient) CreateRepository(url string, privateKey *string, passphrase *string, username *string, password *string) (*gqlclient.CreateGitRepository, error) { ret := _m.Called(url, privateKey, passphrase, username, password) + if len(ret) == 0 { + panic("no return value specified for CreateRepository") + } + var r0 *gqlclient.CreateGitRepository var r1 error if rf, ok := ret.Get(0).(func(string, *string, *string, *string, *string) (*gqlclient.CreateGitRepository, error)); ok { @@ -172,6 +196,10 @@ func (_m *ConsoleClient) CreateRepository(url string, privateKey *string, passph func (_m *ConsoleClient) DeleteCluster(id string) error { ret := _m.Called(id) + if len(ret) == 0 { + panic("no return value specified for DeleteCluster") + } + var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { r0 = rf(id) @@ -186,6 +214,10 @@ func (_m *ConsoleClient) DeleteCluster(id string) error { func (_m *ConsoleClient) DeleteClusterService(serviceId string) (*gqlclient.DeleteServiceDeployment, error) { ret := _m.Called(serviceId) + if len(ret) == 0 { + panic("no return value specified for DeleteClusterService") + } + var r0 *gqlclient.DeleteServiceDeployment var r1 error if rf, ok := ret.Get(0).(func(string) (*gqlclient.DeleteServiceDeployment, error)); ok { @@ -212,6 +244,10 @@ func (_m *ConsoleClient) DeleteClusterService(serviceId string) (*gqlclient.Dele func (_m *ConsoleClient) DeleteProviderCredentials(id string) (*gqlclient.DeleteProviderCredential, error) { ret := _m.Called(id) + if len(ret) == 0 { + panic("no return value specified for DeleteProviderCredentials") + } + var r0 *gqlclient.DeleteProviderCredential var r1 error if rf, ok := ret.Get(0).(func(string) (*gqlclient.DeleteProviderCredential, error)); ok { @@ -234,10 +270,32 @@ func (_m *ConsoleClient) DeleteProviderCredentials(id string) (*gqlclient.Delete return r0, r1 } +// DetachCluster provides a mock function with given fields: id +func (_m *ConsoleClient) DetachCluster(id string) error { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for DetachCluster") + } + + var r0 error + if rf, ok := ret.Get(0).(func(string) error); ok { + r0 = rf(id) + } else { + r0 = ret.Error(0) + } + + return r0 +} + // GetCluster provides a mock function with given fields: clusterId, clusterName func (_m *ConsoleClient) GetCluster(clusterId *string, clusterName *string) (*gqlclient.ClusterFragment, error) { ret := _m.Called(clusterId, clusterName) + if len(ret) == 0 { + panic("no return value specified for GetCluster") + } + var r0 *gqlclient.ClusterFragment var r1 error if rf, ok := ret.Get(0).(func(*string, *string) (*gqlclient.ClusterFragment, error)); ok { @@ -264,6 +322,10 @@ func (_m *ConsoleClient) GetCluster(clusterId *string, clusterName *string) (*gq func (_m *ConsoleClient) GetClusterService(serviceId *string, serviceName *string, clusterName *string) (*gqlclient.ServiceDeploymentExtended, error) { ret := _m.Called(serviceId, serviceName, clusterName) + if len(ret) == 0 { + panic("no return value specified for GetClusterService") + } + var r0 *gqlclient.ServiceDeploymentExtended var r1 error if rf, ok := ret.Get(0).(func(*string, *string, *string) (*gqlclient.ServiceDeploymentExtended, error)); ok { @@ -286,10 +348,72 @@ func (_m *ConsoleClient) GetClusterService(serviceId *string, serviceName *strin return r0, r1 } +// GetDeployToken provides a mock function with given fields: clusterId, clusterName +func (_m *ConsoleClient) GetDeployToken(clusterId *string, clusterName *string) (string, error) { + ret := _m.Called(clusterId, clusterName) + + if len(ret) == 0 { + panic("no return value specified for GetDeployToken") + } + + var r0 string + var r1 error + if rf, ok := ret.Get(0).(func(*string, *string) (string, error)); ok { + return rf(clusterId, clusterName) + } + if rf, ok := ret.Get(0).(func(*string, *string) string); ok { + r0 = rf(clusterId, clusterName) + } else { + r0 = ret.Get(0).(string) + } + + if rf, ok := ret.Get(1).(func(*string, *string) error); ok { + r1 = rf(clusterId, clusterName) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetServiceContext provides a mock function with given fields: name +func (_m *ConsoleClient) GetServiceContext(name string) (*gqlclient.ServiceContextFragment, error) { + ret := _m.Called(name) + + if len(ret) == 0 { + panic("no return value specified for GetServiceContext") + } + + var r0 *gqlclient.ServiceContextFragment + var r1 error + if rf, ok := ret.Get(0).(func(string) (*gqlclient.ServiceContextFragment, error)); ok { + return rf(name) + } + if rf, ok := ret.Get(0).(func(string) *gqlclient.ServiceContextFragment); ok { + r0 = rf(name) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*gqlclient.ServiceContextFragment) + } + } + + if rf, ok := ret.Get(1).(func(string) error); ok { + r1 = rf(name) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // ListClusterServices provides a mock function with given fields: clusterId, handle func (_m *ConsoleClient) ListClusterServices(clusterId *string, handle *string) ([]*gqlclient.ServiceDeploymentEdgeFragment, error) { ret := _m.Called(clusterId, handle) + if len(ret) == 0 { + panic("no return value specified for ListClusterServices") + } + var r0 []*gqlclient.ServiceDeploymentEdgeFragment var r1 error if rf, ok := ret.Get(0).(func(*string, *string) ([]*gqlclient.ServiceDeploymentEdgeFragment, error)); ok { @@ -316,6 +440,10 @@ func (_m *ConsoleClient) ListClusterServices(clusterId *string, handle *string) func (_m *ConsoleClient) ListClusters() (*gqlclient.ListClusters, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ListClusters") + } + var r0 *gqlclient.ListClusters var r1 error if rf, ok := ret.Get(0).(func() (*gqlclient.ListClusters, error)); ok { @@ -342,6 +470,10 @@ func (_m *ConsoleClient) ListClusters() (*gqlclient.ListClusters, error) { func (_m *ConsoleClient) ListProviders() (*gqlclient.ListProviders, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ListProviders") + } + var r0 *gqlclient.ListProviders var r1 error if rf, ok := ret.Get(0).(func() (*gqlclient.ListProviders, error)); ok { @@ -368,6 +500,10 @@ func (_m *ConsoleClient) ListProviders() (*gqlclient.ListProviders, error) { func (_m *ConsoleClient) ListRepositories() (*gqlclient.ListGitRepositories, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ListRepositories") + } + var r0 *gqlclient.ListGitRepositories var r1 error if rf, ok := ret.Get(0).(func() (*gqlclient.ListGitRepositories, error)); ok { @@ -394,6 +530,10 @@ func (_m *ConsoleClient) ListRepositories() (*gqlclient.ListGitRepositories, err func (_m *ConsoleClient) MyCluster() (*gqlclient.MyCluster, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for MyCluster") + } + var r0 *gqlclient.MyCluster var r1 error if rf, ok := ret.Get(0).(func() (*gqlclient.MyCluster, error)); ok { @@ -420,6 +560,10 @@ func (_m *ConsoleClient) MyCluster() (*gqlclient.MyCluster, error) { func (_m *ConsoleClient) SavePipeline(name string, attrs gqlclient.PipelineAttributes) (*gqlclient.PipelineFragment, error) { ret := _m.Called(name, attrs) + if len(ret) == 0 { + panic("no return value specified for SavePipeline") + } + var r0 *gqlclient.PipelineFragment var r1 error if rf, ok := ret.Get(0).(func(string, gqlclient.PipelineAttributes) (*gqlclient.PipelineFragment, error)); ok { @@ -442,10 +586,44 @@ func (_m *ConsoleClient) SavePipeline(name string, attrs gqlclient.PipelineAttri return r0, r1 } +// SaveServiceContext provides a mock function with given fields: name, attributes +func (_m *ConsoleClient) SaveServiceContext(name string, attributes gqlclient.ServiceContextAttributes) (*gqlclient.ServiceContextFragment, error) { + ret := _m.Called(name, attributes) + + if len(ret) == 0 { + panic("no return value specified for SaveServiceContext") + } + + var r0 *gqlclient.ServiceContextFragment + var r1 error + if rf, ok := ret.Get(0).(func(string, gqlclient.ServiceContextAttributes) (*gqlclient.ServiceContextFragment, error)); ok { + return rf(name, attributes) + } + if rf, ok := ret.Get(0).(func(string, gqlclient.ServiceContextAttributes) *gqlclient.ServiceContextFragment); ok { + r0 = rf(name, attributes) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*gqlclient.ServiceContextFragment) + } + } + + if rf, ok := ret.Get(1).(func(string, gqlclient.ServiceContextAttributes) error); ok { + r1 = rf(name, attributes) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // Token provides a mock function with given fields: func (_m *ConsoleClient) Token() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Token") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -460,6 +638,10 @@ func (_m *ConsoleClient) Token() string { func (_m *ConsoleClient) UpdateCluster(id string, attr gqlclient.ClusterUpdateAttributes) (*gqlclient.UpdateCluster, error) { ret := _m.Called(id, attr) + if len(ret) == 0 { + panic("no return value specified for UpdateCluster") + } + var r0 *gqlclient.UpdateCluster var r1 error if rf, ok := ret.Get(0).(func(string, gqlclient.ClusterUpdateAttributes) (*gqlclient.UpdateCluster, error)); ok { @@ -483,19 +665,23 @@ func (_m *ConsoleClient) UpdateCluster(id string, attr gqlclient.ClusterUpdateAt } // UpdateClusterService provides a mock function with given fields: serviceId, serviceName, clusterName, attributes -func (_m *ConsoleClient) UpdateClusterService(serviceId *string, serviceName *string, clusterName *string, attributes gqlclient.ServiceUpdateAttributes) (*gqlclient.ServiceDeploymentFragment, error) { +func (_m *ConsoleClient) UpdateClusterService(serviceId *string, serviceName *string, clusterName *string, attributes gqlclient.ServiceUpdateAttributes) (*gqlclient.ServiceDeploymentExtended, error) { ret := _m.Called(serviceId, serviceName, clusterName, attributes) - var r0 *gqlclient.ServiceDeploymentFragment + if len(ret) == 0 { + panic("no return value specified for UpdateClusterService") + } + + var r0 *gqlclient.ServiceDeploymentExtended var r1 error - if rf, ok := ret.Get(0).(func(*string, *string, *string, gqlclient.ServiceUpdateAttributes) (*gqlclient.ServiceDeploymentFragment, error)); ok { + if rf, ok := ret.Get(0).(func(*string, *string, *string, gqlclient.ServiceUpdateAttributes) (*gqlclient.ServiceDeploymentExtended, error)); ok { return rf(serviceId, serviceName, clusterName, attributes) } - if rf, ok := ret.Get(0).(func(*string, *string, *string, gqlclient.ServiceUpdateAttributes) *gqlclient.ServiceDeploymentFragment); ok { + if rf, ok := ret.Get(0).(func(*string, *string, *string, gqlclient.ServiceUpdateAttributes) *gqlclient.ServiceDeploymentExtended); ok { r0 = rf(serviceId, serviceName, clusterName, attributes) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*gqlclient.ServiceDeploymentFragment) + r0 = ret.Get(0).(*gqlclient.ServiceDeploymentExtended) } } @@ -512,6 +698,10 @@ func (_m *ConsoleClient) UpdateClusterService(serviceId *string, serviceName *st func (_m *ConsoleClient) UpdateRepository(id string, attrs gqlclient.GitAttributes) (*gqlclient.UpdateGitRepository, error) { ret := _m.Called(id, attrs) + if len(ret) == 0 { + panic("no return value specified for UpdateRepository") + } + var r0 *gqlclient.UpdateGitRepository var r1 error if rf, ok := ret.Get(0).(func(string, gqlclient.GitAttributes) (*gqlclient.UpdateGitRepository, error)); ok { @@ -538,6 +728,10 @@ func (_m *ConsoleClient) UpdateRepository(id string, attrs gqlclient.GitAttribut func (_m *ConsoleClient) Url() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Url") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() diff --git a/pkg/test/mocks/Kube.go b/pkg/test/mocks/Kube.go index c10942b59..112229b2f 100644 --- a/pkg/test/mocks/Kube.go +++ b/pkg/test/mocks/Kube.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.36.1. DO NOT EDIT. +// Code generated by mockery v2.41.0. DO NOT EDIT. package mocks @@ -27,6 +27,10 @@ type Kube struct { func (_m *Kube) Apply(path string, force bool) error { ret := _m.Called(path, force) + if len(ret) == 0 { + panic("no return value specified for Apply") + } + var r0 error if rf, ok := ret.Get(0).(func(string, bool) error); ok { r0 = rf(path, force) @@ -41,6 +45,10 @@ func (_m *Kube) Apply(path string, force bool) error { func (_m *Kube) CreateNamespace(namespace string) error { ret := _m.Called(namespace) + if len(ret) == 0 { + panic("no return value specified for CreateNamespace") + } + var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { r0 = rf(namespace) @@ -55,6 +63,10 @@ func (_m *Kube) CreateNamespace(namespace string) error { func (_m *Kube) FinalizeNamespace(namespace string) error { ret := _m.Called(namespace) + if len(ret) == 0 { + panic("no return value specified for FinalizeNamespace") + } + var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { r0 = rf(namespace) @@ -69,6 +81,10 @@ func (_m *Kube) FinalizeNamespace(namespace string) error { func (_m *Kube) GetClient() *client_gokubernetes.Clientset { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetClient") + } + var r0 *client_gokubernetes.Clientset if rf, ok := ret.Get(0).(func() *client_gokubernetes.Clientset); ok { r0 = rf() @@ -85,6 +101,10 @@ func (_m *Kube) GetClient() *client_gokubernetes.Clientset { func (_m *Kube) GetRestClient() *rest.RESTClient { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetRestClient") + } + var r0 *rest.RESTClient if rf, ok := ret.Get(0).(func() *rest.RESTClient); ok { r0 = rf() @@ -101,6 +121,10 @@ func (_m *Kube) GetRestClient() *rest.RESTClient { func (_m *Kube) LogTail(namespace string, name string) (*v1alpha1.LogTail, error) { ret := _m.Called(namespace, name) + if len(ret) == 0 { + panic("no return value specified for LogTail") + } + var r0 *v1alpha1.LogTail var r1 error if rf, ok := ret.Get(0).(func(string, string) (*v1alpha1.LogTail, error)); ok { @@ -127,6 +151,10 @@ func (_m *Kube) LogTail(namespace string, name string) (*v1alpha1.LogTail, error func (_m *Kube) LogTailList(namespace string) (*v1alpha1.LogTailList, error) { ret := _m.Called(namespace) + if len(ret) == 0 { + panic("no return value specified for LogTailList") + } + var r0 *v1alpha1.LogTailList var r1 error if rf, ok := ret.Get(0).(func(string) (*v1alpha1.LogTailList, error)); ok { @@ -153,6 +181,10 @@ func (_m *Kube) LogTailList(namespace string) (*v1alpha1.LogTailList, error) { func (_m *Kube) Node(name string) (*v1.Node, error) { ret := _m.Called(name) + if len(ret) == 0 { + panic("no return value specified for Node") + } + var r0 *v1.Node var r1 error if rf, ok := ret.Get(0).(func(string) (*v1.Node, error)); ok { @@ -179,6 +211,10 @@ func (_m *Kube) Node(name string) (*v1.Node, error) { func (_m *Kube) Nodes() (*v1.NodeList, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Nodes") + } + var r0 *v1.NodeList var r1 error if rf, ok := ret.Get(0).(func() (*v1.NodeList, error)); ok { @@ -205,6 +241,10 @@ func (_m *Kube) Nodes() (*v1.NodeList, error) { func (_m *Kube) Proxy(namespace string, name string) (*v1alpha1.Proxy, error) { ret := _m.Called(namespace, name) + if len(ret) == 0 { + panic("no return value specified for Proxy") + } + var r0 *v1alpha1.Proxy var r1 error if rf, ok := ret.Get(0).(func(string, string) (*v1alpha1.Proxy, error)); ok { @@ -231,6 +271,10 @@ func (_m *Kube) Proxy(namespace string, name string) (*v1alpha1.Proxy, error) { func (_m *Kube) ProxyList(namespace string) (*v1alpha1.ProxyList, error) { ret := _m.Called(namespace) + if len(ret) == 0 { + panic("no return value specified for ProxyList") + } + var r0 *v1alpha1.ProxyList var r1 error if rf, ok := ret.Get(0).(func(string) (*v1alpha1.ProxyList, error)); ok { @@ -257,6 +301,10 @@ func (_m *Kube) ProxyList(namespace string) (*v1alpha1.ProxyList, error) { func (_m *Kube) Secret(namespace string, name string) (*v1.Secret, error) { ret := _m.Called(namespace, name) + if len(ret) == 0 { + panic("no return value specified for Secret") + } + var r0 *v1.Secret var r1 error if rf, ok := ret.Get(0).(func(string, string) (*v1.Secret, error)); ok { @@ -283,6 +331,10 @@ func (_m *Kube) Secret(namespace string, name string) (*v1.Secret, error) { func (_m *Kube) SecretCreate(namespace string, secret *v1.Secret) (*v1.Secret, error) { ret := _m.Called(namespace, secret) + if len(ret) == 0 { + panic("no return value specified for SecretCreate") + } + var r0 *v1.Secret var r1 error if rf, ok := ret.Get(0).(func(string, *v1.Secret) (*v1.Secret, error)); ok { @@ -309,6 +361,10 @@ func (_m *Kube) SecretCreate(namespace string, secret *v1.Secret) (*v1.Secret, e func (_m *Kube) SecretDelete(namespace string, secretName string) error { ret := _m.Called(namespace, secretName) + if len(ret) == 0 { + panic("no return value specified for SecretDelete") + } + var r0 error if rf, ok := ret.Get(0).(func(string, string) error); ok { r0 = rf(namespace, secretName) @@ -323,6 +379,10 @@ func (_m *Kube) SecretDelete(namespace string, secretName string) error { func (_m *Kube) SecretDeleteCollection(namespace string, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { ret := _m.Called(namespace, opts, listOpts) + if len(ret) == 0 { + panic("no return value specified for SecretDeleteCollection") + } + var r0 error if rf, ok := ret.Get(0).(func(string, metav1.DeleteOptions, metav1.ListOptions) error); ok { r0 = rf(namespace, opts, listOpts) @@ -337,6 +397,10 @@ func (_m *Kube) SecretDeleteCollection(namespace string, opts metav1.DeleteOptio func (_m *Kube) SecretList(namespace string, opts metav1.ListOptions) (*v1.SecretList, error) { ret := _m.Called(namespace, opts) + if len(ret) == 0 { + panic("no return value specified for SecretList") + } + var r0 *v1.SecretList var r1 error if rf, ok := ret.Get(0).(func(string, metav1.ListOptions) (*v1.SecretList, error)); ok { @@ -363,6 +427,10 @@ func (_m *Kube) SecretList(namespace string, opts metav1.ListOptions) (*v1.Secre func (_m *Kube) WireguardPeer(namespace string, name string) (*vpnv1alpha1.WireguardPeer, error) { ret := _m.Called(namespace, name) + if len(ret) == 0 { + panic("no return value specified for WireguardPeer") + } + var r0 *vpnv1alpha1.WireguardPeer var r1 error if rf, ok := ret.Get(0).(func(string, string) (*vpnv1alpha1.WireguardPeer, error)); ok { @@ -389,6 +457,10 @@ func (_m *Kube) WireguardPeer(namespace string, name string) (*vpnv1alpha1.Wireg func (_m *Kube) WireguardPeerCreate(namespace string, wireguardPeer *vpnv1alpha1.WireguardPeer) (*vpnv1alpha1.WireguardPeer, error) { ret := _m.Called(namespace, wireguardPeer) + if len(ret) == 0 { + panic("no return value specified for WireguardPeerCreate") + } + var r0 *vpnv1alpha1.WireguardPeer var r1 error if rf, ok := ret.Get(0).(func(string, *vpnv1alpha1.WireguardPeer) (*vpnv1alpha1.WireguardPeer, error)); ok { @@ -415,6 +487,10 @@ func (_m *Kube) WireguardPeerCreate(namespace string, wireguardPeer *vpnv1alpha1 func (_m *Kube) WireguardPeerDelete(namespace string, name string) error { ret := _m.Called(namespace, name) + if len(ret) == 0 { + panic("no return value specified for WireguardPeerDelete") + } + var r0 error if rf, ok := ret.Get(0).(func(string, string) error); ok { r0 = rf(namespace, name) @@ -429,6 +505,10 @@ func (_m *Kube) WireguardPeerDelete(namespace string, name string) error { func (_m *Kube) WireguardPeerList(namespace string) (*vpnv1alpha1.WireguardPeerList, error) { ret := _m.Called(namespace) + if len(ret) == 0 { + panic("no return value specified for WireguardPeerList") + } + var r0 *vpnv1alpha1.WireguardPeerList var r1 error if rf, ok := ret.Get(0).(func(string) (*vpnv1alpha1.WireguardPeerList, error)); ok { @@ -455,6 +535,10 @@ func (_m *Kube) WireguardPeerList(namespace string) (*vpnv1alpha1.WireguardPeerL func (_m *Kube) WireguardServer(namespace string, name string) (*vpnv1alpha1.WireguardServer, error) { ret := _m.Called(namespace, name) + if len(ret) == 0 { + panic("no return value specified for WireguardServer") + } + var r0 *vpnv1alpha1.WireguardServer var r1 error if rf, ok := ret.Get(0).(func(string, string) (*vpnv1alpha1.WireguardServer, error)); ok { @@ -481,6 +565,10 @@ func (_m *Kube) WireguardServer(namespace string, name string) (*vpnv1alpha1.Wir func (_m *Kube) WireguardServerList(namespace string) (*vpnv1alpha1.WireguardServerList, error) { ret := _m.Called(namespace) + if len(ret) == 0 { + panic("no return value specified for WireguardServerList") + } + var r0 *vpnv1alpha1.WireguardServerList var r1 error if rf, ok := ret.Get(0).(func(string) (*vpnv1alpha1.WireguardServerList, error)); ok {