Files
Lewis Roy 23ebb7d94c feat: add Podman artifact support to Go bindings and remote clients
Add the Go bindings implementation necessary to support Artifacts.
Implement the tunnel interface that consumes the Artifacts Go bindings.

With this patch, users of the Podman remote clients will now be able to
manage OCI artifacts via the Podman CLI and Podman machine.

Jira: https://issues.redhat.com/browse/RUN-2714#

Signed-off-by: Lewis Roy <lewis@redhat.com>
2025-08-01 00:10:50 +10:00

43 lines
955 B
Go

package artifacts
import (
"context"
"io"
"net/http"
"github.com/containers/podman/v5/pkg/bindings"
entitiesTypes "github.com/containers/podman/v5/pkg/domain/entities/types"
)
func Add(ctx context.Context, artifactName string, blobName string, artifactBlob io.Reader, options *AddOptions) (*entitiesTypes.ArtifactAddReport, error) {
conn, err := bindings.GetClient(ctx)
if err != nil {
return nil, err
}
if options == nil {
options = new(AddOptions)
}
params, err := options.ToParams()
if err != nil {
return nil, err
}
params.Set("name", artifactName)
params.Set("fileName", blobName)
response, err := conn.DoRequest(ctx, artifactBlob, http.MethodPost, "/artifacts/add", params, nil)
if err != nil {
return nil, err
}
defer response.Body.Close()
var artifactAddReport entitiesTypes.ArtifactAddReport
if err := response.Process(&artifactAddReport); err != nil {
return nil, err
}
return &artifactAddReport, nil
}