Remove BPA from Makefile
[icn.git] / cmd / bpa-operator / vendor / github.com / gophercloud / gophercloud / pagination / single.go
1 package pagination
2
3 import (
4         "fmt"
5         "reflect"
6
7         "github.com/gophercloud/gophercloud"
8 )
9
10 // SinglePageBase may be embedded in a Page that contains all of the results from an operation at once.
11 type SinglePageBase PageResult
12
13 // NextPageURL always returns "" to indicate that there are no more pages to return.
14 func (current SinglePageBase) NextPageURL() (string, error) {
15         return "", nil
16 }
17
18 // IsEmpty satisifies the IsEmpty method of the Page interface
19 func (current SinglePageBase) IsEmpty() (bool, error) {
20         if b, ok := current.Body.([]interface{}); ok {
21                 return len(b) == 0, nil
22         }
23         err := gophercloud.ErrUnexpectedType{}
24         err.Expected = "[]interface{}"
25         err.Actual = fmt.Sprintf("%v", reflect.TypeOf(current.Body))
26         return true, err
27 }
28
29 // GetBody returns the single page's body. This method is needed to satisfy the
30 // Page interface.
31 func (current SinglePageBase) GetBody() interface{} {
32         return current.Body
33 }