Skip to content
This repository has been archived by the owner on Oct 14, 2024. It is now read-only.

Commit

Permalink
Add support for ODATA $filter, $select and $count on /scanConfigs (#84)
Browse files Browse the repository at this point in the history
* Redo database interface to use model as input and output

This commit revisits the database interface such that each function takes
in and returns a VMClarity API model object. How the DB driver decides
to store these objects and process them efficently is the resposiblity
of the DB driver. We start with one DB driver, gorm, which converts the
model objects to GORM structs to save them.
  • Loading branch information
Sam Betts authored Mar 6, 2023
1 parent 94afffe commit e2048d0
Show file tree
Hide file tree
Showing 35 changed files with 3,306 additions and 1,810 deletions.
106 changes: 95 additions & 11 deletions api/client/client.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 25 additions & 8 deletions api/models/models.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 32 additions & 5 deletions api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,11 @@ paths:
summary: Get all scan configs.
parameters:
- $ref: '#/components/parameters/odataFilter'
- $ref: '#/components/parameters/page'
- $ref: '#/components/parameters/pageSize'
- $ref: '#/components/parameters/odataSelect'
- $ref: '#/components/parameters/odataCount'
- $ref: '#/components/parameters/odataTop'
- $ref: '#/components/parameters/odataSkip'
- $ref: '#/components/parameters/odataExpand'
responses:
200:
description: Success
Expand Down Expand Up @@ -404,6 +407,8 @@ paths:
summary: Get the details for a scan config.
parameters:
- $ref: '#/components/parameters/scanConfigID'
- $ref: '#/components/parameters/odataSelect'
- $ref: '#/components/parameters/odataExpand'
responses:
200:
description: Success
Expand Down Expand Up @@ -687,7 +692,7 @@ components:
ScanConfigs:
type: object
properties:
total:
count:
type: integer
description: Total scan config count according to the given filters
readOnly: true
Expand All @@ -698,8 +703,6 @@ components:
items:
$ref: '#/components/schemas/ScanConfig'
readOnly: true
required:
- total

ScanConfigData:
type: object
Expand Down Expand Up @@ -1393,6 +1396,30 @@ components:
schema:
type: string

odataCount:
name: "$count"
in: query
schema:
type: boolean

odataTop:
name: "$top"
in: query
schema:
type: integer

odataSkip:
name: "$skip"
in: query
schema:
type: integer

odataExpand:
name: "$expand"
in: query
schema:
type: string

scanID:
name: scanID
in: path
Expand Down
Loading

0 comments on commit e2048d0

Please sign in to comment.