| 
									
										
										
										
											2020-03-10 14:55:55 +08:00
										 |  |  | # -*- coding: utf-8 -*- | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import time | 
					
						
							|  |  |  | import base | 
					
						
							|  |  |  | import v2_swagger_client | 
					
						
							|  |  |  | from v2_swagger_client.rest import ApiException | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-16 10:13:28 +08:00
										 |  |  | class Scan(base.Base, object): | 
					
						
							|  |  |  |     def __init__(self): | 
					
						
							|  |  |  |         super(Scan,self).__init__(api_type = "scan") | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-17 17:55:38 +08:00
										 |  |  |     def scan_artifact(self, project_name, repo_name, reference, expect_status_code = 202, expect_response_body = None, **kwargs): | 
					
						
							|  |  |  |         try: | 
					
						
							| 
									
										
										
										
											2021-03-15 16:08:48 +08:00
										 |  |  |             data, status_code, _ = self._get_client(**kwargs).scan_artifact_with_http_info(project_name, repo_name, reference) | 
					
						
							| 
									
										
										
										
											2020-08-17 17:55:38 +08:00
										 |  |  |         except ApiException as e: | 
					
						
							|  |  |  |             base._assert_status_code(expect_status_code, e.status) | 
					
						
							|  |  |  |             if expect_response_body is not None: | 
					
						
							|  |  |  |                 base._assert_status_body(expect_response_body, e.body) | 
					
						
							|  |  |  |             return | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-10 14:55:55 +08:00
										 |  |  |         base._assert_status_code(expect_status_code, status_code) | 
					
						
							| 
									
										
										
										
											2020-08-17 17:55:38 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-10 14:55:55 +08:00
										 |  |  |         return data |