mirror of
https://github.com/eliasstepanik/SimpleFunctions.git
synced 2026-01-11 13:48:29 +00:00
22 lines
682 B
C#
22 lines
682 B
C#
using Docker.DotNet;
|
|
using Docker.DotNet.Models;
|
|
|
|
namespace TestFunction;
|
|
|
|
public class Test
|
|
{
|
|
public static async Task<ContainerStatsResponse> GetLoad(string containerId)
|
|
{
|
|
ContainerStatsParameters parameters = new ContainerStatsParameters()
|
|
{
|
|
Stream = false,
|
|
};
|
|
var response = new ContainerStatsResponse();
|
|
|
|
IProgress<ContainerStatsResponse> progress = new Progress<ContainerStatsResponse>(stats => { response = stats; });
|
|
|
|
var _docker = new DockerClientConfiguration().CreateClient();
|
|
await _docker.Containers.GetContainerStatsAsync(containerId,parameters, progress);
|
|
return response;
|
|
}
|
|
} |