api/v3/clairpb: document and regenerate protos

This commit is contained in:
Jimmy Zelinskie 2018-04-05 17:02:13 -04:00
parent a5b3e747a0
commit 6b9f668ea0
5 changed files with 855 additions and 659 deletions

File diff suppressed because it is too large Load Diff

View File

@ -28,21 +28,6 @@ var _ status.Status
var _ = runtime.String var _ = runtime.String
var _ = utilities.NewDoubleArray var _ = utilities.NewDoubleArray
func request_AncestryService_PostAncestry_0(ctx context.Context, marshaler runtime.Marshaler, client AncestryServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq PostAncestryRequest
var metadata runtime.ServerMetadata
if req.ContentLength > 0 {
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
}
msg, err := client.PostAncestry(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
var ( var (
filter_AncestryService_GetAncestry_0 = &utilities.DoubleArray{Encoding: map[string]int{"ancestry_name": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} filter_AncestryService_GetAncestry_0 = &utilities.DoubleArray{Encoding: map[string]int{"ancestry_name": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
) )
@ -78,6 +63,21 @@ func request_AncestryService_GetAncestry_0(ctx context.Context, marshaler runtim
} }
func request_AncestryService_PostAncestry_0(ctx context.Context, marshaler runtime.Marshaler, client AncestryServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq PostAncestryRequest
var metadata runtime.ServerMetadata
if req.ContentLength > 0 {
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
}
msg, err := client.PostAncestry(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
var ( var (
filter_NotificationService_GetNotification_0 = &utilities.DoubleArray{Encoding: map[string]int{"name": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} filter_NotificationService_GetNotification_0 = &utilities.DoubleArray{Encoding: map[string]int{"name": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
) )
@ -178,35 +178,6 @@ func RegisterAncestryServiceHandler(ctx context.Context, mux *runtime.ServeMux,
// "AncestryServiceClient" to call the correct interceptors. // "AncestryServiceClient" to call the correct interceptors.
func RegisterAncestryServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AncestryServiceClient) error { func RegisterAncestryServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AncestryServiceClient) error {
mux.Handle("POST", pattern_AncestryService_PostAncestry_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
if cn, ok := w.(http.CloseNotifier); ok {
go func(done <-chan struct{}, closed <-chan bool) {
select {
case <-done:
case <-closed:
cancel()
}
}(ctx.Done(), cn.CloseNotify())
}
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_AncestryService_PostAncestry_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_AncestryService_PostAncestry_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_AncestryService_GetAncestry_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { mux.Handle("GET", pattern_AncestryService_GetAncestry_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context()) ctx, cancel := context.WithCancel(req.Context())
defer cancel() defer cancel()
@ -236,19 +207,48 @@ func RegisterAncestryServiceHandlerClient(ctx context.Context, mux *runtime.Serv
}) })
mux.Handle("POST", pattern_AncestryService_PostAncestry_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
if cn, ok := w.(http.CloseNotifier); ok {
go func(done <-chan struct{}, closed <-chan bool) {
select {
case <-done:
case <-closed:
cancel()
}
}(ctx.Done(), cn.CloseNotify())
}
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_AncestryService_PostAncestry_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_AncestryService_PostAncestry_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil return nil
} }
var ( var (
pattern_AncestryService_PostAncestry_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"ancestry"}, ""))
pattern_AncestryService_GetAncestry_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"ancestry", "ancestry_name"}, "")) pattern_AncestryService_GetAncestry_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"ancestry", "ancestry_name"}, ""))
pattern_AncestryService_PostAncestry_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"ancestry"}, ""))
) )
var ( var (
forward_AncestryService_PostAncestry_0 = runtime.ForwardResponseMessage
forward_AncestryService_GetAncestry_0 = runtime.ForwardResponseMessage forward_AncestryService_GetAncestry_0 = runtime.ForwardResponseMessage
forward_AncestryService_PostAncestry_0 = runtime.ForwardResponseMessage
) )
// RegisterNotificationServiceHandlerFromEndpoint is same as RegisterNotificationServiceHandler but // RegisterNotificationServiceHandlerFromEndpoint is same as RegisterNotificationServiceHandler but

