@@ -117,6 +117,18 @@ type InstanceTransfer struct {
117
117
Quota int `json:"quota"`
118
118
}
119
119
120
+ // MonthlyInstanceTransferStats pool stats for a Linode Instance network transfer statistics for a specific month
121
+ type MonthlyInstanceTransferStats struct {
122
+ // The amount of inbound public network traffic received by this Linode, in bytes, for a specific year/month.
123
+ BytesIn int `json:"bytes_in"`
124
+
125
+ // The amount of outbound public network traffic sent by this Linode, in bytes, for a specific year/month.
126
+ BytesOut int `json:"bytes_out"`
127
+
128
+ // The total amount of public network traffic sent and received by this Linode, in bytes, for a specific year/month.
129
+ BytesTotal int `json:"bytes_total"`
130
+ }
131
+
120
132
// InstancePlacementGroup represents information about the placement group
121
133
// this Linode is a part of.
122
134
type InstancePlacementGroup struct {
@@ -133,6 +145,11 @@ type InstanceMetadataOptions struct {
133
145
UserData string `json:"user_data,omitempty"`
134
146
}
135
147
148
+ // InstancePasswordResetOptions specifies the new password for the Linode
149
+ type InstancePasswordResetOptions struct {
150
+ RootPass string `json:"root_pass"`
151
+ }
152
+
136
153
// InstanceCreateOptions require only Region and Type
137
154
type InstanceCreateOptions struct {
138
155
Region string `json:"region"`
@@ -278,7 +295,7 @@ func (c *Client) GetInstance(ctx context.Context, linodeID int) (*Instance, erro
278
295
return response , nil
279
296
}
280
297
281
- // GetInstanceTransfer gets the instance with the provided ID
298
+ // GetInstanceTransfer gets the instance's network transfer pool statistics for the current month.
282
299
func (c * Client ) GetInstanceTransfer (ctx context.Context , linodeID int ) (* InstanceTransfer , error ) {
283
300
e := formatAPIPath ("linode/instances/%d/transfer" , linodeID )
284
301
response , err := doGETRequest [InstanceTransfer ](ctx , c , e )
@@ -289,6 +306,12 @@ func (c *Client) GetInstanceTransfer(ctx context.Context, linodeID int) (*Instan
289
306
return response , nil
290
307
}
291
308
309
+ // GetInstanceTransferMonthly gets the instance's network transfer pool statistics for a specific month.
310
+ func (c * Client ) GetInstanceTransferMonthly (ctx context.Context , linodeID , year , month int ) (* MonthlyInstanceTransferStats , error ) {
311
+ e := formatAPIPath ("linode/instances/%d/transfer/%d/%d" , linodeID , year , month )
312
+ return doGETRequest [MonthlyInstanceTransferStats ](ctx , c , e )
313
+ }
314
+
292
315
// CreateInstance creates a Linode instance
293
316
func (c * Client ) CreateInstance (ctx context.Context , opts InstanceCreateOptions ) (* Instance , error ) {
294
317
e := "linode/instances"
@@ -348,6 +371,14 @@ func (c *Client) CloneInstance(ctx context.Context, linodeID int, opts InstanceC
348
371
return response , nil
349
372
}
350
373
374
+ // ResetInstancePassword resets a Linode instance's root password
375
+ func (c * Client ) ResetInstancePassword (ctx context.Context , linodeID int , opts InstancePasswordResetOptions ) error {
376
+ e := formatAPIPath ("linode/instances/%d/password" , linodeID )
377
+ _ , err := doPOSTRequest [Instance ](ctx , c , e , opts )
378
+
379
+ return err
380
+ }
381
+
351
382
// RebootInstance reboots a Linode instance
352
383
// A configID of 0 will cause Linode to choose the last/best config
353
384
func (c * Client ) RebootInstance (ctx context.Context , linodeID int , configID int ) error {
0 commit comments