npmci/ts/connector.cloudly/cloudlyconnector.ts

33 lines
932 B
TypeScript
Raw Normal View History

2019-08-29 20:26:23 +02:00
import * as plugins from '../npmci.plugins';
2019-09-01 13:51:11 +02:00
import { Npmci } from '../npmci.classes.npmci';
2019-08-29 20:56:02 +02:00
import { logger } from '../npmci.logging';
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;
}
2019-10-02 11:33:52 +02:00
public async announceDockerContainer(optionsArg: plugins.servezoneInterfaces.version.IVersionData) {
2019-08-29 20:56:02 +02:00
const cloudlyUrl = this.npmciRef.npmciConfig.getConfig().urlCloudly;
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
2019-08-29 20:56:02 +02:00
const typedrequest = new plugins.typedrequest.TypedRequest<
2019-10-02 11:33:52 +02:00
plugins.servezoneInterfaces.request.version.IRequest_Any_Cloudly_VersionManager_Update
2019-08-29 20:56:02 +02:00
>(`https://${cloudlyUrl}/versionmanager`, 'update');
2019-09-01 13:51:11 +02:00
const response = await typedrequest.fire(optionsArg);
2019-08-29 20:56:02 +02:00
}
2019-08-29 20:38:44 +02:00
}