-
Notifications
You must be signed in to change notification settings - Fork 21
/
datacenter_list.go
43 lines (40 loc) · 1.08 KB
/
datacenter_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) ListDatacenters(retries ...RetryStrategy) (result []Datacenter, err error) {
retries = defaultRetries(retries, defaultReadTimeouts(o))
result = []Datacenter{}
err = retry(
"listing datacenters",
o.logger,
retries,
func() error {
response, e := o.conn.SystemService().DataCentersService().List().Send()
if e != nil {
return e
}
sdkObjects, ok := response.DataCenters()
if !ok {
return nil
}
result = make([]Datacenter, len(sdkObjects.Slice()))
for i, sdkObject := range sdkObjects.Slice() {
result[i], e = convertSDKDatacenter(sdkObject, o)
if e != nil {
return wrap(e, EBug, "failed to convert datacenter during listing item #%d", i)
}
}
return nil
})
return
}
func (m *mockClient) ListDatacenters(_ ...RetryStrategy) ([]Datacenter, error) {
m.lock.Lock()
defer m.lock.Unlock()
result := make([]Datacenter, len(m.dataCenters))
i := 0
for _, item := range m.dataCenters {
result[i] = item
i++
}
return result, nil
}