
This contains quite a bit (also bumps google/uuid to 1.3.0). Some HostProcess container improvements to get ready for whenever it goes to stable in Kubernetes, Hyper-V (windows) container support for CRI, and a plethora of other small additions and fixes. Signed-off-by: Daniel Canter <dcanter@microsoft.com>
36 lines
772 B
Go
36 lines
772 B
Go
//go:build windows
|
|
|
|
package runhcs
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
// DeleteOpts is set of options that can be used with the Delete command.
|
|
type DeleteOpts struct {
|
|
// Force forcibly deletes the container if it is still running (uses SIGKILL).
|
|
Force bool
|
|
}
|
|
|
|
func (opt *DeleteOpts) args() ([]string, error) {
|
|
var out []string
|
|
if opt.Force {
|
|
out = append(out, "--force")
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
// Delete any resources held by the container often used with detached
|
|
// containers.
|
|
func (r *Runhcs) Delete(context context.Context, id string, opts *DeleteOpts) error {
|
|
args := []string{"delete"}
|
|
if opts != nil {
|
|
oargs, err := opts.args()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
args = append(args, oargs...)
|
|
}
|
|
return r.runOrError(r.command(context, append(args, id)...))
|
|
}
|