@@ -65,11 +65,14 @@ type InstanceDiskUpdateOptions struct {
6565 Label string `json:"label"`
6666}
6767
68- type InstanceDiskCloneOptions struct {}
68+ // InstanceDiskResizeOptions are InstanceDisk settings that can be used in resizes
69+ type InstanceDiskResizeOptions struct {
70+ Size int `json:"size"`
71+ }
6972
70- // ListInstanceDisks lists InstanceDisks
71- func ( c * Client ) ListInstanceDisks ( ctx context. Context , linodeID int , opts * ListOptions ) ([] InstanceDisk , error ) {
72- return getPaginatedResults [ InstanceDisk ]( ctx , c , formatAPIPath ( "linode/instances/%d/disks" , linodeID ), opts )
73+ // InstanceDiskPasswordResetOptions are InstanceDisk settings that can be used in password resets
74+ type InstanceDiskPasswordResetOptions struct {
75+ Password string `json:"password"`
7376}
7477
7578// UnmarshalJSON implements the json.Unmarshaler interface
@@ -94,6 +97,11 @@ func (i *InstanceDisk) UnmarshalJSON(b []byte) error {
9497 return nil
9598}
9699
100+ // ListInstanceDisks lists InstanceDisks
101+ func (c * Client ) ListInstanceDisks (ctx context.Context , linodeID int , opts * ListOptions ) ([]InstanceDisk , error ) {
102+ return getPaginatedResults [InstanceDisk ](ctx , c , formatAPIPath ("linode/instances/%d/disks" , linodeID ), opts )
103+ }
104+
97105// GetInstanceDisk gets the template with the provided ID
98106func (c * Client ) GetInstanceDisk (ctx context.Context , linodeID int , diskID int ) (* InstanceDisk , error ) {
99107 e := formatAPIPath ("linode/instances/%d/disks/%d" , linodeID , diskID )
@@ -118,21 +126,13 @@ func (c *Client) RenameInstanceDisk(ctx context.Context, linodeID int, diskID in
118126}
119127
120128// ResizeInstanceDisk resizes the size of the Instance disk
121- func (c * Client ) ResizeInstanceDisk (ctx context.Context , linodeID int , diskID int , size int ) error {
122- opts := map [string ]any {
123- "size" : size ,
124- }
125-
129+ func (c * Client ) ResizeInstanceDisk (ctx context.Context , linodeID int , diskID int , opts InstanceDiskResizeOptions ) error {
126130 e := formatAPIPath ("linode/instances/%d/disks/%d/resize" , linodeID , diskID )
127131 return doPOSTRequestNoResponseBody (ctx , c , e , opts )
128132}
129133
130134// PasswordResetInstanceDisk resets the "root" account password on the Instance disk
131- func (c * Client ) PasswordResetInstanceDisk (ctx context.Context , linodeID int , diskID int , password string ) error {
132- opts := map [string ]any {
133- "password" : password ,
134- }
135-
135+ func (c * Client ) PasswordResetInstanceDisk (ctx context.Context , linodeID int , diskID int , opts InstanceDiskPasswordResetOptions ) error {
136136 e := formatAPIPath ("linode/instances/%d/disks/%d/password" , linodeID , diskID )
137137 return doPOSTRequestNoResponseBody (ctx , c , e , opts )
138138}
@@ -144,7 +144,7 @@ func (c *Client) DeleteInstanceDisk(ctx context.Context, linodeID int, diskID in
144144}
145145
146146// CloneInstanceDisk clones the given InstanceDisk for the given Instance
147- func (c * Client ) CloneInstanceDisk (ctx context.Context , linodeID , diskID int , opts InstanceDiskCloneOptions ) (* InstanceDisk , error ) {
147+ func (c * Client ) CloneInstanceDisk (ctx context.Context , linodeID , diskID int ) (* InstanceDisk , error ) {
148148 e := formatAPIPath ("linode/instances/%d/disks/%d/clone" , linodeID , diskID )
149- return doPOSTRequest [InstanceDisk ](ctx , c , e , opts )
149+ return doPOSTRequestNoRequestBody [InstanceDisk ](ctx , c , e )
150150}
0 commit comments