remove mapstructure from blockstorage,cdn,compute,db pkgs
diff --git a/openstack/compute/v2/extensions/keypairs/results.go b/openstack/compute/v2/extensions/keypairs/results.go
index 58a51d2..2b40943 100644
--- a/openstack/compute/v2/extensions/keypairs/results.go
+++ b/openstack/compute/v2/extensions/keypairs/results.go
@@ -1,7 +1,6 @@
package keypairs
import (
- "github.com/mitchellh/mapstructure"
"github.com/gophercloud/gophercloud"
"github.com/gophercloud/gophercloud/pagination"
)
@@ -10,22 +9,22 @@
// servers.
type KeyPair struct {
// Name is used to refer to this keypair from other services within this region.
- Name string `mapstructure:"name"`
+ Name string `json:"name"`
// Fingerprint is a short sequence of bytes that can be used to authenticate or validate a longer
// public key.
- Fingerprint string `mapstructure:"fingerprint"`
+ Fingerprint string `json:"fingerprint"`
// PublicKey is the public key from this pair, in OpenSSH format. "ssh-rsa AAAAB3Nz..."
- PublicKey string `mapstructure:"public_key"`
+ PublicKey string `json:"public_key"`
// PrivateKey is the private key from this pair, in PEM format.
// "-----BEGIN RSA PRIVATE KEY-----\nMIICXA..." It is only present if this keypair was just
// returned from a Create call
- PrivateKey string `mapstructure:"private_key"`
+ PrivateKey string `json:"private_key"`
// UserID is the user who owns this keypair.
- UserID string `mapstructure:"user_id"`
+ UserID string `json:"user_id"`
}
// KeyPairPage stores a single, only page of KeyPair results from a List call.
@@ -41,17 +40,16 @@
// ExtractKeyPairs interprets a page of results as a slice of KeyPairs.
func ExtractKeyPairs(page pagination.Page) ([]KeyPair, error) {
+ r := page.(KeyPairPage)
type pair struct {
- KeyPair KeyPair `mapstructure:"keypair"`
+ KeyPair KeyPair `json:"keypair"`
}
-
- var resp struct {
- KeyPairs []pair `mapstructure:"keypairs"`
+ var s struct {
+ KeyPairs []pair `json:"keypairs"`
}
-
- err := mapstructure.Decode(page.(KeyPairPage).Body, &resp)
- results := make([]KeyPair, len(resp.KeyPairs))
- for i, pair := range resp.KeyPairs {
+ err := r.ExtractInto(&s)
+ results := make([]KeyPair, len(s.KeyPairs))
+ for i, pair := range s.KeyPairs {
results[i] = pair.KeyPair
}
return results, err
@@ -63,16 +61,11 @@
// Extract is a method that attempts to interpret any KeyPair resource response as a KeyPair struct.
func (r keyPairResult) Extract() (*KeyPair, error) {
- if r.Err != nil {
- return nil, r.Err
+ var s struct {
+ KeyPair *KeyPair `json:"keypair"`
}
-
- var res struct {
- KeyPair *KeyPair `json:"keypair" mapstructure:"keypair"`
- }
-
- err := mapstructure.Decode(r.Body, &res)
- return res.KeyPair, err
+ err := r.ExtractInto(&s)
+ return s.KeyPair, err
}
// CreateResult is the response from a Create operation. Call its Extract method to interpret it