feat: add platform api helpers
This commit is contained in:
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@serve.zone/api",
|
"name": "@serve.zone/api",
|
||||||
"version": "5.3.1",
|
"version": "5.3.2",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "Type-safe API client for Cloudly and the serve.zone control plane.",
|
"description": "Type-safe API client for Cloudly and the serve.zone control plane.",
|
||||||
"exports": {
|
"exports": {
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
"@push.rocks/smartpromise": "^4.2.3",
|
"@push.rocks/smartpromise": "^4.2.3",
|
||||||
"@push.rocks/smartrx": "^3.0.10",
|
"@push.rocks/smartrx": "^3.0.10",
|
||||||
"@push.rocks/smartstream": "^3.2.5",
|
"@push.rocks/smartstream": "^3.2.5",
|
||||||
"@serve.zone/interfaces": "^5.4.3",
|
"@serve.zone/interfaces": "^5.4.5",
|
||||||
"@tsclass/tsclass": "^9.2.0"
|
"@tsclass/tsclass": "^9.2.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
Generated
+5
-5
@@ -30,8 +30,8 @@ importers:
|
|||||||
specifier: ^3.2.5
|
specifier: ^3.2.5
|
||||||
version: 3.4.0
|
version: 3.4.0
|
||||||
'@serve.zone/interfaces':
|
'@serve.zone/interfaces':
|
||||||
specifier: ^5.4.3
|
specifier: ^5.4.5
|
||||||
version: 5.4.3
|
version: 5.4.5
|
||||||
'@tsclass/tsclass':
|
'@tsclass/tsclass':
|
||||||
specifier: ^9.2.0
|
specifier: ^9.2.0
|
||||||
version: 9.5.0
|
version: 9.5.0
|
||||||
@@ -1384,8 +1384,8 @@ packages:
|
|||||||
'@sec-ant/readable-stream@0.4.1':
|
'@sec-ant/readable-stream@0.4.1':
|
||||||
resolution: {integrity: sha512-831qok9r2t8AlxLko40y2ebgSDhenenCatLVeW/uBtnHPyhHOvG0C7TvfgecV+wHzIm5KUICgzmVpWS+IMEAeg==}
|
resolution: {integrity: sha512-831qok9r2t8AlxLko40y2ebgSDhenenCatLVeW/uBtnHPyhHOvG0C7TvfgecV+wHzIm5KUICgzmVpWS+IMEAeg==}
|
||||||
|
|
||||||
'@serve.zone/interfaces@5.4.3':
|
'@serve.zone/interfaces@5.4.5':
|
||||||
resolution: {integrity: sha512-9ijFhHoC7GYyyAUJbBoDYmcoCmIXTFPiD6fI3x68SWiC0xA+2LG0nOe14D32c1QN9X/3i2Ac5/1sUibfjHsIGg==}
|
resolution: {integrity: sha512-asqUUjem3MGfIbseovHR8SxE+6FvjeQEYtV+PxcyY8YRXJ/vE3hNCDs7ePXgBbh4JXa+vNMaXHsFfz5Vrk6Ggg==}
|
||||||
|
|
||||||
'@shikijs/engine-oniguruma@3.23.0':
|
'@shikijs/engine-oniguruma@3.23.0':
|
||||||
resolution: {integrity: sha512-1nWINwKXxKKLqPibT5f4pAFLej9oZzQTsby8942OTlsJzOBZ0MWKiwzMsd+jhzu8YPCHAswGnnN1YtQfirL35g==}
|
resolution: {integrity: sha512-1nWINwKXxKKLqPibT5f4pAFLej9oZzQTsby8942OTlsJzOBZ0MWKiwzMsd+jhzu8YPCHAswGnnN1YtQfirL35g==}
|
||||||
@@ -6566,7 +6566,7 @@ snapshots:
|
|||||||
|
|
||||||
'@sec-ant/readable-stream@0.4.1': {}
|
'@sec-ant/readable-stream@0.4.1': {}
|
||||||
|
|
||||||
'@serve.zone/interfaces@5.4.3':
|
'@serve.zone/interfaces@5.4.5':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@api.global/typedrequest-interfaces': 3.0.19
|
'@api.global/typedrequest-interfaces': 3.0.19
|
||||||
'@push.rocks/smartlog-interfaces': 3.0.2
|
'@push.rocks/smartlog-interfaces': 3.0.2
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import { Cluster } from './classes.cluster.js';
|
|||||||
import { SecretBundle } from './classes.secretbundle.js';
|
import { SecretBundle } from './classes.secretbundle.js';
|
||||||
import { SecretGroup } from './classes.secretgroup.js';
|
import { SecretGroup } from './classes.secretgroup.js';
|
||||||
import { ExternalRegistry } from './classes.externalregistry.js';
|
import { ExternalRegistry } from './classes.externalregistry.js';
|
||||||
|
import { Platform } from './classes.platform.js';
|
||||||
|
|
||||||
export class CloudlyApiClient {
|
export class CloudlyApiClient {
|
||||||
private cloudlyUrl: string;
|
private cloudlyUrl: string;
|
||||||
@@ -336,6 +337,52 @@ export class CloudlyApiClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public platform = {
|
||||||
|
getPlatformDesiredState: async () => {
|
||||||
|
return Platform.getPlatformDesiredState(this);
|
||||||
|
},
|
||||||
|
getPlatformCapabilities: async () => {
|
||||||
|
return Platform.getPlatformCapabilities(this);
|
||||||
|
},
|
||||||
|
getPlatformProviderConfigs: async (
|
||||||
|
capability?: plugins.servezoneInterfaces.platform.TPlatformCapability,
|
||||||
|
) => {
|
||||||
|
return Platform.getPlatformProviderConfigs(this, capability);
|
||||||
|
},
|
||||||
|
upsertPlatformProviderConfig: async (
|
||||||
|
providerConfig: plugins.servezoneInterfaces.platform.IPlatformProviderConfig,
|
||||||
|
) => {
|
||||||
|
return Platform.upsertPlatformProviderConfig(this, providerConfig);
|
||||||
|
},
|
||||||
|
deletePlatformProviderConfigById: async (providerConfigId: string) => {
|
||||||
|
return Platform.deletePlatformProviderConfigById(this, providerConfigId);
|
||||||
|
},
|
||||||
|
getPlatformBindings: async (
|
||||||
|
optionsArg: {
|
||||||
|
serviceId?: string;
|
||||||
|
capability?: plugins.servezoneInterfaces.platform.TPlatformCapability;
|
||||||
|
} = {},
|
||||||
|
) => {
|
||||||
|
return Platform.getPlatformBindings(this, optionsArg);
|
||||||
|
},
|
||||||
|
upsertPlatformBinding: async (
|
||||||
|
binding: plugins.servezoneInterfaces.platform.IPlatformBinding,
|
||||||
|
) => {
|
||||||
|
return Platform.upsertPlatformBinding(this, binding);
|
||||||
|
},
|
||||||
|
updatePlatformBindingStatus: async (
|
||||||
|
optionsArg: Omit<
|
||||||
|
plugins.servezoneInterfaces.requests.platform.IReq_Any_Cloudly_UpdatePlatformBindingStatus['request'],
|
||||||
|
'identity'
|
||||||
|
>,
|
||||||
|
) => {
|
||||||
|
return Platform.updatePlatformBindingStatus(this, optionsArg);
|
||||||
|
},
|
||||||
|
deletePlatformBindingById: async (bindingId: string) => {
|
||||||
|
return Platform.deletePlatformBindingById(this, bindingId);
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
// Settings API
|
// Settings API
|
||||||
public settings = {
|
public settings = {
|
||||||
getSettings: async (): Promise<{
|
getSettings: async (): Promise<{
|
||||||
|
|||||||
@@ -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