Skip to content

Commit

Permalink
Merge pull request #212 from sapcc/gophercloud2
Browse files Browse the repository at this point in the history
bump gophercloud/* and sapcc/gophercloud-sapcc to v2
  • Loading branch information
majewsky authored Jul 9, 2024
2 parents 6e9f500 + 56c27ba commit 0ed1241
Show file tree
Hide file tree
Showing 151 changed files with 5,814 additions and 2,895 deletions.
14 changes: 7 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ module github.com/sapcc/limesctl/v3
go 1.22

require (
github.com/gophercloud/gophercloud v1.12.0
github.com/gophercloud/utils v0.0.0-20231010081019-80377eca5d56
github.com/gophercloud/gophercloud/v2 v2.0.0
github.com/gophercloud/utils/v2 v2.0.0-20240705071316-780b64d153e3
github.com/olekukonko/tablewriter v0.0.5
github.com/sapcc/go-api-declarations v1.11.3
github.com/sapcc/go-bits v0.0.0-20240704034903-8a2e97b1eaf1
github.com/sapcc/gophercloud-sapcc v1.0.0
github.com/sapcc/go-bits v0.0.0-20240708133634-c3fa8372671d
github.com/sapcc/gophercloud-sapcc/v2 v2.0.1
github.com/spf13/cobra v1.8.1
)

require (
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/gofrs/uuid/v5 v5.2.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
57 changes: 13 additions & 44 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/gophercloud/gophercloud v1.3.0/go.mod h1:aAVqcocTSXh2vYFZ1JTvx4EQmfgzxRcNupUfxZbBNDM=
github.com/gophercloud/gophercloud v1.12.0 h1:Jrz16vPAL93l80q16fp8NplrTCp93y7rZh2P3Q4Yq7g=
github.com/gophercloud/gophercloud v1.12.0/go.mod h1:aAVqcocTSXh2vYFZ1JTvx4EQmfgzxRcNupUfxZbBNDM=
github.com/gophercloud/utils v0.0.0-20231010081019-80377eca5d56 h1:sH7xkTfYzxIEgzq1tDHIMKRh1vThOEOGNsettdEeLbE=
github.com/gophercloud/utils v0.0.0-20231010081019-80377eca5d56/go.mod h1:VSalo4adEk+3sNkmVJLnhHoOyOYYS8sTWLG4mv5BKto=
github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8=
github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/gofrs/uuid/v5 v5.2.0 h1:qw1GMx6/y8vhVsx626ImfKMuS5CvJmhIKKtuyvfajMM=
github.com/gofrs/uuid/v5 v5.2.0/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8=
github.com/gophercloud/gophercloud/v2 v2.0.0 h1:iH0x0Ji79a/ULzmq95fvOBAyie7+M+wUAEu+JrRMsCk=
github.com/gophercloud/gophercloud/v2 v2.0.0/go.mod h1:ZKbcGNjxFTSaP5wlvtLDdsppllD/UGGvXBPqcjeqA8Y=
github.com/gophercloud/utils/v2 v2.0.0-20240705071316-780b64d153e3 h1:Jakaq9ALfVGOGC8w0eTS2FMa+yG8bMbM1lDhkFpEDXA=
github.com/gophercloud/utils/v2 v2.0.0-20240705071316-780b64d153e3/go.mod h1:SlglU6S3SCTU9qjapk7XjPufH/VhHXi+nKl8fuoLUoc=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
Expand All @@ -17,51 +16,21 @@ github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sapcc/go-api-declarations v1.11.3 h1:A8JgeSmOdziYXuiOes9Lp3LKZ0FsU2lc9FOxoM3kRR0=
github.com/sapcc/go-api-declarations v1.11.3/go.mod h1:83R3hTANhuRXt/pXDby37IJetw8l7DG41s33Tp9NXxI=
github.com/sapcc/go-bits v0.0.0-20240704034903-8a2e97b1eaf1 h1:59NoGTHnUypk2TJBo7N4NtrEEmSQ7wQ874mVT0/22Jc=
github.com/sapcc/go-bits v0.0.0-20240704034903-8a2e97b1eaf1/go.mod h1:IU7dTl5PEsvmMocMPKNDTxwUR41Ewpk0s2yf+v9D/yw=
github.com/sapcc/gophercloud-sapcc v1.0.0 h1:jPPIygmrHNS/d1fGEmxfSK99TgfL2p8UX+l6veYHcJw=
github.com/sapcc/gophercloud-sapcc v1.0.0/go.mod h1:dTBCGEVxdxL9gYLSl5oLOKHexw7nSuKgHquOK6Z36V8=
github.com/sapcc/go-bits v0.0.0-20240708133634-c3fa8372671d h1:T2+b3BdnLVgagXxNgTyk/1MTSKDk1wAEmt6tFwrQo2U=
github.com/sapcc/go-bits v0.0.0-20240708133634-c3fa8372671d/go.mod h1:d9JN0Gm8lF5jUMQeH/3MS5iNhs6/AlR/wVQ8vxRAGmo=
github.com/sapcc/gophercloud-sapcc/v2 v2.0.1 h1:L5RXWdtdb8M8u77EasQp61sejzs8v5s8tRQdmsk8BmM=
github.com/sapcc/gophercloud-sapcc/v2 v2.0.1/go.mod h1:c+guCOMR8/sGXDus5VEVrjQ7pdmT7JEQaInJWysbBzQ=
github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8=
github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I=
github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
15 changes: 8 additions & 7 deletions internal/auth/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,22 @@
package auth

import (
"context"
"errors"
"fmt"
"strings"

"github.com/gophercloud/gophercloud"
identitydomains "github.com/gophercloud/gophercloud/openstack/identity/v3/domains"
"github.com/gophercloud/gophercloud/v2"
identitydomains "github.com/gophercloud/gophercloud/v2/openstack/identity/v3/domains"

"github.com/sapcc/limesctl/v3/internal/util"
)

const msgDomainNotFound = "domain not found"

// FindDomainName returns the name of a domain.
func FindDomainName(identityClient *gophercloud.ServiceClient, id string) (string, error) {
d, err := identitydomains.Get(identityClient, id).Extract()
func FindDomainName(ctx context.Context, identityClient *gophercloud.ServiceClient, id string) (string, error) {
d, err := identitydomains.Get(ctx, identityClient, id).Extract()
switch {
case err == nil:
return d.Name, nil
Expand All @@ -46,7 +47,7 @@ func FindDomainName(identityClient *gophercloud.ServiceClient, id string) (strin
}

// FindDomainID tries to find a domain id using the provided nameOrID.
func FindDomainID(identityClient *gophercloud.ServiceClient, nameOrID string) (string, error) {
func FindDomainID(ctx context.Context, identityClient *gophercloud.ServiceClient, nameOrID string) (string, error) {
// Strategy 1: get domain id from current token scope.
id := getDomainIDFromCurrentToken(identityClient, nameOrID)
if id != "" {
Expand All @@ -58,15 +59,15 @@ func FindDomainID(identityClient *gophercloud.ServiceClient, nameOrID string) (s
}

// Strategy 2: assume that nameOrID is an ID and try to find in Keystone.
d, err := identitydomains.Get(identityClient, nameOrID).Extract()
d, err := identitydomains.Get(ctx, identityClient, nameOrID).Extract()
if err == nil && d.ID != "" {
return d.ID, nil
}

// Strategy 3: at this point we know that nameOrID is a name so we do a
// Keystone domain listing and try to find the domain.
var dList []identitydomains.Domain
page, err := identitydomains.List(identityClient, identitydomains.ListOpts{Name: nameOrID}).AllPages()
page, err := identitydomains.List(identityClient, identitydomains.ListOpts{Name: nameOrID}).AllPages(ctx)
if err == nil {
dList, err = identitydomains.ExtractDomains(page)
}
Expand Down
17 changes: 9 additions & 8 deletions internal/auth/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@
package auth

import (
"context"
"errors"
"fmt"

"github.com/gophercloud/gophercloud"
identityprojects "github.com/gophercloud/gophercloud/openstack/identity/v3/projects"
"github.com/gophercloud/gophercloud/v2"
identityprojects "github.com/gophercloud/gophercloud/v2/openstack/identity/v3/projects"

"github.com/sapcc/limesctl/v3/internal/util"
)
Expand All @@ -34,7 +35,7 @@ type ProjectInfo struct {
}

// FindProject tries to find a project using the provided name/ID(s).
func FindProject(identityClient *gophercloud.ServiceClient, domainNameOrID, projectNameOrID string) (*ProjectInfo, error) {
func FindProject(ctx context.Context, identityClient *gophercloud.ServiceClient, domainNameOrID, projectNameOrID string) (*ProjectInfo, error) {
// Strategy 1: find project in current token.
pInfo := findProjectInCurrentToken(identityClient, domainNameOrID, projectNameOrID)
if pInfo != nil {
Expand All @@ -47,14 +48,14 @@ func FindProject(identityClient *gophercloud.ServiceClient, domainNameOrID, proj

// Strategy 2: assume that projectNameOrID is an ID and try to find in
// Keystone.
p, err := identityprojects.Get(identityClient, projectNameOrID).Extract()
p, err := identityprojects.Get(ctx, identityClient, projectNameOrID).Extract()
if err == nil {
if p.IsDomain {
return nil, errors.New("the given ID belongs to a domain, usage instructions: limectl domain --help")
}
if p.ID != "" {
var dName string
dName, err = FindDomainName(identityClient, p.DomainID)
dName, err = FindDomainName(ctx, identityClient, p.DomainID)
if err != nil {
return nil, util.WrapError(err, msgProjectNotFound)
}
Expand All @@ -71,14 +72,14 @@ func FindProject(identityClient *gophercloud.ServiceClient, domainNameOrID, proj
opts := identityprojects.ListOpts{Name: projectNameOrID}
if domainNameOrID != "" {
var dID string
dID, err = FindDomainID(identityClient, domainNameOrID)
dID, err = FindDomainID(ctx, identityClient, domainNameOrID)
if err != nil {
return nil, util.WrapError(err, msgProjectNotFound)
}
opts.DomainID = dID
}
var pList []identityprojects.Project
page, err := identityprojects.List(identityClient, opts).AllPages()
page, err := identityprojects.List(identityClient, opts).AllPages(ctx)
if err == nil {
pList, err = identityprojects.ExtractProjects(page)
}
Expand All @@ -91,7 +92,7 @@ func FindProject(identityClient *gophercloud.ServiceClient, domainNameOrID, proj
}
if l == 1 {
if p := pList[0]; p.ID != "" {
dName, err := FindDomainName(identityClient, p.DomainID)
dName, err := FindDomainName(ctx, identityClient, p.DomainID)
if err != nil {
return nil, util.WrapError(err, msgProjectNotFound)
}
Expand Down
4 changes: 2 additions & 2 deletions internal/auth/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ package auth
import (
"fmt"

"github.com/gophercloud/gophercloud"
"github.com/gophercloud/gophercloud/openstack/identity/v3/tokens"
"github.com/gophercloud/gophercloud/v2"
"github.com/gophercloud/gophercloud/v2/openstack/identity/v3/tokens"
)

// token contains domain and project information about an authorization token.
Expand Down
12 changes: 6 additions & 6 deletions internal/cmd/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ package cmd
import (
"github.com/sapcc/go-api-declarations/limes"
limesresources "github.com/sapcc/go-api-declarations/limes/resources"
ratesClusters "github.com/sapcc/gophercloud-sapcc/rates/v1/clusters"
"github.com/sapcc/gophercloud-sapcc/resources/v1/clusters"
ratesClusters "github.com/sapcc/gophercloud-sapcc/v2/rates/v1/clusters"
"github.com/sapcc/gophercloud-sapcc/v2/resources/v1/clusters"
"github.com/spf13/cobra"

"github.com/sapcc/limesctl/v3/internal/core"
Expand Down Expand Up @@ -67,13 +67,13 @@ func newClusterShowCmd() *clusterShowCmd {
return clusterShow
}

func (c *clusterShowCmd) Run(_ *cobra.Command, _ []string) error {
func (c *clusterShowCmd) Run(cmd *cobra.Command, _ []string) error {
outputOpts, err := c.resourceOutputFmtFlags.validate()
if err != nil {
return err
}

res := clusters.Get(limesResourcesClient, clusters.GetOpts{
res := clusters.Get(cmd.Context(), limesResourcesClient, clusters.GetOpts{
Areas: c.areas,
Services: util.CastStringsTo[limes.ServiceType](c.services),
Resources: util.CastStringsTo[limesresources.ResourceName](c.resources),
Expand Down Expand Up @@ -124,13 +124,13 @@ func newClusterShowRatesCmd() *clusterShowRatesCmd {
return clusterShowRates
}

func (c *clusterShowRatesCmd) Run(_ *cobra.Command, args []string) error {
func (c *clusterShowRatesCmd) Run(cmd *cobra.Command, args []string) error {
outputOpts, err := c.rateOutputFmtFlags.validate()
if err != nil {
return err
}

res := ratesClusters.Get(limesRatesClient, ratesClusters.GetOpts{
res := ratesClusters.Get(cmd.Context(), limesRatesClient, ratesClusters.GetOpts{
Areas: c.areas,
Services: util.CastStringsTo[limes.ServiceType](c.services),
})
Expand Down
12 changes: 6 additions & 6 deletions internal/cmd/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package cmd
import (
"github.com/sapcc/go-api-declarations/limes"
limesresources "github.com/sapcc/go-api-declarations/limes/resources"
"github.com/sapcc/gophercloud-sapcc/resources/v1/domains"
"github.com/sapcc/gophercloud-sapcc/v2/resources/v1/domains"
"github.com/spf13/cobra"

"github.com/sapcc/limesctl/v3/internal/auth"
Expand Down Expand Up @@ -70,13 +70,13 @@ cloud-admin token.`,
return domainList
}

func (d *domainListCmd) Run(_ *cobra.Command, _ []string) error {
func (d *domainListCmd) Run(cmd *cobra.Command, _ []string) error {
outputOpts, err := d.resourceOutputFmtFlags.validate()
if err != nil {
return err
}

res := domains.List(limesResourcesClient, domains.ListOpts{
res := domains.List(cmd.Context(), limesResourcesClient, domains.ListOpts{
Areas: d.areas,
Services: util.CastStringsTo[limes.ServiceType](d.services),
Resources: util.CastStringsTo[limesresources.ResourceName](d.resources),
Expand Down Expand Up @@ -128,7 +128,7 @@ domain-admin token.`,
return domainShow
}

func (d *domainShowCmd) Run(_ *cobra.Command, args []string) error {
func (d *domainShowCmd) Run(cmd *cobra.Command, args []string) error {
outputOpts, err := d.resourceOutputFmtFlags.validate()
if err != nil {
return err
Expand All @@ -138,12 +138,12 @@ func (d *domainShowCmd) Run(_ *cobra.Command, args []string) error {
if len(args) > 0 {
nameOrID = args[0]
}
domainID, err := auth.FindDomainID(identityClient, nameOrID)
domainID, err := auth.FindDomainID(cmd.Context(), identityClient, nameOrID)
if err != nil {
return err
}

res := domains.Get(limesResourcesClient, domainID, domains.GetOpts{
res := domains.Get(cmd.Context(), limesResourcesClient, domainID, domains.GetOpts{
Areas: d.areas,
Services: util.CastStringsTo[limes.ServiceType](d.services),
Resources: util.CastStringsTo[limesresources.ResourceName](d.resources),
Expand Down
6 changes: 3 additions & 3 deletions internal/cmd/ops.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (

"github.com/sapcc/go-api-declarations/limes"
limesresources "github.com/sapcc/go-api-declarations/limes/resources"
"github.com/sapcc/gophercloud-sapcc/resources/v1/projects"
"github.com/sapcc/gophercloud-sapcc/v2/resources/v1/projects"
"github.com/spf13/cobra"

"github.com/sapcc/limesctl/v3/internal/auth"
Expand Down Expand Up @@ -66,11 +66,11 @@ func runValidateQuotaOverrides(cmd *cobra.Command, args []string) error {
}

// get resource report for the project from the current token scope
pInfo, err := auth.FindProject(identityClient, "", "")
pInfo, err := auth.FindProject(cmd.Context(), identityClient, "", "")
if err != nil {
return err
}
report, err := projects.Get(limesResourcesClient, pInfo.DomainID, pInfo.ID, projects.GetOpts{}).Extract()
report, err := projects.Get(cmd.Context(), limesResourcesClient, pInfo.DomainID, pInfo.ID, projects.GetOpts{}).Extract()
if err != nil {
return util.WrapError(err, "could not get project report")
}
Expand Down
Loading

0 comments on commit 0ed1241

Please sign in to comment.