diff --git a/client/cluster_profile.go b/client/cluster_profile.go index 41991732..d3a12477 100644 --- a/client/cluster_profile.go +++ b/client/cluster_profile.go @@ -115,3 +115,27 @@ func (h *V1Client) PublishClusterProfile(client clusterC.ClientService, uid, Pro _, err := client.V1ClusterProfilesPublish(params) return err } + +func (h *V1Client) GetProfileVariables(client clusterC.ClientService, uid string) ([]*models.V1Variable, error) { + params := clusterC.NewV1ClusterProfilesUIDVariablesGetParamsWithContext(h.Ctx).WithUID(uid) + success, err := client.V1ClusterProfilesUIDVariablesGet(params) + var e *transport.TransportError + if errors.As(err, &e) && e.HttpCode == 404 { + return nil, nil + } else if err != nil { + return nil, err + } + return success.Payload.Variables, nil +} + +func (h *V1Client) UpdateProfileVariables(client clusterC.ClientService, variables *models.V1Variables, uid string) error { + params := clusterC.NewV1ClusterProfilesUIDVariablesPutParamsWithContext(h.Ctx).WithUID(uid).WithBody(variables) + _, err := client.V1ClusterProfilesUIDVariablesPut(params) + var e *transport.TransportError + if errors.As(err, &e) && e.HttpCode == 404 { + return nil + } else if err != nil { + return err + } + return nil +} diff --git a/go.mod b/go.mod index e32a72ad..b8c88655 100644 --- a/go.mod +++ b/go.mod @@ -1,15 +1,15 @@ module github.com/spectrocloud/palette-sdk-go -go 1.21 +go 1.22 -toolchain go1.21.1 +toolchain go1.22rc2 require ( github.com/go-openapi/runtime v0.19.24 github.com/go-openapi/strfmt v0.20.0 github.com/pkg/errors v0.9.1 - github.com/spectrocloud/hapi v1.14.1-0.20231204203717-cd5b7889ff97 - github.com/stretchr/testify v1.7.0 + github.com/spectrocloud/hapi v1.14.1-0.20240127163812-35944b564715 + github.com/stretchr/testify v1.8.4 ) require ( @@ -33,13 +33,13 @@ require ( github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/sirupsen/logrus v1.6.0 // indirect - github.com/spectrocloud/gomi v1.14.1-0.20230412095143-b0595c6c6f08 // indirect + github.com/spectrocloud/gomi v1.14.1-0.20231206064212-951160f8c919 // indirect go.mongodb.org/mongo-driver v1.4.6 // indirect - golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.10.0 // indirect - golang.org/x/text v0.7.0 // indirect + golang.org/x/net v0.10.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/text v0.13.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) //replace github.com/spectrocloud/hapi => ../hapi diff --git a/go.sum b/go.sum index 36ed43b7..dd9e7cf1 100644 --- a/go.sum +++ b/go.sum @@ -208,12 +208,15 @@ github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/spectrocloud/gomi v1.14.1-0.20230412095143-b0595c6c6f08 h1:AnOC0U+ExlKBeT5yF2Pg8PPfVOfxwOUBS/5deOl1Q4Y= github.com/spectrocloud/gomi v1.14.1-0.20230412095143-b0595c6c6f08/go.mod h1:UnhUDpFEvtYh6m384r3xzj8/+Z6/hMp2O8whEMYVHec= +github.com/spectrocloud/gomi v1.14.1-0.20231206064212-951160f8c919/go.mod h1:LlZ9We4kDaELYi7Is0SVmnySuDhwphJLS6ZT4wXxFIk= github.com/spectrocloud/hapi v1.14.1-0.20231107061715-d18e1e78daf8 h1:vSU7q/fj0vmQIh5R/+m3o5a3ppcCbCCbB34JYveM5n4= github.com/spectrocloud/hapi v1.14.1-0.20231107061715-d18e1e78daf8/go.mod h1:Krk9mzbO1MnUTLvvzztBYpOWCFunIlSDWSGlsLh1vkk= github.com/spectrocloud/hapi v1.14.1-0.20231120161727-f0d8bd27c6ef h1:ROS17WffaRM8yVPVYLub1MqLeeN9Jt5f/zXNwCSypjo= github.com/spectrocloud/hapi v1.14.1-0.20231120161727-f0d8bd27c6ef/go.mod h1:Krk9mzbO1MnUTLvvzztBYpOWCFunIlSDWSGlsLh1vkk= github.com/spectrocloud/hapi v1.14.1-0.20231204203717-cd5b7889ff97 h1:P2wXczfqTAyDaxdaGx/9tXDqHnrkHkLzHOsx+tD/Kxc= github.com/spectrocloud/hapi v1.14.1-0.20231204203717-cd5b7889ff97/go.mod h1:Krk9mzbO1MnUTLvvzztBYpOWCFunIlSDWSGlsLh1vkk= +github.com/spectrocloud/hapi v1.14.1-0.20240127163812-35944b564715 h1:uDYWYQ6yStrlNT8Tff+HgMBYYNIlFy6xmCv2Ql2wDhw= +github.com/spectrocloud/hapi v1.14.1-0.20240127163812-35944b564715/go.mod h1:bc6zoqx2Ghl1GZkS9yXmJKjMIJZOI2Gq2ryLGeCFUeI= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -225,6 +228,7 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/vektah/gqlparser v1.1.2/go.mod h1:1ycwN7Ij5njmMkPPAOaRFY4rET2Enx7IkVv3vaXspKw= @@ -261,6 +265,7 @@ golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190412183630-56d357773e84/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -279,6 +284,7 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= @@ -287,6 +293,7 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190125232054-d66bd3c5d5a6/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -315,3 +322,4 @@ gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=