View File

@ -1,4 +1,4 @@
// Copyright 2017 clair authors // Copyright 2018 clair authors
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
@ -16,150 +16,239 @@ syntax = "proto3";
option go_package = "clairpb"; option go_package = "clairpb";
package clairpb; package clairpb;
import "google/api/annotations.proto"; import "google/api/annotations.proto";
import "google/protobuf/empty.proto"; import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto"; import "google/protobuf/timestamp.proto";
message Vulnerability { message Vulnerability {
string name = 1; // The name of the vulnerability.
string namespace_name = 2; string name = 1;
string description = 3;
string link = 4; // The name of the namespace in which the vulnerability was detected.
string severity = 5; string namespace_name = 2;
string metadata = 6;
// fixed_by exists when vulnerability is under feature. // A description of the vulnerability according to the source for the namespace.
string fixed_by = 7; string description = 3;
// affected_versions exists when vulnerability is under notification.
repeated Feature affected_versions = 8; // A link to the vulnerability according to the source for the namespace.
string link = 4;
// How dangerous the vulnerability is.
string severity = 5;
// Namespace agnostic metadata about the vulnerability.
string metadata = 6;
// The feature that fixes this vulnerability.
// This field only exists when a vulnerability is a part of a Feature.
string fixed_by = 7;
// The Features that are affected by the vulnerability.
// This field only exists when a vulnerability is a part of a Notification.
repeated Feature affected_versions = 8;
} }
message ClairStatus { message Feature {
// listers and detectors are processors implemented in this Clair and used to // The name of the feature.
// scan ancestries string name = 1;
repeated string listers = 1;
repeated string detectors = 2;
google.protobuf.Timestamp last_update_time = 3;
}
message Feature{ // The name of the namespace in which the feature is detected.
string name = 1; string namespace_name = 2;
string namespace_name = 2;
string version = 3;
// version_format is the format used by installer package manager to store // The specific version of this feature.
// package versions. string version = 3;
string version_format = 4;
repeated Vulnerability vulnerabilities = 5;
}
message Ancestry { // The format used to parse version numbers for the feature.
string name = 1; string version_format = 4;
repeated Feature features = 2;
repeated Layer layers = 3;
// scanned_listers and scanned_detectors are used to scan this ancestry, it // The list of vulnerabilities that affect the feature.
// may be different from listers and detectors in ClairStatus since the repeated Vulnerability vulnerabilities = 5;
// ancestry could be scanned by previous version of Clair.
repeated string scanned_listers = 4;
repeated string scanned_detectors = 5;
} }
message Layer { message Layer {
string hash = 1; // The sha256 tarsum for the layer.
string hash = 1;
} }
message Notification { service AncestryService {
string name = 1; // The RPC used to read the results of scanning for a particular ancestry.
string created = 2; rpc GetAncestry(GetAncestryRequest) returns (GetAncestryResponse) {
string notified = 3; option (google.api.http) = {
string deleted = 4; get: "/ancestry/{ancestry_name}"
PagedVulnerableAncestries old = 5; };
PagedVulnerableAncestries new = 6; }
// The RPC used to create a new scan of an ancestry.
rpc PostAncestry(PostAncestryRequest) returns (PostAncestryResponse) {
option (google.api.http) = {
post: "/ancestry"
body: "*"
};
}
} }
message IndexedAncestryName { message ClairStatus {
// index is unique to name in all streams simultaneously streamed, increasing // The configured list of feature listers used to scan an ancestry.
// and larger than all indexes in previous page in same stream. repeated string listers = 1;
int32 index = 1;
string name = 2;
}
message PagedVulnerableAncestries { // The configured list of namespace detectors used to scan an ancestry.
string current_page = 1; repeated string detectors = 2;
// if next_page is empty, it signals the end of all pages.
string next_page = 2;
int32 limit = 3;
Vulnerability vulnerability = 4;
repeated IndexedAncestryName ancestries = 5;
}
message PostAncestryRequest { // The time at which the updater last ran.
message PostLayer { google.protobuf.Timestamp last_update_time = 3;
string hash = 1;
string path = 2;
map<string, string> headers = 3;
}
string ancestry_name = 1;
string format = 2;
repeated PostLayer layers = 3;
}
message PostAncestryResponse {
ClairStatus status = 1;
} }
message GetAncestryRequest { message GetAncestryRequest {
string ancestry_name = 1; // The name of the desired ancestry.
bool with_vulnerabilities = 2; string ancestry_name = 1;
bool with_features = 3;
// Whether to include vulnerabilities or not in the response.
bool with_vulnerabilities = 2;
// Whether to include features or not in the response.
bool with_features = 3;
} }
message GetAncestryResponse { message GetAncestryResponse {
Ancestry ancestry = 1; message Ancestry {
ClairStatus status = 2; // The name of the desired ancestry.
string name = 1;
// The list of features present in the ancestry.
// This will only be provided if requested.
repeated Feature features = 2;
// The layers present in the ancestry.
repeated Layer layers = 3;
// The configured list of feature listers used to scan this ancestry.
repeated string scanned_listers = 4;
// The configured list of namespace detectors used to scan an ancestry.
repeated string scanned_detectors = 5;
}
// The ancestry requested.
Ancestry ancestry = 1;
// The status of Clair at the time of the request.
ClairStatus status = 2;
}
message PostAncestryRequest {
message PostLayer {
// The hash of the layer.
string hash = 1;
// The location of the layer (URL or filepath).
string path = 2;
// Any HTTP Headers that need to be used if requesting a layer over HTTP(S).
map<string, string> headers = 3;
}
// The name of the ancestry being scanned.
// If scanning OCI images, this should be the hash of the manifest.
string ancestry_name = 1;
// The format of the image being uploaded.
string format = 2;
// The layers to be scanned for this particular ancestry.
repeated PostLayer layers = 3;
}
message PostAncestryResponse {
// The status of Clair at the time of the request.
ClairStatus status = 1;
}
service NotificationService {
// The RPC used to get a particularly Notification.
rpc GetNotification(GetNotificationRequest) returns (GetNotificationResponse) {
option (google.api.http) = {
get: "/notifications/{name}"
};
}
// The RPC used to mark a Notification as read after it has been processed.
rpc MarkNotificationAsRead(MarkNotificationAsReadRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/notifications/{name}"
};
}
} }
message GetNotificationRequest { message GetNotificationRequest {
// if the vulnerability_page is empty, it implies the first page. // The current page of previous vulnerabilities for the ancestry.
string old_vulnerability_page = 1; // This will be empty when it is the first page.
string new_vulnerability_page = 2; string old_vulnerability_page = 1;
int32 limit = 3;
string name = 4; // The current page of vulnerabilities for the ancestry.
// This will be empty when it is the first page.
string new_vulnerability_page = 2;
// The requested maximum number of results per page.
int32 limit = 3;
// The name of the notification being requested.
string name = 4;
} }
message GetNotificationResponse { message GetNotificationResponse {
Notification notification = 1; message Notification {
// The name of the requested notification.
string name = 1;
// The time at which the notification was created.
string created = 2;
// The time at which the notification was last sent out.
string notified = 3;
// The time at which a notification has been deleted.
string deleted = 4;
// The previous vulnerability and a paginated view of the ancestries it affects.
PagedVulnerableAncestries old = 5;
// The newly updated vulnerability and a paginated view of the ancestries it affects.
PagedVulnerableAncestries new = 6;
}
// The notification as requested.
Notification notification = 1;
}
message PagedVulnerableAncestries {
message IndexedAncestryName {
// The index is an ever increasing number associated with the particular ancestry.
// This is useful if you're processing notifications, and need to keep track of the progress of paginating the results.
int32 index = 1;
// The name of the ancestry.
string name = 2;
}
// The identifier for the current page.
string current_page = 1;
// The token used to request the next page.
// This will be empty when there are no more pages.
string next_page = 2;
// The requested maximum number of results per page.
int32 limit = 3;
// The vulnerability that affects a given set of ancestries.
Vulnerability vulnerability = 4;
// The ancestries affected by a vulnerability.
repeated IndexedAncestryName ancestries = 5;
} }
message MarkNotificationAsReadRequest { message MarkNotificationAsReadRequest {
string name = 1; // The name of the Notification that has been processed.
} string name = 1;
service AncestryService{
rpc PostAncestry(PostAncestryRequest) returns (PostAncestryResponse) {
option (google.api.http) = {
post: "/ancestry"
body: "*"
};
}
rpc GetAncestry(GetAncestryRequest) returns (GetAncestryResponse) {
option (google.api.http) = {
get: "/ancestry/{ancestry_name}"
};
}
}
service NotificationService{
rpc GetNotification(GetNotificationRequest) returns (GetNotificationResponse) {
option (google.api.http) = {
get: "/notifications/{name}"
};
}
rpc MarkNotificationAsRead(MarkNotificationAsReadRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/notifications/{name}"
};
}
} }

