-
Notifications
You must be signed in to change notification settings - Fork 3
/
computeResourcesStorage.go
33 lines (29 loc) · 1.11 KB
/
computeResourcesStorage.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
package solus
import (
"context"
"fmt"
)
// ComputeResourceStorageCreateRequest represents available properties for creating
// a new storage on a compute resource.
type ComputeResourceStorageCreateRequest struct {
Type StorageTypeName `json:"type"`
Path string `json:"path"`
ThinPool string `json:"thin_pool,omitempty"`
IsAvailableForBalancing bool `json:"is_available_for_balancing"`
}
// StorageCreate creates a new storage for the specified compute resource.
func (s *ComputeResourcesService) StorageCreate(
ctx context.Context,
id int,
data ComputeResourceStorageCreateRequest,
) (Storage, error) {
var resp storageResponse
return resp.Data, s.client.create(ctx, fmt.Sprintf("compute_resources/%d/storages", id), data, &resp)
}
// StorageList lists storages for the specified compute resource.
func (s *ComputeResourcesService) StorageList(ctx context.Context, id int) ([]Storage, error) {
var resp struct {
Data []Storage `json:"data"`
}
return resp.Data, s.client.get(ctx, fmt.Sprintf("compute_resources/%d/storages", id), &resp)
}