github.com/hanks177/podman/v4@v4.1.3-0.20220613032544-16d90015bc83/pkg/domain/infra/abi/healthcheck.go (about)

     1  package abi
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/hanks177/podman/v4/libpod/define"
     7  	"github.com/hanks177/podman/v4/pkg/domain/entities"
     8  )
     9  
    10  func (ic *ContainerEngine) HealthCheckRun(ctx context.Context, nameOrID string, options entities.HealthCheckOptions) (*define.HealthCheckResults, error) {
    11  	status, err := ic.Libpod.HealthCheck(nameOrID)
    12  	if err != nil {
    13  		return nil, err
    14  	}
    15  	hcStatus := define.HealthCheckUnhealthy
    16  	if status == define.HealthCheckSuccess {
    17  		hcStatus = define.HealthCheckHealthy
    18  	}
    19  	report := define.HealthCheckResults{
    20  		Status: hcStatus,
    21  	}
    22  	return &report, nil
    23  }