Repository navigation
Expand file tree
/
Copy pathstorage_volumes_gen.go
More file actions
166 lines (144 loc) · 6.22 KB
/
Copy pathstorage_volumes_gen.go
File metadata and controls
166 lines (144 loc) · 6.22 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
/*
Copyright 2026 Hyperbolic Labs, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by internal/gen from openapi/openapi.json and openapi/sdk.yaml. DO NOT EDIT.
package hyperbolic
import (
"context"
"net/http"
)
// StorageVolumesService manages network storage volumes and their attachments.
type StorageVolumesService struct {
t *transport
}
// Attach calls POST /v2/on-demand/storage-volumes/attach: attach a storage
// volume to bare metal instance(s).
func (s *StorageVolumesService) Attach(ctx context.Context, params AttachStorageVolumeParams) (*AttachStorageVolumeResponse, error) {
c := call{method: http.MethodPost, path: "/v2/on-demand/storage-volumes/attach", idempotent: true, body: params}
var out AttachStorageVolumeResponse
if err := s.t.do(ctx, c, &out); err != nil {
return nil, err
}
return &out, nil
}
// Create calls POST /v2/on-demand/storage-volumes: create a storage volume.
//
// It is not retried after a failure that may have reached the server. Such a
// failure matches [ErrOutcomeUnknown]: check whether the call took effect
// before making it again.
func (s *StorageVolumesService) Create(ctx context.Context, params CreateStorageVolumeParams) (*CreatedStorageVolume, error) {
c := call{method: http.MethodPost, path: "/v2/on-demand/storage-volumes", idempotent: false, body: params}
var out CreatedStorageVolume
if err := s.t.do(ctx, c, &out); err != nil {
return nil, err
}
return &out, nil
}
// List calls GET /v2/on-demand/storage-volumes: get a list of storage volumes.
func (s *StorageVolumesService) List(ctx context.Context) ([]StorageVolume, error) {
c := call{method: http.MethodGet, path: "/v2/on-demand/storage-volumes", idempotent: true}
var out []StorageVolume
if err := s.t.do(ctx, c, &out); err != nil {
return nil, err
}
return out, nil
}
// Options calls GET /v2/on-demand/storage-volume-options: get a list of storage
// volume options.
func (s *StorageVolumesService) Options(ctx context.Context) ([]StorageVolumeOption, error) {
c := call{method: http.MethodGet, path: "/v2/on-demand/storage-volume-options", idempotent: true}
var out []StorageVolumeOption
if err := s.t.do(ctx, c, &out); err != nil {
return nil, err
}
return out, nil
}
// Terminate calls POST /v2/on-demand/storage-volumes/terminate: terminate a
// storage volume.
func (s *StorageVolumesService) Terminate(ctx context.Context, params TerminateStorageVolumeParams) (*TerminateStorageVolumeResponse, error) {
c := call{method: http.MethodPost, path: "/v2/on-demand/storage-volumes/terminate", idempotent: true, body: params}
var out TerminateStorageVolumeResponse
if err := s.t.do(ctx, c, &out); err != nil {
return nil, err
}
return &out, nil
}
// Update calls POST /v2/on-demand/storage-volumes/update: update a storage
// volume.
//
// Update a storage volume's attached instances and/or size
func (s *StorageVolumesService) Update(ctx context.Context, params UpdateStorageVolumeParams) (*UpdateStorageVolumeResponse, error) {
c := call{method: http.MethodPost, path: "/v2/on-demand/storage-volumes/update", idempotent: true, body: params}
var out UpdateStorageVolumeResponse
if err := s.t.do(ctx, c, &out); err != nil {
return nil, err
}
return &out, nil
}
// AttachStorageVolumeParams defines model for AttachStorageVolumeParams.
type AttachStorageVolumeParams struct {
RentalIds []string `json:"rentalIds"`
StorageVolumeID string `json:"storageVolumeId"`
}
// AttachStorageVolumeResponse Confirmation that a storage volume is being attached.
type AttachStorageVolumeResponse struct {
AttachedRentalIds []string `json:"attachedRentalIds"`
Message string `json:"message"`
StorageVolumeID string `json:"storageVolumeId"`
}
// CreateStorageVolumeParams defines model for CreateStorageVolumeParams.
type CreateStorageVolumeParams struct {
Label string `json:"label"`
Region string `json:"region"`
RentalIds *[]string `json:"rentalIds,omitempty"`
SizeInGb int `json:"sizeInGb"`
}
// CreatedStorageVolume A newly created storage volume.
type CreatedStorageVolume struct {
AttachedRentalIds []string `json:"attachedRentalIds"`
Label string `json:"label"`
Message string `json:"message"`
Region string `json:"region"`
SizeInGb int `json:"sizeInGb"`
Status StorageVolumeStatus `json:"status"`
StorageVolumeID string `json:"storageVolumeId"`
}
// StorageVolumeOption defines model for StorageVolumeOption.
type StorageVolumeOption struct {
CostPerGbHourCents float64 `json:"costPerGbHourCents"`
MaxSizeInGb int `json:"maxSizeInGb"`
Region string `json:"region"`
}
// TerminateStorageVolumeParams defines model for TerminateStorageVolumeParams.
type TerminateStorageVolumeParams struct {
Reason *string `json:"reason,omitempty"`
StorageVolumeID string `json:"storageVolumeId"`
}
// TerminateStorageVolumeResponse Confirmation that a storage volume is terminating.
type TerminateStorageVolumeResponse struct {
Message string `json:"message"`
StorageVolumeID string `json:"storageVolumeId"`
}
// UpdateStorageVolumeParams defines model for UpdateStorageVolumeParams.
type UpdateStorageVolumeParams struct {
Label *string `json:"label,omitempty"`
RentalIds *[]string `json:"rentalIds,omitempty"`
SizeInGb *int `json:"sizeInGb,omitempty"`
StorageVolumeID string `json:"storageVolumeId"`
}
// UpdateStorageVolumeResponse Confirmation that a storage volume is being updated.
type UpdateStorageVolumeResponse struct {
AttachedRentalIds []string `json:"attachedRentalIds"`
Message string `json:"message"`
SizeInGb int `json:"sizeInGb"`
StorageVolumeID string `json:"storageVolumeId"`
}