Merge pull request #131 from rackspace/security-groups-api
Attempt the security group API.
diff --git a/README.asciidoc b/README.asciidoc
index 986918d..a9352b7 100644
--- a/README.asciidoc
+++ b/README.asciidoc
@@ -3,6 +3,8 @@
WARNING: This library is still in the very early stages of development. Unless you want to contribute, it probably isn't what you want.
+The documentation below is obsolete, and will be updated with something shorter and more reasonable soon. In the meantime, the most up to date documentation can be found at link:http://godoc.org/github.com/rackspace/gophercloud[our Godoc.org documentation].
+
=== Getting Started
==== Install the Go Programming Language
Gophercloud provides an Openstack-compatible SDK binding to the Go community.
diff --git a/api_fetch.go b/api_fetch.go
new file mode 100644
index 0000000..54ca9be
--- /dev/null
+++ b/api_fetch.go
@@ -0,0 +1,42 @@
+package gophercloud
+
+import(
+ "github.com/mitchellh/mapstructure"
+)
+
+//The default generic openstack api
+var OpenstackApi = map[string]interface{}{
+ "UrlChoice": PublicURL,
+}
+
+// Api for use with rackspace
+var RackspaceApi = map[string]interface{}{
+ "Name": "cloudServersOpenStack",
+ "VersionId": "2",
+ "UrlChoice": PublicURL,
+}
+
+
+//Populates an ApiCriteria struct with the api values
+//from one of the api maps
+func PopulateApi(variant string) (ApiCriteria, error){
+ var Api ApiCriteria
+ var variantMap map[string]interface{}
+
+ switch variant {
+ case "":
+ variantMap = OpenstackApi
+
+ case "openstack":
+ variantMap = OpenstackApi
+
+ case "rackspace":
+ variantMap = RackspaceApi
+ }
+
+ err := mapstructure.Decode(variantMap,&Api)
+ if err != nil{
+ return Api,err
+ }
+ return Api, err
+}