Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
This commit is contained in:
Jess Frazelle 2018-09-17 13:39:12 -04:00
parent 6b207b0cf9
commit 1b3e6ee4b5
No known key found for this signature in database
GPG key ID: 18F3685C0022BFF3

View file

@ -7,10 +7,18 @@ import (
"github.com/coreos/clair/api/v3/clairpb"
)
var (
ErrNilGRPCConn = errors.New("grpcConn cannot be nil")
)
// GetAncestry displays an ancestry and all of its features and vulnerabilities.
func (c *Clair) GetAncestry(name string) (*clairpb.GetAncestryResponse_Ancestry, error) {
c.Logf("clair.ancestry.get name=%s", name)
if c.grpcConn == nil {
return nil, ErrNilGRPCConn
}
client := clairpb.NewAncestryServiceClient(c.grpcConn)
resp, err := client.GetAncestry(context.Background(), &clairpb.GetAncestryRequest{
@ -36,15 +44,11 @@ func (c *Clair) PostAncestry(name string, layers []*clairpb.PostAncestryRequest_
c.Logf("clair.ancestry.post name=%s", name)
if c.grpcConn == nil {
return errors.New("grpcConn cannot be nil")
return ErrNilGRPCConn
}
client := clairpb.NewAncestryServiceClient(c.grpcConn)
if client == nil {
return errors.New("could not establish connection to grpc clair api")
}
resp, err := client.PostAncestry(context.Background(), &clairpb.PostAncestryRequest{
AncestryName: name,
Layers: layers,