Re-implement basic identity API for v0.2.0.
diff --git a/acceptance/openstack/identity/01-authenticate.go b/acceptance/openstack/identity/01-authenticate.go
index cb766f8..59d64a4 100644
--- a/acceptance/openstack/identity/01-authenticate.go
+++ b/acceptance/openstack/identity/01-authenticate.go
@@ -6,7 +6,7 @@
"github.com/rackspace/gophercloud/openstack/utils"
)
-type extractor func(*identity.TokenDesc) string
+type extractor func(*identity.Token) string
func main() {
// Create an initialized set of authentication options based on available OS_*
@@ -23,7 +23,7 @@
}
// We're authenticated; now let's grab our authentication token.
- t, err := identity.Token(r)
+ t, err := identity.GetToken(r)
if err != nil {
panic(err)
}
@@ -31,8 +31,8 @@
// Authentication tokens have a variety of fields which might be of some interest.
// Let's print a few of them out.
table := map[string]extractor{
- "ID": func(t *identity.TokenDesc) string { return t.Id() },
- "Expires": func(t *identity.TokenDesc) string { return t.Expires() },
+ "ID": func(t *identity.Token) string { return t.Id },
+ "Expires": func(t *identity.Token) string { return t.Expires },
}
for attr, fn := range table {
@@ -42,7 +42,7 @@
// With each authentication, you receive a master directory of all the services
// your account can access. This "service catalog", as OpenStack calls it,
// provides you the means to exploit other OpenStack services.
- sc, err := identity.ServiceCatalog(r)
+ sc, err := identity.GetServiceCatalog(r)
if err != nil {
panic(err)
}
@@ -67,4 +67,3 @@
}
}
}
-
diff --git a/acceptance/openstack/identity/02-extensions.go b/acceptance/openstack/identity/02-extensions.go
new file mode 100644
index 0000000..cc78e54
--- /dev/null
+++ b/acceptance/openstack/identity/02-extensions.go
@@ -0,0 +1,32 @@
+package main
+
+import (
+ "fmt"
+ "github.com/rackspace/gophercloud/openstack/identity"
+ "github.com/rackspace/gophercloud/openstack/utils"
+)
+
+func main() {
+ // Create an initialized set of authentication options based on available OS_*
+ // environment variables.
+ ao, err := utils.AuthOptions()
+ if err != nil {
+ panic(err)
+ }
+
+ // Attempt to query extensions.
+ exts, err := identity.GetExtensions(ao)
+ if err != nil {
+ panic(err)
+ }
+
+ // Print out a summary of supported extensions
+ aliases, err := exts.Aliases()
+ if err != nil {
+ panic(err)
+ }
+ fmt.Println("Extension Aliases:")
+ for _, alias := range aliases {
+ fmt.Printf(" %s\n", alias)
+ }
+}