@@ -117,6 +117,18 @@ type InstanceTransfer struct {
117117 Quota int `json:"quota"`
118118}
119119
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+
120132// InstancePlacementGroup represents information about the placement group
121133// this Linode is a part of.
122134type InstancePlacementGroup struct {
@@ -133,6 +145,11 @@ type InstanceMetadataOptions struct {
133145 UserData string `json:"user_data,omitempty"`
134146}
135147
148+ // InstancePasswordResetOptions specifies the new password for the Linode
149+ type InstancePasswordResetOptions struct {
150+ RootPass string `json:"root_pass"`
151+ }
152+
136153// InstanceCreateOptions require only Region and Type
137154type InstanceCreateOptions struct {
138155 Region string `json:"region"`
@@ -278,7 +295,7 @@ func (c *Client) GetInstance(ctx context.Context, linodeID int) (*Instance, erro
278295 return response , nil
279296}
280297
281- // GetInstanceTransfer gets the instance with the provided ID
298+ // GetInstanceTransfer gets the instance's network transfer pool statistics for the current month.
282299func (c * Client ) GetInstanceTransfer (ctx context.Context , linodeID int ) (* InstanceTransfer , error ) {
283300 e := formatAPIPath ("linode/instances/%d/transfer" , linodeID )
284301 response , err := doGETRequest [InstanceTransfer ](ctx , c , e )
@@ -289,6 +306,12 @@ func (c *Client) GetInstanceTransfer(ctx context.Context, linodeID int) (*Instan
289306 return response , nil
290307}
291308
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+
292315// CreateInstance creates a Linode instance
293316func (c * Client ) CreateInstance (ctx context.Context , opts InstanceCreateOptions ) (* Instance , error ) {
294317 e := "linode/instances"
@@ -348,6 +371,14 @@ func (c *Client) CloneInstance(ctx context.Context, linodeID int, opts InstanceC
348371 return response , nil
349372}
350373
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+
351382// RebootInstance reboots a Linode instance
352383// A configID of 0 will cause Linode to choose the last/best config
353384func (c * Client ) RebootInstance (ctx context.Context , linodeID int , configID int ) error {
0 commit comments