aboutsummaryrefslogtreecommitdiff
path: root/pkg/domain/infra/abi/containers_stat.go
blob: 2183d39f09ce2015e319e41a263f0d192fd23488 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package abi

import (
	"context"

	"github.com/containers/podman/v4/pkg/domain/entities"
)

func (ic *ContainerEngine) ContainerStat(ctx context.Context, nameOrID string, containerPath string) (*entities.ContainerStatReport, error) {
	container, err := ic.Libpod.LookupContainer(nameOrID)
	if err != nil {
		return nil, err
	}

	info, err := container.Stat(ctx, containerPath)

	if info != nil {
		return &entities.ContainerStatReport{FileInfo: *info}, err
	}
	return nil, err
}