@@ -307,6 +307,28 @@ def get_pdf_report(self, image, tag=None, date=None):
307
307
308
308
return [True , res .content ]
309
309
310
+ def get_latest_pdf_report_by_digest (self , image_digest , full_tag = None ):
311
+ '''**Description**
312
+ Get the latest pdf report of one image digest
313
+
314
+ **Arguments**
315
+ - image_digest: Input image digest should be in the following formats: sha256:134dhgfd65765
316
+ - tag: Specify which FULLTAG is evaluated for a given Image Digest: docker.io/alpine:latest
317
+
318
+ **Success Return Value**
319
+ The pdf content
320
+ '''
321
+ url = "{base_url}/api/scanning/v1/images/{image_digest}/report?tag={tag}" .format (
322
+ base_url = self .url ,
323
+ image_digest = image_digest ,
324
+ tag = full_tag )
325
+
326
+ res = requests .get (url , headers = self .hdrs , verify = self .ssl_verify )
327
+ if not self ._checkResponse (res ):
328
+ return [False , self .lasterr ]
329
+
330
+ return [True , res .content ]
331
+
310
332
def import_image (self , infile , sync = False ):
311
333
'''**Description**
312
334
Import an image archive
@@ -355,21 +377,23 @@ def get_anchore_users_account(self):
355
377
356
378
return [True , res .json ()]
357
379
358
- def get_image_scan_result_by_id (self , image_id , full_tag_name ):
380
+ def get_image_scan_result_by_id (self , image_id , full_tag_name , detail ):
359
381
'''**Description**
360
382
Get the anchore image scan result for an image id.
361
383
362
384
**Arguments**
363
385
- image_id: Docker image id of the image whose scan result is to be fetched.
364
386
- full_tag_name: The complete tag name of the image for e.g. docker.io/alpine:3.10.
387
+ - detail: Boolean to indicate whether full scan result API is needed.
365
388
366
389
**Success Return Value**
367
390
A JSON object containing pass/fail status of image scan policy.
368
391
'''
369
- url = "{base_url}/api/scanning/v1/anchore/images/by_id/{image_id}/check?tag={full_tag_name}&detail=false " .format (
392
+ url = "{base_url}/api/scanning/v1/anchore/images/by_id/{image_id}/check?tag={full_tag_name}&detail={detail} " .format (
370
393
base_url = self .url ,
371
394
image_id = image_id ,
372
- full_tag_name = full_tag_name )
395
+ full_tag_name = full_tag_name ,
396
+ detail = detail )
373
397
res = requests .get (url , headers = self .hdrs , verify = self .ssl_verify )
374
398
if not self ._checkResponse (res ):
375
399
return [False , self .lasterr ]
0 commit comments