Skip to content

Commit

Permalink
Merge pull request #210 from shiftstack/v2-rc1
Browse files Browse the repository at this point in the history
Adapt to path changes in Gophercloud v2
  • Loading branch information
EmilienM authored May 27, 2024
2 parents f79c3b8 + 748d67e commit 1d23291
Show file tree
Hide file tree
Showing 12 changed files with 14 additions and 107 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
fail-fast: false
matrix:
go-version:
- "1.21"
- "1.22"

env:
GO111MODULE: "on"
Expand Down
8 changes: 3 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
module github.com/gophercloud/utils/v2

go 1.22

require (
github.com/gophercloud/gophercloud/v2 v2.0.0-beta.2
github.com/gophercloud/gophercloud/v2 v2.0.0-rc.1
github.com/hashicorp/go-uuid v1.0.3
github.com/mitchellh/go-homedir v1.1.0
golang.org/x/sys v0.20.0
golang.org/x/text v0.15.0
gopkg.in/yaml.v3 v3.0.1
)

go 1.21.6

toolchain go1.21.7
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/gophercloud/gophercloud/v2 v2.0.0-beta.2 h1:JWv6L7eg3+aIS57n11YlVvtn1pVCKpVlMo24ANj/OVc=
github.com/gophercloud/gophercloud/v2 v2.0.0-beta.2/go.mod h1:Sy5GHwY4iazyaRf94rzL/VxJToVWn8WnIH+1cXqoAks=
github.com/gophercloud/gophercloud/v2 v2.0.0-rc.1 h1:B0J9VVGlNuMF/743KMVFScDB8M2Bd5N1KlsEZykSBlc=
github.com/gophercloud/gophercloud/v2 v2.0.0-rc.1/go.mod h1:cwPW9cbJmfBt1c7o/yzXuNjwonhWA+F9Zw8LNQzd3Zk=
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/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
Expand Down
44 changes: 0 additions & 44 deletions openstack/blockstorage/v1/snapshots/utils.go

This file was deleted.

44 changes: 0 additions & 44 deletions openstack/blockstorage/v1/volumes/utils.go

This file was deleted.

2 changes: 1 addition & 1 deletion openstack/blockstorage/v3/availabilityzones/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"

"github.com/gophercloud/gophercloud/v2"
"github.com/gophercloud/gophercloud/v2/openstack/blockstorage/extensions/availabilityzones"
"github.com/gophercloud/gophercloud/v2/openstack/blockstorage/v3/availabilityzones"
)

// ListAvailableAvailabilityZones is a convenience function that return a slice of available Availability Zones.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"

"github.com/gophercloud/gophercloud/v2"
"github.com/gophercloud/gophercloud/v2/openstack/blockstorage/extensions/backups"
"github.com/gophercloud/gophercloud/v2/openstack/blockstorage/v3/backups"
)

// IDFromName is a convenience function that returns a backup's ID given its
Expand Down
4 changes: 1 addition & 3 deletions openstack/clientconfig/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -890,8 +890,6 @@ func NewServiceClient(ctx context.Context, service string, opts *ClientOpts) (*g
return openstack.NewBareMetalV1(pClient, eo)
case "baremetal-introspection":
return openstack.NewBareMetalIntrospectionV1(pClient, eo)
case "clustering":
return openstack.NewClusteringV1(pClient, eo)
case "compute":
return openstack.NewComputeV2(pClient, eo)
case "container":
Expand Down Expand Up @@ -919,7 +917,7 @@ func NewServiceClient(ctx context.Context, service string, opts *ClientOpts) (*g
return nil, fmt.Errorf("invalid identity API version")
}
case "image":
return openstack.NewImageServiceV2(pClient, eo)
return openstack.NewImageV2(pClient, eo)
case "key-manager":
return openstack.NewKeyManagerV1(pClient, eo)
case "load-balancer":
Expand Down
2 changes: 1 addition & 1 deletion openstack/compute/v2/availabilityzones/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"

"github.com/gophercloud/gophercloud/v2"
"github.com/gophercloud/gophercloud/v2/openstack/compute/v2/extensions/availabilityzones"
"github.com/gophercloud/gophercloud/v2/openstack/compute/v2/availabilityzones"
)

// ListAvailableAvailabilityZones is a convenience function that return a slice of available Availability Zones.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"

"github.com/gophercloud/gophercloud/v2"
"github.com/gophercloud/gophercloud/v2/openstack/imageservice/v2/images"
"github.com/gophercloud/gophercloud/v2/openstack/image/v2/images"
)

// IDFromName is a convenience function that returns an image's ID given its
Expand Down
3 changes: 2 additions & 1 deletion openstack/objectstorage/v1/objects/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"os"
"strings"
Expand Down Expand Up @@ -151,7 +152,7 @@ func Upload(ctx context.Context, client *gophercloud.ServiceClient, containerNam
// Check and see if the object being requested already exists.
objectResult := objects.Get(ctx, client, containerName, objectName, nil)
if objectResult.Err != nil {
if _, ok := objectResult.Err.(gophercloud.ErrDefault404); ok {
if gophercloud.ResponseCodeIs(objectResult.Err, http.StatusNotFound) {
origObject = nil
} else {
return nil, fmt.Errorf("error retrieving original object %s/%s: %s", containerName, objectName, objectResult.Err)
Expand Down
4 changes: 1 addition & 3 deletions terraform/auth/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,6 @@ func (c *Config) LoadAndValidate(ctx context.Context) error {
return err
}

client.Context = c.Context

// Set UserAgent
client.UserAgent.Prepend(terraformUserAgent(c.TerraformVersion, c.SDKVersion))

Expand Down Expand Up @@ -327,7 +325,7 @@ func (c *Config) IdentityV3Client(ctx context.Context, region string) (*gophercl
}

func (c *Config) ImageV2Client(ctx context.Context, region string) (*gophercloud.ServiceClient, error) {
return c.CommonServiceClientInit(ctx, openstack.NewImageServiceV2, region, "image")
return c.CommonServiceClientInit(ctx, openstack.NewImageV2, region, "image")
}

func (c *Config) MessagingV2Client(ctx context.Context, region string) (*gophercloud.ServiceClient, error) {
Expand Down

0 comments on commit 1d23291

Please sign in to comment.