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