@@ -307,6 +307,28 @@ def get_pdf_report(self, image, tag=None, date=None):
307307
308308 return [True , res .content ]
309309
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+
310332 def import_image (self , infile , sync = False ):
311333 '''**Description**
312334 Import an image archive
@@ -355,21 +377,23 @@ def get_anchore_users_account(self):
355377
356378 return [True , res .json ()]
357379
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 ):
359381 '''**Description**
360382 Get the anchore image scan result for an image id.
361383
362384 **Arguments**
363385 - image_id: Docker image id of the image whose scan result is to be fetched.
364386 - 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.
365388
366389 **Success Return Value**
367390 A JSON object containing pass/fail status of image scan policy.
368391 '''
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 (
370393 base_url = self .url ,
371394 image_id = image_id ,
372- full_tag_name = full_tag_name )
395+ full_tag_name = full_tag_name ,
396+ detail = detail )
373397 res = requests .get (url , headers = self .hdrs , verify = self .ssl_verify )
374398 if not self ._checkResponse (res ):
375399 return [False , self .lasterr ]
0 commit comments