fix(deps): Update dependencies to latest versions
This commit is contained in:
@ -63,12 +63,19 @@ export class CloudlyApiClient {
|
||||
await this.typedsocketClient.stop();
|
||||
}
|
||||
|
||||
public identity: plugins.servezoneInterfaces.data.IClusterIdentifier;
|
||||
public identity: plugins.servezoneInterfaces.data.IIdentity;
|
||||
public async getIdentityByJumpCode(
|
||||
jumpCodeArg: string,
|
||||
tagConnection = false,
|
||||
statefullIdentity = true
|
||||
): Promise<plugins.servezoneInterfaces.data.IClusterIdentifier> {
|
||||
optionsArg?: {
|
||||
tagConnection?: boolean;
|
||||
statefullIdentity?: boolean;
|
||||
}
|
||||
): Promise<plugins.servezoneInterfaces.data.IIdentity> {
|
||||
optionsArg = Object.assign({}, {
|
||||
tagConnection: false,
|
||||
statefullIdentity: true,
|
||||
}, optionsArg);
|
||||
|
||||
const identityRequest =
|
||||
this.typedsocketClient.createTypedRequest<plugins.servezoneInterfaces.requests.identity.IRequest_Any_Cloudly_CoreflowManager_GetIdentityByJumpCode>(
|
||||
'getIdentityByJumpCode'
|
||||
@ -78,42 +85,47 @@ export class CloudlyApiClient {
|
||||
jumpCode: jumpCodeArg,
|
||||
});
|
||||
console.log('got identity response');
|
||||
const identity = response.clusterIdentifier;
|
||||
const identity = response.identity;
|
||||
|
||||
if (tagConnection) {
|
||||
if (optionsArg.tagConnection) {
|
||||
this.typedsocketClient.addTag('identity', identity);
|
||||
}
|
||||
|
||||
if (statefullIdentity) {
|
||||
if (optionsArg.statefullIdentity) {
|
||||
this.identity = identity;
|
||||
}
|
||||
|
||||
return identity;
|
||||
}
|
||||
|
||||
/**
|
||||
* will use statefull identity by default
|
||||
*/
|
||||
public async getClusterConfigFromCloudlyByIdentity(
|
||||
identityArg: plugins.servezoneInterfaces.data.IClusterIdentifier
|
||||
identityArg: plugins.servezoneInterfaces.data.IIdentity = this.identity
|
||||
): Promise<plugins.servezoneInterfaces.data.ICluster> {
|
||||
const clusterConfigRequest =
|
||||
this.typedsocketClient.createTypedRequest<plugins.servezoneInterfaces.requests.config.IRequest_Any_Cloudly_GetClusterConfig>(
|
||||
'getClusterConfig'
|
||||
);
|
||||
const response = await clusterConfigRequest.fire({
|
||||
jwt: '',
|
||||
clusterIdentifier: identityArg,
|
||||
identity: identityArg,
|
||||
});
|
||||
return response.configData;
|
||||
}
|
||||
|
||||
/**
|
||||
* will use statefull identity by default
|
||||
*/
|
||||
public async getServerConfigFromCloudlyByIdentity(
|
||||
identityArg: plugins.servezoneInterfaces.data.IClusterIdentifier
|
||||
identityArg: plugins.servezoneInterfaces.data.IIdentity = this.identity
|
||||
): Promise<plugins.servezoneInterfaces.data.IServer> {
|
||||
const serverConfigRequest =
|
||||
this.typedsocketClient.createTypedRequest<plugins.servezoneInterfaces.requests.config.IRequest_Any_Cloudly_GetServerConfig>(
|
||||
'getServerConfig'
|
||||
);
|
||||
const response = await serverConfigRequest.fire({
|
||||
jwt: '', // TODO: do proper auth here
|
||||
identity: identityArg,
|
||||
serverId: '', // TODO: get server id here
|
||||
});
|
||||
return response.configData;
|
||||
@ -121,19 +133,24 @@ export class CloudlyApiClient {
|
||||
|
||||
/**
|
||||
* gets a certificate for a domain used by a service
|
||||
* @param serviceNameArg
|
||||
* @param domainNameArg
|
||||
*/
|
||||
public async getCertificateForDomainOverHttps(
|
||||
domainNameArg: string
|
||||
): Promise<plugins.tsclass.network.ICert> {
|
||||
public async getCertificateForDomain(optionsArg: {
|
||||
domainName: string;
|
||||
type: plugins.servezoneInterfaces.requests.certificate.IRequest_Any_Cloudly_GetCertificateForDomain['request']['type'];
|
||||
identity?: plugins.servezoneInterfaces.data.IIdentity;
|
||||
}): Promise<plugins.tsclass.network.ICert> {
|
||||
optionsArg.identity = optionsArg.identity || this.identity;
|
||||
if (!optionsArg.identity) {
|
||||
throw new Error('identity is required. Either provide one or login first.');
|
||||
}
|
||||
const typedCertificateRequest =
|
||||
this.typedsocketClient.createTypedRequest<plugins.servezoneInterfaces.requests.certificate.IRequest_Any_Cloudly_GetSslCertificate>(
|
||||
'getSslCertificate'
|
||||
this.typedsocketClient.createTypedRequest<plugins.servezoneInterfaces.requests.certificate.IRequest_Any_Cloudly_GetCertificateForDomain>(
|
||||
'getCertificateForDomain'
|
||||
);
|
||||
const typedResponse = await typedCertificateRequest.fire({
|
||||
authToken: '', // do proper auth here
|
||||
requiredCertName: domainNameArg,
|
||||
identity: this.identity, // do proper auth here
|
||||
domainName: optionsArg.domainName,
|
||||
type: optionsArg.type,
|
||||
});
|
||||
return typedResponse.certificate;
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ export class Image implements plugins.servezoneInterfaces.data.IImage {
|
||||
'getAllImages'
|
||||
);
|
||||
const response = await getAllImagesTR.fire({
|
||||
jwt: cloudlyClientRef.identity.jwt,
|
||||
identity: cloudlyClientRef.identity,
|
||||
});
|
||||
const resultImages: Image[] = [];
|
||||
for (const image of response.images) {
|
||||
@ -18,6 +18,23 @@ export class Image implements plugins.servezoneInterfaces.data.IImage {
|
||||
return resultImages;
|
||||
}
|
||||
|
||||
/**
|
||||
* creates a new image
|
||||
*/
|
||||
public static async createImage(cloudlyClientRef: CloudlyApiClient, imageDataArg: Partial<plugins.servezoneInterfaces.data.IImage['data']>) {
|
||||
const createImageTR = cloudlyClientRef.typedsocketClient.createTypedRequest<plugins.servezoneInterfaces.requests.image.IRequest_CreateImage>(
|
||||
'createImage'
|
||||
);
|
||||
const response = await createImageTR.fire({
|
||||
identity: cloudlyClientRef.identity,
|
||||
name: imageDataArg.name,
|
||||
description: imageDataArg.description,
|
||||
});
|
||||
const newImage = new Image(cloudlyClientRef);
|
||||
Object.assign(newImage, response.image);
|
||||
return newImage;
|
||||
}
|
||||
|
||||
// INSTANCE
|
||||
cloudlyClientRef: CloudlyApiClient;
|
||||
|
||||
@ -36,7 +53,7 @@ export class Image implements plugins.servezoneInterfaces.data.IImage {
|
||||
'getImageMetadata'
|
||||
);
|
||||
const response = await getVersionsTR.fire({
|
||||
jwt: this.cloudlyClientRef.identity.jwt,
|
||||
identity: this.cloudlyClientRef.identity,
|
||||
imageId: this.id,
|
||||
});
|
||||
Object.assign(this, response.image);
|
||||
@ -54,7 +71,7 @@ export class Image implements plugins.servezoneInterfaces.data.IImage {
|
||||
);
|
||||
const virtualStream = new plugins.typedrequest.VirtualStream();
|
||||
const response = await pullImageTR.fire({
|
||||
jwt: this.cloudlyClientRef.identity.jwt,
|
||||
identity: this.cloudlyClientRef.identity,
|
||||
imageId: this.id,
|
||||
versionString: '',
|
||||
imageStream: virtualStream,
|
||||
@ -72,7 +89,7 @@ export class Image implements plugins.servezoneInterfaces.data.IImage {
|
||||
'pullImageVersion'
|
||||
);
|
||||
const response = await pullImageTR.fire({
|
||||
jwt: this.cloudlyClientRef.identity.jwt,
|
||||
identity: this.cloudlyClientRef.identity,
|
||||
imageId: this.id,
|
||||
versionString: versionStringArg,
|
||||
});
|
||||
|
Reference in New Issue
Block a user