npmci/ts/connector.cloudly/cloudlyconnector.ts
2021-11-09 20:27:30 +01:00

39 lines
1008 B
TypeScript

import * as plugins from '../npmci.plugins';
import { Npmci } from '../npmci.classes.npmci';
import { logger } from '../npmci.logging';
/**
* connects to cloudly
*/
export class CloudlyConnector {
public npmciRef: Npmci;
constructor(npmciRefArg: Npmci) {
this.npmciRef = npmciRefArg;
}
public async announceDockerContainer(
optionsArg: plugins.tsclass.container.IContainer
) {
const cloudlyUrl = this.npmciRef.npmciConfig.getConfig().urlCloudly;
if (!cloudlyUrl) {
logger.log(
'warn',
'no cloudly url provided. Thus we cannot announce the newly built Dockerimage!'
);
return;
}
const typedrequest =
new plugins.typedrequest.TypedRequest<plugins.servezoneInterfaces.requests.IRequest_InformAboutNewContainerImage>(
`https://${cloudlyUrl}/typedrequest`,
'servezonestandard_InformAboutNewContainerVersion'
);
const response = await typedrequest.fire({
containerImageInfo: optionsArg
});
}
}