Update gophercloud: Remove v1/appiversions
Using OpenStack service catalog to do version detection
This commit is contained in:
1
vendor/github.com/gophercloud/gophercloud/openstack/BUILD
generated
vendored
1
vendor/github.com/gophercloud/gophercloud/openstack/BUILD
generated
vendored
@@ -29,7 +29,6 @@ filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [
|
||||
":package-srcs",
|
||||
"//vendor/github.com/gophercloud/gophercloud/openstack/blockstorage/v1/apiversions:all-srcs",
|
||||
"//vendor/github.com/gophercloud/gophercloud/openstack/blockstorage/v1/volumes:all-srcs",
|
||||
"//vendor/github.com/gophercloud/gophercloud/openstack/blockstorage/v2/volumes:all-srcs",
|
||||
"//vendor/github.com/gophercloud/gophercloud/openstack/common/extensions:all-srcs",
|
||||
|
30
vendor/github.com/gophercloud/gophercloud/openstack/blockstorage/v1/apiversions/BUILD
generated
vendored
30
vendor/github.com/gophercloud/gophercloud/openstack/blockstorage/v1/apiversions/BUILD
generated
vendored
@@ -1,30 +0,0 @@
|
||||
load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"doc.go",
|
||||
"requests.go",
|
||||
"results.go",
|
||||
"urls.go",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//vendor/github.com/gophercloud/gophercloud:go_default_library",
|
||||
"//vendor/github.com/gophercloud/gophercloud/pagination:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [":package-srcs"],
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
@@ -1,3 +0,0 @@
|
||||
// Package apiversions provides information and interaction with the different
|
||||
// API versions for the OpenStack Block Storage service, code-named Cinder.
|
||||
package apiversions
|
@@ -1,20 +0,0 @@
|
||||
package apiversions
|
||||
|
||||
import (
|
||||
"github.com/gophercloud/gophercloud"
|
||||
"github.com/gophercloud/gophercloud/pagination"
|
||||
)
|
||||
|
||||
// List lists all the Cinder API versions available to end-users.
|
||||
func List(c *gophercloud.ServiceClient) pagination.Pager {
|
||||
return pagination.NewPager(c, listURL(c), func(r pagination.PageResult) pagination.Page {
|
||||
return APIVersionPage{pagination.SinglePageBase(r)}
|
||||
})
|
||||
}
|
||||
|
||||
// Get will retrieve the volume type with the provided ID. To extract the volume
|
||||
// type from the result, call the Extract method on the GetResult.
|
||||
func Get(client *gophercloud.ServiceClient, v string) (r GetResult) {
|
||||
_, r.Err = client.Get(getURL(client, v), &r.Body, nil)
|
||||
return
|
||||
}
|
@@ -1,49 +0,0 @@
|
||||
package apiversions
|
||||
|
||||
import (
|
||||
"github.com/gophercloud/gophercloud"
|
||||
"github.com/gophercloud/gophercloud/pagination"
|
||||
)
|
||||
|
||||
// APIVersion represents an API version for Cinder.
|
||||
type APIVersion struct {
|
||||
ID string `json:"id"` // unique identifier
|
||||
Status string `json:"status"` // current status
|
||||
Updated string `json:"updated"` // date last updated
|
||||
}
|
||||
|
||||
// APIVersionPage is the page returned by a pager when traversing over a
|
||||
// collection of API versions.
|
||||
type APIVersionPage struct {
|
||||
pagination.SinglePageBase
|
||||
}
|
||||
|
||||
// IsEmpty checks whether an APIVersionPage struct is empty.
|
||||
func (r APIVersionPage) IsEmpty() (bool, error) {
|
||||
is, err := ExtractAPIVersions(r)
|
||||
return len(is) == 0, err
|
||||
}
|
||||
|
||||
// ExtractAPIVersions takes a collection page, extracts all of the elements,
|
||||
// and returns them a slice of APIVersion structs. It is effectively a cast.
|
||||
func ExtractAPIVersions(r pagination.Page) ([]APIVersion, error) {
|
||||
var s struct {
|
||||
Versions []APIVersion `json:"versions"`
|
||||
}
|
||||
err := (r.(APIVersionPage)).ExtractInto(&s)
|
||||
return s.Versions, err
|
||||
}
|
||||
|
||||
// GetResult represents the result of a get operation.
|
||||
type GetResult struct {
|
||||
gophercloud.Result
|
||||
}
|
||||
|
||||
// Extract is a function that accepts a result and extracts an API version resource.
|
||||
func (r GetResult) Extract() (*APIVersion, error) {
|
||||
var s struct {
|
||||
Version *APIVersion `json:"version"`
|
||||
}
|
||||
err := r.ExtractInto(&s)
|
||||
return s.Version, err
|
||||
}
|
18
vendor/github.com/gophercloud/gophercloud/openstack/blockstorage/v1/apiversions/urls.go
generated
vendored
18
vendor/github.com/gophercloud/gophercloud/openstack/blockstorage/v1/apiversions/urls.go
generated
vendored
@@ -1,18 +0,0 @@
|
||||
package apiversions
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/gophercloud/gophercloud"
|
||||
)
|
||||
|
||||
func getURL(c *gophercloud.ServiceClient, version string) string {
|
||||
return c.ServiceURL(strings.TrimRight(version, "/") + "/")
|
||||
}
|
||||
|
||||
func listURL(c *gophercloud.ServiceClient) string {
|
||||
u, _ := url.Parse(c.ServiceURL(""))
|
||||
u.Path = "/"
|
||||
return u.String()
|
||||
}
|
Reference in New Issue
Block a user