-
Notifications
You must be signed in to change notification settings - Fork 20
/
storagedomain_get.go
49 lines (45 loc) · 1.18 KB
/
storagedomain_get.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
44
45
46
47
48
49
// Code generated automatically using go:generate. DO NOT EDIT.
package ovirtclient
import (
"fmt"
)
func (o *oVirtClient) GetStorageDomain(id StorageDomainID, retries ...RetryStrategy) (result StorageDomain, err error) {
retries = defaultRetries(retries, defaultReadTimeouts(o))
err = retry(
fmt.Sprintf("getting storage domain %s", id),
o.logger,
retries,
func() error {
response, err := o.conn.SystemService().StorageDomainsService().StorageDomainService(string(id)).Get().Send()
if err != nil {
return err
}
sdkObject, ok := response.StorageDomain()
if !ok {
return newError(
ENotFound,
"no storage domain returned when getting storage domain ID %s",
id,
)
}
result, err = convertSDKStorageDomain(sdkObject, o)
if err != nil {
return wrap(
err,
EBug,
"failed to convert storage domain %s",
id,
)
}
return nil
})
return
}
func (m *mockClient) GetStorageDomain(id StorageDomainID, _ ...RetryStrategy) (StorageDomain, error) {
m.lock.Lock()
defer m.lock.Unlock()
if item, ok := m.storageDomains[id]; ok {
return item, nil
}
return nil, newError(ENotFound, "storage domain with ID %s not found", id)
}