Files
Valentin Rothberg bd09b7aa79 bump go module to version 4
Automated for .go files via gomove [1]:
`gomove github.com/containers/podman/v3 github.com/containers/podman/v4`

Remaining files via vgrep [2]:
`vgrep github.com/containers/podman/v3`

[1] https://github.com/KSubedi/gomove
[2] https://github.com/vrothberg/vgrep

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2022-01-18 12:47:07 +01:00

35 lines
919 B
Go

package containers
import (
"context"
"net/http"
"github.com/containers/podman/v4/pkg/api/handlers"
"github.com/containers/podman/v4/pkg/bindings"
)
// Commit creates a container image from a container. The container is defined by nameOrID. Use
// the CommitOptions for finer grain control on characteristics of the resulting image.
func Commit(ctx context.Context, nameOrID string, options *CommitOptions) (handlers.IDResponse, error) {
if options == nil {
options = new(CommitOptions)
}
id := handlers.IDResponse{}
conn, err := bindings.GetClient(ctx)
if err != nil {
return id, err
}
params, err := options.ToParams()
if err != nil {
return handlers.IDResponse{}, err
}
params.Set("container", nameOrID)
response, err := conn.DoRequest(ctx, nil, http.MethodPost, "/commit", params, nil)
if err != nil {
return id, err
}
defer response.Body.Close()
return id, response.Process(&id)
}