Skip to content

Commit

Permalink
matcher: Update matcher client to match server definition
Browse files Browse the repository at this point in the history
The matcher client is currently creating requests to the matcher
component with a trailing slash, which for the read operations
doesn't match what the server is expecting.
ie. GET /matcher/api/v1/internal/update_operation/. This removes
the trailing slash from both URL paths that the matcher client
is requesting. And adds a dedicated path variable for deleting
update_operations.

Signed-off-by: crozzy <joseph.crosland@gmail.com>
  • Loading branch information
crozzy committed May 25, 2022
1 parent 1a1d566 commit e5cb6a9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion httptransport/client/matcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (c *HTTP) Scan(ctx context.Context, ir *claircore.IndexReport) (*claircore.

// DeleteUpdateOperations attempts to delete the referenced update operations.
func (c *HTTP) DeleteUpdateOperations(ctx context.Context, ref ...uuid.UUID) (int64, error) {
u, err := c.addr.Parse(httptransport.UpdateOperationAPIPath)
u, err := c.addr.Parse(httptransport.UpdateOperationDeleteAPIPath)
if err != nil {
return 0, err
}
Expand Down
33 changes: 17 additions & 16 deletions httptransport/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,23 @@ import (
)

const (
apiRoot = "/api/v1/"
indexerRoot = "/indexer"
matcherRoot = "/matcher"
notifierRoot = "/notifier"
internalRoot = apiRoot + "internal/"
IndexAPIPath = indexerRoot + apiRoot + "index_report"
IndexReportAPIPath = indexerRoot + apiRoot + "index_report/"
IndexStateAPIPath = indexerRoot + apiRoot + "index_state"
AffectedManifestAPIPath = indexerRoot + internalRoot + "affected_manifest/"
VulnerabilityReportPath = matcherRoot + apiRoot + "vulnerability_report/"
UpdateOperationAPIPath = matcherRoot + internalRoot + "update_operation/"
UpdateDiffAPIPath = matcherRoot + internalRoot + "update_diff/"
NotificationAPIPath = notifierRoot + apiRoot + "notification/"
KeysAPIPath = notifierRoot + apiRoot + "services/notifier/keys"
KeyByIDAPIPath = notifierRoot + apiRoot + "services/notifier/keys/"
OpenAPIV1Path = "/openapi/v1"
apiRoot = "/api/v1/"
indexerRoot = "/indexer"
matcherRoot = "/matcher"
notifierRoot = "/notifier"
internalRoot = apiRoot + "internal/"
IndexAPIPath = indexerRoot + apiRoot + "index_report"
IndexReportAPIPath = indexerRoot + apiRoot + "index_report/"
IndexStateAPIPath = indexerRoot + apiRoot + "index_state"
AffectedManifestAPIPath = indexerRoot + internalRoot + "affected_manifest/"
VulnerabilityReportPath = matcherRoot + apiRoot + "vulnerability_report/"
UpdateOperationAPIPath = matcherRoot + internalRoot + "update_operation"
UpdateOperationDeleteAPIPath = matcherRoot + internalRoot + "update_operation/"
UpdateDiffAPIPath = matcherRoot + internalRoot + "update_diff"
NotificationAPIPath = notifierRoot + apiRoot + "notification/"
KeysAPIPath = notifierRoot + apiRoot + "services/notifier/keys"
KeyByIDAPIPath = notifierRoot + apiRoot + "services/notifier/keys/"
OpenAPIV1Path = "/openapi/v1"
)

// Server is the primary http server Clair exposes its functionality on.
Expand Down

0 comments on commit e5cb6a9

Please sign in to comment.