blob: e8c2e82a050222b45907a7b8f4ac4a7ece93aaf5 [file] [log] [blame]
Jamie Hannafordd258b792014-10-24 14:46:41 +02001/*
2Package gophercloud provides a multi-vendor interface to OpenStack-compatible
3clouds. The library has a three-level hierarchy: providers, services, and
4resources.
5
6Provider structs represent the service providers that offer and manage a
7collection of services. Examples of providers include: OpenStack, Rackspace,
8HP. These are defined like so:
9
10 opts := gophercloud.AuthOptions{
11 IdentityEndpoint: "https://my-openstack.com:5000/v2.0",
12 Username: "{username}",
13 Password: "{password}",
14 TenantID: "{tenant_id}",
15 }
16
17 provider, err := openstack.AuthenticatedClient(opts)
18
19Service structs are specific to a provider and handle all of the logic and
20operations for a particular OpenStack service. Examples of services include:
21Compute, Object Storage, Block Storage. In order to define one, you need to
22pass in the parent provider, like so:
23
24 opts := gophercloud.EndpointOpts{Region: "RegionOne"}
25
26 client := openstack.NewComputeV2(provider, opts)
27
28Resource structs are the domain models that services make use of in order
29to work with and represent the state of API resources:
30
31 server, err := servers.Get(client, "{serverId}").Extract()
32
33Another convention is to return Result structs for API operations, which allow
34you to access the HTTP headers, response body, and associated errors with the
35network transaction. To get a resource struct, you then call the Extract
36method which is chained to the response.
37*/
Samuel A. Falvo II1d3fa662013-06-25 15:29:32 -070038package gophercloud