View File

@ -17,6 +17,7 @@
"paths": { "paths": {
"/ancestry": { "/ancestry": {
"post": { "post": {
"summary": "The RPC used to create a new scan of an ancestry.",
"operationId": "PostAncestry", "operationId": "PostAncestry",
"responses": { "responses": {
"200": { "200": {
@ -43,6 +44,7 @@
}, },
"/ancestry/{ancestry_name}": { "/ancestry/{ancestry_name}": {
"get": { "get": {
"summary": "The RPC used to read the results of scanning for a particular ancestry.",
"operationId": "GetAncestry", "operationId": "GetAncestry",
"responses": { "responses": {
"200": { "200": {
@ -61,6 +63,7 @@
}, },
{ {
"name": "with_vulnerabilities", "name": "with_vulnerabilities",
"description": "Whether to include vulnerabilities or not in the response.",
"in": "query", "in": "query",
"required": false, "required": false,
"type": "boolean", "type": "boolean",
@ -68,6 +71,7 @@
}, },
{ {
"name": "with_features", "name": "with_features",
"description": "Whether to include features or not in the response.",
"in": "query", "in": "query",
"required": false, "required": false,
"type": "boolean", "type": "boolean",
@ -81,6 +85,7 @@
}, },
"/notifications/{name}": { "/notifications/{name}": {
"get": { "get": {
"summary": "The RPC used to get a particularly Notification.",
"operationId": "GetNotification", "operationId": "GetNotification",
"responses": { "responses": {
"200": { "200": {
@ -99,19 +104,21 @@
}, },
{ {
"name": "old_vulnerability_page", "name": "old_vulnerability_page",
"description": "if the vulnerability_page is empty, it implies the first page.", "description": "The current page of previous vulnerabilities for the ancestry.\nThis will be empty when it is the first page.",
"in": "query", "in": "query",
"required": false, "required": false,
"type": "string" "type": "string"
}, },
{ {
"name": "new_vulnerability_page", "name": "new_vulnerability_page",
"description": "The current page of vulnerabilities for the ancestry.\nThis will be empty when it is the first page.",
"in": "query", "in": "query",
"required": false, "required": false,
"type": "string" "type": "string"
}, },
{ {
"name": "limit", "name": "limit",
"description": "The requested maximum number of results per page.",
"in": "query", "in": "query",
"required": false, "required": false,
"type": "integer", "type": "integer",
@ -123,6 +130,7 @@
] ]
}, },
"delete": { "delete": {
"summary": "The RPC used to mark a Notification as read after it has been processed.",
"operationId": "MarkNotificationAsRead", "operationId": "MarkNotificationAsRead",
"responses": { "responses": {
"200": { "200": {
@ -147,53 +155,103 @@
} }
}, },
"definitions": { "definitions": {
"PostAncestryRequestPostLayer": { "GetAncestryResponseAncestry": {
"type": "object",
"properties": {
"hash": {
"type": "string"
},
"path": {
"type": "string"
},
"headers": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
},
"clairpbAncestry": {
"type": "object", "type": "object",
"properties": { "properties": {
"name": { "name": {
"type": "string" "type": "string",
"description": "The name of the desired ancestry."
}, },
"features": { "features": {
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/clairpbFeature" "$ref": "#/definitions/clairpbFeature"
} },
"description": "The list of features present in the ancestry.\nThis will only be provided if requested."
}, },
"layers": { "layers": {
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/clairpbLayer" "$ref": "#/definitions/clairpbLayer"
} },
"description": "The layers present in the ancestry."
}, },
"scanned_listers": { "scanned_listers": {
"type": "array", "type": "array",
"items": { "items": {
"type": "string" "type": "string"
}, },
"description": "scanned_listers and scanned_detectors are used to scan this ancestry, it\nmay be different from listers and detectors in ClairStatus since the\nancestry could be scanned by previous version of Clair." "description": "The configured list of feature listers used to scan this ancestry."
}, },
"scanned_detectors": { "scanned_detectors": {
"type": "array", "type": "array",
"items": { "items": {
"type": "string" "type": "string"
} },
"description": "The configured list of namespace detectors used to scan an ancestry."
}
}
},
"GetNotificationResponseNotification": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The name of the requested notification."
},
"created": {
"type": "string",
"description": "The time at which the notification was created."
},
"notified": {
"type": "string",
"description": "The time at which the notification was last sent out."
},
"deleted": {
"type": "string",
"description": "The time at which a notification has been deleted."
},
"old": {
"$ref": "#/definitions/clairpbPagedVulnerableAncestries",
"description": "The previous vulnerability and a paginated view of the ancestries it affects."
},
"new": {
"$ref": "#/definitions/clairpbPagedVulnerableAncestries",
"description": "The newly updated vulnerability and a paginated view of the ancestries it affects."
}
}
},
"PagedVulnerableAncestriesIndexedAncestryName": {
"type": "object",
"properties": {
"index": {
"type": "integer",
"format": "int32",
"description": "The index is an ever increasing number associated with the particular ancestry.\nThis is useful if you're processing notifications, and need to keep track of the progress of paginating the results."
},
"name": {
"type": "string",
"description": "The name of the ancestry."
}
}
},
"PostAncestryRequestPostLayer": {
"type": "object",
"properties": {
"hash": {
"type": "string",
"description": "The hash of the layer."
},
"path": {
"type": "string",
"description": "The location of the layer (URL or filepath)."
},
"headers": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"description": "Any HTTP Headers that need to be used if requesting a layer over HTTP(S)."
} }
} }
}, },
@ -205,17 +263,19 @@
"items": { "items": {
"type": "string" "type": "string"
}, },
"title": "listers and detectors are processors implemented in this Clair and used to\nscan ancestries" "description": "The configured list of feature listers used to scan an ancestry."
}, },
"detectors": { "detectors": {
"type": "array", "type": "array",
"items": { "items": {
"type": "string" "type": "string"
} },
"description": "The configured list of namespace detectors used to scan an ancestry."
}, },
"last_update_time": { "last_update_time": {
"type": "string", "type": "string",
"format": "date-time" "format": "date-time",
"description": "The time at which the updater last ran."
} }
} }
}, },
@ -223,23 +283,27 @@
"type": "object", "type": "object",
"properties": { "properties": {
"name": { "name": {
"type": "string" "type": "string",
"description": "The name of the feature."
}, },
"namespace_name": { "namespace_name": {
"type": "string" "type": "string",
"description": "The name of the namespace in which the feature is detected."
}, },
"version": { "version": {
"type": "string" "type": "string",
"description": "The specific version of this feature."
}, },
"version_format": { "version_format": {
"type": "string", "type": "string",
"description": "version_format is the format used by installer package manager to store\npackage versions." "description": "The format used to parse version numbers for the feature."
}, },
"vulnerabilities": { "vulnerabilities": {
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/clairpbVulnerability" "$ref": "#/definitions/clairpbVulnerability"
} },
"description": "The list of vulnerabilities that affect the feature."
} }
} }
}, },
@ -247,10 +311,12 @@
"type": "object", "type": "object",
"properties": { "properties": {
"ancestry": { "ancestry": {
"$ref": "#/definitions/clairpbAncestry" "$ref": "#/definitions/GetAncestryResponseAncestry",
"description": "The ancestry requested."
}, },
"status": { "status": {
"$ref": "#/definitions/clairpbClairStatus" "$ref": "#/definitions/clairpbClairStatus",
"description": "The status of Clair at the time of the request."
} }
} }
}, },
@ -258,20 +324,8 @@
"type": "object", "type": "object",
"properties": { "properties": {
"notification": { "notification": {
"$ref": "#/definitions/clairpbNotification" "$ref": "#/definitions/GetNotificationResponseNotification",
} "description": "The notification as requested."
}
},
"clairpbIndexedAncestryName": {
"type": "object",
"properties": {
"index": {
"type": "integer",
"format": "int32",
"description": "index is unique to name in all streams simultaneously streamed, increasing\nand larger than all indexes in previous page in same stream."
},
"name": {
"type": "string"
} }
} }
}, },
@ -279,30 +333,8 @@
"type": "object", "type": "object",
"properties": { "properties": {
"hash": { "hash": {
"type": "string" "type": "string",
} "description": "The sha256 tarsum for the layer."
}
},
"clairpbNotification": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"created": {
"type": "string"
},
"notified": {
"type": "string"
},
"deleted": {
"type": "string"
},
"old": {
"$ref": "#/definitions/clairpbPagedVulnerableAncestries"
},
"new": {
"$ref": "#/definitions/clairpbPagedVulnerableAncestries"
} }
} }
}, },
@ -310,24 +342,28 @@
"type": "object", "type": "object",
"properties": { "properties": {
"current_page": { "current_page": {
"type": "string" "type": "string",
"description": "The identifier for the current page."
}, },
"next_page": { "next_page": {
"type": "string", "type": "string",
"description": "if next_page is empty, it signals the end of all pages." "description": "The token used to request the next page.\nThis will be empty when there are no more pages."
}, },
"limit": { "limit": {
"type": "integer", "type": "integer",
"format": "int32" "format": "int32",
"description": "The requested maximum number of results per page."
}, },
"vulnerability": { "vulnerability": {
"$ref": "#/definitions/clairpbVulnerability" "$ref": "#/definitions/clairpbVulnerability",
"description": "The vulnerability that affects a given set of ancestries."
}, },
"ancestries": { "ancestries": {
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/clairpbIndexedAncestryName" "$ref": "#/definitions/PagedVulnerableAncestriesIndexedAncestryName"
} },
"description": "The ancestries affected by a vulnerability."
} }
} }
}, },
@ -335,16 +371,19 @@
"type": "object", "type": "object",
"properties": { "properties": {
"ancestry_name": { "ancestry_name": {
"type": "string" "type": "string",
"description": "The name of the ancestry being scanned.\nIf scanning OCI images, this should be the hash of the manifest."
}, },
"format": { "format": {
"type": "string" "type": "string",
"description": "The format of the image being uploaded."
}, },
"layers": { "layers": {
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/PostAncestryRequestPostLayer" "$ref": "#/definitions/PostAncestryRequestPostLayer"
} },
"description": "The layers to be scanned for this particular ancestry."
} }
} }
}, },
@ -352,7 +391,8 @@
"type": "object", "type": "object",
"properties": { "properties": {
"status": { "status": {
"$ref": "#/definitions/clairpbClairStatus" "$ref": "#/definitions/clairpbClairStatus",
"description": "The status of Clair at the time of the request."
} }
} }
}, },
@ -360,33 +400,39 @@
"type": "object", "type": "object",
"properties": { "properties": {
"name": { "name": {
"type": "string" "type": "string",
"description": "The name of the vulnerability."
}, },
"namespace_name": { "namespace_name": {
"type": "string" "type": "string",
"description": "The name of the namespace in which the vulnerability was detected."
}, },
"description": { "description": {
"type": "string" "type": "string",
"description": "A description of the vulnerability according to the source for the namespace."
}, },
"link": { "link": {
"type": "string" "type": "string",
"description": "A link to the vulnerability according to the source for the namespace."
}, },
"severity": { "severity": {
"type": "string" "type": "string",
"description": "How dangerous the vulnerability is."
}, },
"metadata": { "metadata": {
"type": "string" "type": "string",
"description": "Namespace agnostic metadata about the vulnerability."
}, },
"fixed_by": { "fixed_by": {
"type": "string", "type": "string",
"description": "fixed_by exists when vulnerability is under feature." "description": "The feature that fixes this vulnerability.\nThis field only exists when a vulnerability is a part of a Feature."
}, },
"affected_versions": { "affected_versions": {
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/clairpbFeature" "$ref": "#/definitions/clairpbFeature"
}, },
"description": "affected_versions exists when vulnerability is under notification." "description": "The Features that are affected by the vulnerability.\nThis field only exists when a vulnerability is a part of a Notification."
} }
} }
}, },

