| 
									
										
										
										
											2022-10-09 18:15:37 +02:00
										 |  |  | import * as plugins from '../npmci.plugins.js'; | 
					
						
							| 
									
										
										
										
											2019-08-29 20:26:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-09 18:15:37 +02:00
										 |  |  | import { Npmci } from '../npmci.classes.npmci.js'; | 
					
						
							|  |  |  | import { logger } from '../npmci.logging.js'; | 
					
						
							| 
									
										
										
										
											2019-08-29 20:56:02 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-29 20:26:23 +02:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2019-08-29 20:56:02 +02:00
										 |  |  |  * connects to cloudly | 
					
						
							| 
									
										
										
										
											2019-08-29 20:26:23 +02:00
										 |  |  |  */ | 
					
						
							|  |  |  | export class CloudlyConnector { | 
					
						
							| 
									
										
										
										
											2019-08-29 20:56:02 +02:00
										 |  |  |   public npmciRef: Npmci; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   constructor(npmciRefArg: Npmci) { | 
					
						
							|  |  |  |     this.npmciRef = npmciRefArg; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-14 18:11:12 +00:00
										 |  |  |   public async announceDockerContainer( | 
					
						
							| 
									
										
										
										
											2022-01-18 18:10:27 +01:00
										 |  |  |     optionsArg: plugins.tsclass.container.IContainer, | 
					
						
							|  |  |  |     testCloudlyUrlArg?: string | 
					
						
							| 
									
										
										
										
											2021-05-14 18:11:12 +00:00
										 |  |  |   ) { | 
					
						
							| 
									
										
										
										
											2022-01-18 18:10:27 +01:00
										 |  |  |     const cloudlyUrl = testCloudlyUrlArg || this.npmciRef.npmciConfig.getConfig().urlCloudly; | 
					
						
							| 
									
										
										
										
											2019-08-29 20:56:02 +02:00
										 |  |  |     if (!cloudlyUrl) { | 
					
						
							| 
									
										
										
										
											2019-09-01 13:51:11 +02:00
										 |  |  |       logger.log( | 
					
						
							|  |  |  |         'warn', | 
					
						
							|  |  |  |         'no cloudly url provided. Thus we cannot announce the newly built Dockerimage!' | 
					
						
							|  |  |  |       ); | 
					
						
							| 
									
										
										
										
											2019-08-29 20:56:02 +02:00
										 |  |  |       return; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-09-01 13:51:11 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-07 04:20:14 +01:00
										 |  |  |     const typedrequest = | 
					
						
							|  |  |  |       new plugins.typedrequest.TypedRequest<plugins.servezoneInterfaces.requests.IRequest_InformAboutNewContainerImage>( | 
					
						
							| 
									
										
										
										
											2021-11-09 20:27:30 +01:00
										 |  |  |         `https://${cloudlyUrl}/typedrequest`, | 
					
						
							| 
									
										
										
										
											2021-11-07 04:20:14 +01:00
										 |  |  |         'servezonestandard_InformAboutNewContainerVersion' | 
					
						
							|  |  |  |       ); | 
					
						
							| 
									
										
										
										
											2019-08-29 20:56:02 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-07 04:20:14 +01:00
										 |  |  |     const response = await typedrequest.fire({ | 
					
						
							| 
									
										
										
										
											2022-10-11 14:26:42 +02:00
										 |  |  |       containerImageInfo: optionsArg, | 
					
						
							| 
									
										
										
										
											2021-11-07 04:20:14 +01:00
										 |  |  |     }); | 
					
						
							| 
									
										
										
										
											2019-08-29 20:56:02 +02:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2019-08-29 20:38:44 +02:00
										 |  |  | } |