blob: da6ad2fdcc0c00beb103a984af6b6e08cee16873 [file] [log] [blame]
Jon Perritt85ed5232015-01-16 09:14:51 -07001package base
2
3import (
4 "github.com/mitchellh/mapstructure"
5 "github.com/rackspace/gophercloud"
6)
7
8// HomeDocument is a resource that contains all the resources for the CDN API.
9type HomeDocument map[string]interface{}
10
11// GetResult represents the result of a Get operation.
12type GetResult struct {
13 gophercloud.Result
14}
15
16// Extract is a function that accepts a result and extracts a home document resource.
17func (r GetResult) Extract() (*HomeDocument, error) {
18 if r.Err != nil {
19 return nil, r.Err
20 }
21
22 var res struct {
23 HomeDocument *HomeDocument `mapstructure:"resources"`
24 }
25
26 err := mapstructure.Decode(r.Body, &res)
27
28 return res.HomeDocument, err
29}
30
31// PingResult represents the result of a Ping operation.
32type PingResult struct {
33 gophercloud.ErrResult
34}