-
Notifications
You must be signed in to change notification settings - Fork 20
/
cluster_list.go
43 lines (40 loc) · 1.04 KB
/
cluster_list.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Code generated automatically using go:generate. DO NOT EDIT.
package ovirtclient
func (o *oVirtClient) ListClusters(retries ...RetryStrategy) (result []Cluster, err error) {
retries = defaultRetries(retries, defaultReadTimeouts(o))
result = []Cluster{}
err = retry(
"listing clusters",
o.logger,
retries,
func() error {
response, e := o.conn.SystemService().ClustersService().List().Send()
if e != nil {
return e
}
sdkObjects, ok := response.Clusters()
if !ok {
return nil
}
result = make([]Cluster, len(sdkObjects.Slice()))
for i, sdkObject := range sdkObjects.Slice() {
result[i], e = convertSDKCluster(sdkObject, o)
if e != nil {
return wrap(e, EBug, "failed to convert cluster during listing item #%d", i)
}
}
return nil
})
return
}
func (m *mockClient) ListClusters(_ ...RetryStrategy) ([]Cluster, error) {
m.lock.Lock()
defer m.lock.Unlock()
result := make([]Cluster, len(m.clusters))
i := 0
for _, item := range m.clusters {
result[i] = item
i++
}
return result, nil
}