View File

@ -48,7 +48,7 @@ func PagedVulnerableAncestriesFromDatabaseModel(dbVuln *database.PagedVulnerable
} }
for index, ancestryName := range dbVuln.Affected { for index, ancestryName := range dbVuln.Affected {
indexedAncestry := IndexedAncestryName{ indexedAncestry := PagedVulnerableAncestries_IndexedAncestryName{
Name: ancestryName, Name: ancestryName,
Index: int32(index), Index: int32(index),
} }
@ -60,9 +60,9 @@ func PagedVulnerableAncestriesFromDatabaseModel(dbVuln *database.PagedVulnerable
// NotificationFromDatabaseModel converts database notification, old and new // NotificationFromDatabaseModel converts database notification, old and new
// vulnerabilities' paged vulnerable ancestries to be api notification. // vulnerabilities' paged vulnerable ancestries to be api notification.
func NotificationFromDatabaseModel(dbNotification database.VulnerabilityNotificationWithVulnerable) (*Notification, error) { func NotificationFromDatabaseModel(dbNotification database.VulnerabilityNotificationWithVulnerable) (*GetNotificationResponse_Notification, error) {
var ( var (
noti Notification noti GetNotificationResponse_Notification
err error err error
) )
@ -123,8 +123,8 @@ func VulnerabilityWithFixedInFromDatabaseModel(dbVuln database.VulnerabilityWith
} }
// AncestryFromDatabaseModel converts database ancestry to api ancestry. // AncestryFromDatabaseModel converts database ancestry to api ancestry.
func AncestryFromDatabaseModel(dbAncestry database.Ancestry) *Ancestry { func AncestryFromDatabaseModel(dbAncestry database.Ancestry) *GetAncestryResponse_Ancestry {
ancestry := &Ancestry{ ancestry := &GetAncestryResponse_Ancestry{
Name: dbAncestry.Name, Name: dbAncestry.Name,
} }
for _, layer := range dbAncestry.Layers { for _, layer := range dbAncestry.Layers {