Skip to content

Commit 8bd0685

Browse files
committed
Add entropy device method
1 parent f5dcecd commit 8bd0685

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

firecracker.go

+14
Original file line numberDiff line numberDiff line change
@@ -519,3 +519,17 @@ func (f *Client) GetExportVMConfig(opts ...GetExportVMConfigOpt) (*ops.GetExport
519519

520520
return f.client.Operations.GetExportVMConfig(p)
521521
}
522+
523+
type PutEntropyDeviceOpt func(*ops.PutEntropyDeviceParams)
524+
525+
// PutEntropyDevice is a wrapper for the swagger generated client to make calling of the
526+
// API easier.
527+
func (f *Client) PutEntropyDevice(ctx context.Context, opts ...PutEntropyDeviceOpt) (*ops.PutEntropyDeviceNoContent, error) {
528+
p := ops.NewPutEntropyDeviceParams()
529+
p.SetTimeout(time.Duration(f.firecrackerRequestTimeout) * time.Millisecond)
530+
for _, opt := range opts {
531+
opt(p)
532+
}
533+
534+
return f.client.Operations.PutEntropyDevice(p)
535+
}

machine.go

+9
Original file line numberDiff line numberDiff line change
@@ -1281,3 +1281,12 @@ func (m *Machine) UpdateBalloonStats(ctx context.Context, statsPollingIntervals
12811281
m.logger.Debug("UpdateBalloonStats successful")
12821282
return nil
12831283
}
1284+
1285+
func (m *Machine) CreateEntropyDevice(ctx context.Context, opts ...PutEntropyDeviceOpt) error {
1286+
if _, err := m.client.PutEntropyDevice(ctx, opts...); err != nil {
1287+
m.logger.Errorf("CreateEntropyDevice failed: %v", err)
1288+
return err
1289+
}
1290+
m.logger.Debug("UpdateEntropyDevice successful")
1291+
return nil
1292+
}

0 commit comments

Comments
 (0)