Use build tags to prevent accidental run of acceptance tests
diff --git a/acceptance/rackspace/monitoring/pkg.go b/acceptance/rackspace/monitoring/pkg.go
new file mode 100644
index 0000000..de6924d
--- /dev/null
+++ b/acceptance/rackspace/monitoring/pkg.go
@@ -0,0 +1,4 @@
+// +build acceptance
+
+package monitoring
+
diff --git a/acceptance/rackspace/monitoring/rbac_test.go b/acceptance/rackspace/monitoring/rbac_test.go
new file mode 100644
index 0000000..a6d1d54
--- /dev/null
+++ b/acceptance/rackspace/monitoring/rbac_test.go
@@ -0,0 +1,67 @@
+// +build acceptance
+
+package monitoring
+
+import (
+ "fmt"
+ "github.com/rackspace/gophercloud/openstack/identity"
+ "github.com/rackspace/gophercloud/openstack/utils"
+ "github.com/rackspace/gophercloud/rackspace/monitoring"
+ "github.com/rackspace/gophercloud/rackspace/monitoring/notificationPlans"
+ "testing"
+)
+
+func TestRBACPermissions(t *testing.T) {
+ ao, err := utils.AuthOptions()
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ ao.AllowReauth = true
+ r, err := identity.Authenticate(ao)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ // Find the cloud monitoring API
+
+ sc, err := identity.GetServiceCatalog(r)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ ces, err := sc.CatalogEntries()
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ monUrl, err := findMonitoringEndpoint(ces)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ // Build ourselves an interface to cloud monitoring!
+
+ np := notificationPlans.NewClient(monitoring.Options{
+ Endpoint: monUrl,
+ AuthOptions: ao,
+ Authentication: r,
+ })
+
+ // Try to delete a bogus notification plan
+
+ dr, err := np.Delete("ajkhdlkajhdflkajshdf")
+ if err != nil {
+ fmt.Printf("%#v\n", err)
+ }
+ fmt.Printf("%#v\n", dr)
+}
+
+func findMonitoringEndpoint(ces []identity.CatalogEntry) (string, error) {
+ for _, ce := range ces {
+ if ce.Type == "rax:monitor" {
+ return ce.Endpoints[0].PublicURL, nil
+ }
+ }
+ return "", fmt.Errorf("No monitoring API in the service catalog")
+}