Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
IaC Scan Runner
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PIACERE
public
The Platform
IaC Scan Runner
Commits
fb478ff1
Commit
fb478ff1
authored
2 years ago
by
penenadpi
Browse files
Options
Downloads
Patches
Plain Diff
Fixed initial API
parent
6b8e7c41
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/users_example.py
+1
-5
1 addition, 5 deletions
examples/users_example.py
src/iac_scan_runner/api.py
+9
-9
9 additions, 9 deletions
src/iac_scan_runner/api.py
with
10 additions
and
14 deletions
examples/users_example.py
+
1
−
5
View file @
fb478ff1
...
...
@@ -3,14 +3,10 @@ import sys
print
(
"
SHOW ALL RESULTS
"
)
URL
=
"
http://127.0.0.1:8000/new_user
"
uuids
=
{
"
userid
"
:
"
8357c950-78d3-4a15-94c6-f911116dcd10
"
,
"
selected
"
:
"
[]
"
"
userid
"
:
"
8357c950-78d3-4a15-94c6-f911116dcd10
"
}
response
=
requests
.
post
(
URL
,
uuids
)
...
...
This diff is collapsed.
Click to expand it.
src/iac_scan_runner/api.py
+
9
−
9
View file @
fb478ff1
...
...
@@ -2,7 +2,7 @@ import functools
import
io
import
os
from
typing
import
Optional
,
List
,
Union
import
uuid
import
yaml
from
content_size_limit_asgi
import
ContentSizeLimitMiddleware
from
fastapi
import
FastAPI
,
File
,
Form
,
UploadFile
,
status
...
...
@@ -13,7 +13,7 @@ from iac_scan_runner.scan_response_type import ScanResponseType
from
iac_scan_runner.scan_runner
import
ScanRunner
from
pydantic
import
SecretStr
from
iac_scan_runner.results_persistence
import
ResultsPersistence
from
iac_scan_runner.user_configuration
import
UserConfiguration
# create an API instance
app
=
FastAPI
(
docs_url
=
"
/swagger
"
,
...
...
@@ -205,7 +205,7 @@ async def delete_scan_result(uuid: str) -> JSONResponse:
@app.post
(
"
/new_user
"
,
summary
=
"
Retrieve particular scan result by given uuid
"
,
responses
=
{
200
:
{},
400
:
{
"
model
"
:
str
}})
async
def
ge
t_new_user
(
uuid
:
str
,
selected
:
list
)
->
JSONResponse
:
async
def
pos
t_new_user
()
->
JSONResponse
:
"""
Retrieve a particular scan result (GET method)
:param uuid: Identifier of a saved scan record
...
...
@@ -213,11 +213,11 @@ async def get_new_user(uuid: str, selected: list ) -> JSONResponse:
"""
try
:
user_configs
=
UserConfiguration
()
if
(
uuid
):
user_configs
.
new_user
(
uuid
,
selected
)
else
:
selected
=
[]
random_userid
=
str
(
uuid
.
uuid4
())
user_configs
.
new_user
(
random_userid
,
selected
)
return
JSONResponse
(
status_code
=
status
.
HTTP_200_OK
,
content
=
"
New user created
"
)
user_configs
.
new_config
(
random_userid
,
selected
)
return
JSONResponse
(
status_code
=
status
.
HTTP_200_OK
,
content
=
f
"
New user created with id:
{
random_userid
}
"
)
except
Exception
as
e
:
return
JSONResponse
(
status_code
=
status
.
HTTP_400_BAD_REQUEST
,
content
=
str
(
e
))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment