feat: add platform api helpers
This commit is contained in:
@@ -0,0 +1,125 @@
|
||||
import * as plugins from './plugins.js';
|
||||
import type { CloudlyApiClient } from './classes.cloudlyapiclient.js';
|
||||
|
||||
export class Platform {
|
||||
public static async getPlatformDesiredState(cloudlyClientRef: CloudlyApiClient) {
|
||||
const request =
|
||||
cloudlyClientRef.typedsocketClient.createTypedRequest<plugins.servezoneInterfaces.requests.platform.IReq_Any_Cloudly_GetPlatformDesiredState>(
|
||||
'getPlatformDesiredState',
|
||||
);
|
||||
return await request.fire({
|
||||
identity: cloudlyClientRef.identity,
|
||||
});
|
||||
}
|
||||
|
||||
public static async getPlatformCapabilities(cloudlyClientRef: CloudlyApiClient) {
|
||||
const request =
|
||||
cloudlyClientRef.typedsocketClient.createTypedRequest<plugins.servezoneInterfaces.requests.platform.IReq_Any_Cloudly_GetPlatformCapabilities>(
|
||||
'getPlatformCapabilities',
|
||||
);
|
||||
return await request.fire({
|
||||
identity: cloudlyClientRef.identity,
|
||||
});
|
||||
}
|
||||
|
||||
public static async getPlatformProviderConfigs(
|
||||
cloudlyClientRef: CloudlyApiClient,
|
||||
capability?: plugins.servezoneInterfaces.platform.TPlatformCapability,
|
||||
) {
|
||||
const request =
|
||||
cloudlyClientRef.typedsocketClient.createTypedRequest<plugins.servezoneInterfaces.requests.platform.IReq_Any_Cloudly_GetPlatformProviderConfigs>(
|
||||
'getPlatformProviderConfigs',
|
||||
);
|
||||
return await request.fire({
|
||||
identity: cloudlyClientRef.identity,
|
||||
capability,
|
||||
});
|
||||
}
|
||||
|
||||
public static async upsertPlatformProviderConfig(
|
||||
cloudlyClientRef: CloudlyApiClient,
|
||||
providerConfig: plugins.servezoneInterfaces.platform.IPlatformProviderConfig,
|
||||
) {
|
||||
const request =
|
||||
cloudlyClientRef.typedsocketClient.createTypedRequest<plugins.servezoneInterfaces.requests.platform.IReq_Any_Cloudly_UpsertPlatformProviderConfig>(
|
||||
'upsertPlatformProviderConfig',
|
||||
);
|
||||
return await request.fire({
|
||||
identity: cloudlyClientRef.identity,
|
||||
providerConfig,
|
||||
});
|
||||
}
|
||||
|
||||
public static async deletePlatformProviderConfigById(
|
||||
cloudlyClientRef: CloudlyApiClient,
|
||||
providerConfigId: string,
|
||||
) {
|
||||
const request =
|
||||
cloudlyClientRef.typedsocketClient.createTypedRequest<plugins.servezoneInterfaces.requests.platform.IReq_Any_Cloudly_DeletePlatformProviderConfigById>(
|
||||
'deletePlatformProviderConfigById',
|
||||
);
|
||||
return await request.fire({
|
||||
identity: cloudlyClientRef.identity,
|
||||
providerConfigId,
|
||||
});
|
||||
}
|
||||
|
||||
public static async getPlatformBindings(
|
||||
cloudlyClientRef: CloudlyApiClient,
|
||||
optionsArg: {
|
||||
serviceId?: string;
|
||||
capability?: plugins.servezoneInterfaces.platform.TPlatformCapability;
|
||||
} = {},
|
||||
) {
|
||||
const request =
|
||||
cloudlyClientRef.typedsocketClient.createTypedRequest<plugins.servezoneInterfaces.requests.platform.IReq_Any_Cloudly_GetPlatformBindings>(
|
||||
'getPlatformBindings',
|
||||
);
|
||||
return await request.fire({
|
||||
identity: cloudlyClientRef.identity,
|
||||
...optionsArg,
|
||||
});
|
||||
}
|
||||
|
||||
public static async upsertPlatformBinding(
|
||||
cloudlyClientRef: CloudlyApiClient,
|
||||
binding: plugins.servezoneInterfaces.platform.IPlatformBinding,
|
||||
) {
|
||||
const request =
|
||||
cloudlyClientRef.typedsocketClient.createTypedRequest<plugins.servezoneInterfaces.requests.platform.IReq_Any_Cloudly_UpsertPlatformBinding>(
|
||||
'upsertPlatformBinding',
|
||||
);
|
||||
return await request.fire({
|
||||
identity: cloudlyClientRef.identity,
|
||||
binding,
|
||||
});
|
||||
}
|
||||
|
||||
public static async updatePlatformBindingStatus(
|
||||
cloudlyClientRef: CloudlyApiClient,
|
||||
optionsArg: Omit<
|
||||
plugins.servezoneInterfaces.requests.platform.IReq_Any_Cloudly_UpdatePlatformBindingStatus['request'],
|
||||
'identity'
|
||||
>,
|
||||
) {
|
||||
const request =
|
||||
cloudlyClientRef.typedsocketClient.createTypedRequest<plugins.servezoneInterfaces.requests.platform.IReq_Any_Cloudly_UpdatePlatformBindingStatus>(
|
||||
'updatePlatformBindingStatus',
|
||||
);
|
||||
return await request.fire({
|
||||
identity: cloudlyClientRef.identity,
|
||||
...optionsArg,
|
||||
});
|
||||
}
|
||||
|
||||
public static async deletePlatformBindingById(cloudlyClientRef: CloudlyApiClient, bindingId: string) {
|
||||
const request =
|
||||
cloudlyClientRef.typedsocketClient.createTypedRequest<plugins.servezoneInterfaces.requests.platform.IReq_Any_Cloudly_DeletePlatformBindingById>(
|
||||
'deletePlatformBindingById',
|
||||
);
|
||||
return await request.fire({
|
||||
identity: cloudlyClientRef.identity,
|
||||
bindingId,
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user