| 
									
										
										
										
											2018-04-04 22:25:13 +02:00
										 |  |  | import * as plugins from './mod.plugins'; | 
					
						
							|  |  |  | import { Objectmap } from 'lik'; | 
					
						
							| 
									
										
										
										
											2017-08-28 01:03:59 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-04 22:25:13 +02:00
										 |  |  | import { DockerRegistry } from './mod.classes.dockerregistry'; | 
					
						
							| 
									
										
										
										
											2017-08-28 01:03:59 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | export class RegistryStorage { | 
					
						
							| 
									
										
										
										
											2018-04-04 22:25:13 +02:00
										 |  |  |   objectMap = new Objectmap<DockerRegistry>(); | 
					
						
							|  |  |  |   constructor() { | 
					
						
							| 
									
										
										
										
											2017-08-28 01:03:59 +02:00
										 |  |  |     // Nothing here
 | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-04 22:25:13 +02:00
										 |  |  |   addRegistry(registryArg: DockerRegistry) { | 
					
						
							|  |  |  |     this.objectMap.add(registryArg); | 
					
						
							| 
									
										
										
										
											2017-08-28 01:03:59 +02:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-04 22:25:13 +02:00
										 |  |  |   getRegistryByUrl(registryUrlArg: string) { | 
					
						
							| 
									
										
										
										
											2017-08-28 01:03:59 +02:00
										 |  |  |     return this.objectMap.find(registryArg => { | 
					
						
							| 
									
										
										
										
											2018-04-04 22:25:13 +02:00
										 |  |  |       return registryArg.registryUrl === registryUrlArg; | 
					
						
							|  |  |  |     }); | 
					
						
							| 
									
										
										
										
											2017-08-28 01:03:59 +02:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-04 22:25:13 +02:00
										 |  |  |   async loginAll() { | 
					
						
							| 
									
										
										
										
											2017-08-28 01:03:59 +02:00
										 |  |  |     await this.objectMap.forEach(async registryArg => { | 
					
						
							| 
									
										
										
										
											2018-04-04 22:25:13 +02:00
										 |  |  |       await registryArg.login(); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |     plugins.beautylog.success('logged in successfully into all available DockerRegistries!'); | 
					
						
							| 
									
										
										
										
											2017-08-28 01:03:59 +02:00
										 |  |  |   } | 
					
						
							|  |  |  | } |