Skip to content

Commit

Permalink
Add entropy device method
Browse files Browse the repository at this point in the history
  • Loading branch information
protochron committed Sep 21, 2023
1 parent f5dcecd commit 8bd0685
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
14 changes: 14 additions & 0 deletions firecracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -519,3 +519,17 @@ func (f *Client) GetExportVMConfig(opts ...GetExportVMConfigOpt) (*ops.GetExport

return f.client.Operations.GetExportVMConfig(p)
}

type PutEntropyDeviceOpt func(*ops.PutEntropyDeviceParams)

// PutEntropyDevice is a wrapper for the swagger generated client to make calling of the
// API easier.
func (f *Client) PutEntropyDevice(ctx context.Context, opts ...PutEntropyDeviceOpt) (*ops.PutEntropyDeviceNoContent, error) {
p := ops.NewPutEntropyDeviceParams()
p.SetTimeout(time.Duration(f.firecrackerRequestTimeout) * time.Millisecond)
for _, opt := range opts {
opt(p)
}

return f.client.Operations.PutEntropyDevice(p)
}
9 changes: 9 additions & 0 deletions machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -1281,3 +1281,12 @@ func (m *Machine) UpdateBalloonStats(ctx context.Context, statsPollingIntervals
m.logger.Debug("UpdateBalloonStats successful")
return nil
}

func (m *Machine) CreateEntropyDevice(ctx context.Context, opts ...PutEntropyDeviceOpt) error {
if _, err := m.client.PutEntropyDevice(ctx, opts...); err != nil {
m.logger.Errorf("CreateEntropyDevice failed: %v", err)
return err
}
m.logger.Debug("UpdateEntropyDevice successful")
return nil
}

0 comments on commit 8bd0685

Please sign in to comment.