-
-
Notifications
You must be signed in to change notification settings - Fork 108
/
status.go
39 lines (32 loc) · 857 Bytes
/
status.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
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package storage
import (
"context"
"fmt"
"net/http"
"github.com/bpg/terraform-provider-proxmox/proxmox/api"
)
// GetDatastoreStatus gets status information for a given datastore.
func (c *Client) GetDatastoreStatus(
ctx context.Context,
) (*DatastoreGetStatusResponseData, error) {
resBody := &DatastoreGetStatusResponseBody{}
err := c.DoRequest(
ctx,
http.MethodGet,
c.ExpandPath("status"),
nil,
resBody,
)
if err != nil {
return nil, fmt.Errorf("error retrieving status for datastore %s: %w", c.StorageName, err)
}
if resBody.Data == nil {
return nil, api.ErrNoDataObjectInResponse
}
return resBody.Data, nil
}