Adding links and correcting samples
diff --git a/README.md b/README.md
index a731b95..a8a7b3e 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,17 @@
-# gophercloud
+# gophercloud: the OpenStack SDK for Go [](https://travis-ci.org/rackspace/gophercloud)
gophercloud is a flexible SDK that allows you to consume and work with OpenStack
clouds in a simple and idiomatic way using golang. Many services are supported,
including Compute, Block Storage, Object Storage, Networking, and Identity.
-Each service API is backed with documentation, code samples, unit tests and
-acceptance tests.
+Each service API is backed with getting started guides, code samples, reference
+documentation, unit tests and acceptance tests.
+
+## Useful links
+
+* [gophercloud homepage](http://gophercloud.io)
+* [Reference documentation](http://godoc.org/github.com/rackspace/gophercloud)
+* [Getting started guides](http://gophercloud.io/docs)
+* [Effective Go](https://golang.org/doc/effective_go.html)
## How to install
@@ -57,6 +64,12 @@
explicitly, or tell gophercloud to use environment variables:
```go
+import (
+ "github.com/rackspace/gophercloud"
+ "github.com/rackspace/gophercloud/openstack"
+ "github.com/rackspace/gophercloud/openstack/utils"
+)
+
// Option 1: Pass in the values yourself
opts := gophercloud.AuthOptions{
IdentityEndpoint: "https://my-openstack.com:5000/v2.0",
@@ -66,7 +79,6 @@
}
// Option 2: Use a utility function to retrieve all your environment variables
-import "github.com/rackspace/gophercloud/openstack/utils"
opts, err := utils.AuthOptions()
```
@@ -74,8 +86,6 @@
`ProviderClient` struct:
```go
-import "github.com/rackspace/gophercloud/openstack"
-
provider, err := openstack.AuthenticatedClient(opts)
```
@@ -83,6 +93,41 @@
derive from. The provider contains all of the authentication details that allow
your Go code to access the API - such as the base URL and token ID.
+### Provision a server
+
+Once we have a base Provider, we inject it as a dependency into each OpenStack
+service. In order to work with the Compute API, we need a Compute service
+client; which can be created like so:
+
+```go
+client, err := openstack.NewComputeV2(provider, gophercloud.EndpointOpts{
+ Region: os.Getenv("OS_REGION_NAME"),
+})
+```
+
+We then use this `client` for any Compute API operation we want. In our case,
+we want to provision a new server - so we invoke the `Create` method and pass
+in the flavor (hardware specification) and image (operating system) we're
+interested in:
+
+```go
+server, err := servers.Create(client, servers.CreateOpts{
+ Name: "My new server!",
+ FlavorRef: "flavor_id",
+ ImageRef: "image_id",
+}).Extract()
+
+if err != nil {
+ fmt.Printf("Unable to create server for the following reason: %v", err)
+}
+```
+
+If you are unsure about what images and flavors are, you can read our [Compute
+Getting Started guide](http://gophercloud.io/docs/compute). The above code
+sample creates a new server with the parameters, and embodies the new resource
+in the `server` variable (a
+[`servers.Server`](http://godoc.org/github.com/rackspace/gophercloud) struct).
+
### Next steps
Cool! You've handled authentication and got your `ProviderClient`. You're now