From a617f51b1992dab0e85d3bd071b9a79bd621dfe3 Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Sun, 29 Dec 2024 13:40:51 +0100 Subject: [PATCH] feat(apiclient): Added support for managing external registries in the API client. --- changelog.md | 6 ++++++ ts/00_commitinfo_data.ts | 2 +- ts_apiclient/classes.cloudlyapiclient.ts | 14 ++++++++++++++ ts_apiclient/classes.externalregistry.ts | 7 +++---- ts_interfaces/requests/externalregistry.ts | 1 - ts_web/00_commitinfo_data.ts | 2 +- 6 files changed, 25 insertions(+), 7 deletions(-) diff --git a/changelog.md b/changelog.md index 7179ac0..431b528 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # Changelog +## 2024-12-29 - 4.10.0 - feat(apiclient) +Added support for managing external registries in the API client. + +- Introduced methods to get a registry by ID, get all registries, and create a new registry in the externalRegistry object. +- Updated external registry request interfaces to match new API client capabilities. + ## 2024-12-29 - 4.9.0 - feat(apiclient) Add external registry management capabilities to Cloudly API client. diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 00c57fc..f525271 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@serve.zone/cloudly', - version: '4.9.0', + version: '4.10.0', description: 'A comprehensive tool for managing containerized applications across multiple cloud providers using Docker Swarmkit, featuring web, CLI, and API interfaces.' } diff --git a/ts_apiclient/classes.cloudlyapiclient.ts b/ts_apiclient/classes.cloudlyapiclient.ts index 74e42ba..1d35e60 100644 --- a/ts_apiclient/classes.cloudlyapiclient.ts +++ b/ts_apiclient/classes.cloudlyapiclient.ts @@ -7,6 +7,7 @@ import { Service } from './classes.service.js'; import { Cluster } from './classes.cluster.js'; import { SecretBundle } from './classes.secretbundle.js'; import { SecretGroup } from './classes.secretgroup.js'; +import { ExternalRegistry } from './classes.externalregistry.js'; export class CloudlyApiClient { private cloudlyUrl: string; @@ -159,6 +160,19 @@ export class CloudlyApiClient { return typedResponse.certificate; } + public externalRegistry = { + // ExternalRegistry + getRegistryById: async (registryNameArg: string) => { + return ExternalRegistry.getExternalRegistryById(this, registryNameArg); + }, + getRegistries: async () => { + return ExternalRegistry.getExternalRegistries(this); + }, + createRegistry: async (optionsArg: Parameters[1]) => { + return ExternalRegistry.createExternalRegistry(this, optionsArg); + } + } + public image = { // Images getImageById: async (imageIdArg: string) => { diff --git a/ts_apiclient/classes.externalregistry.ts b/ts_apiclient/classes.externalregistry.ts index 4806375..d957dd2 100644 --- a/ts_apiclient/classes.externalregistry.ts +++ b/ts_apiclient/classes.externalregistry.ts @@ -3,7 +3,7 @@ import type { CloudlyApiClient } from './classes.cloudlyapiclient.js'; export class ExternalRegistry implements plugins.servezoneInterfaces.data.IExternalRegistry { // STATIC - public static async getRegistryById(cloudlyClientRef: CloudlyApiClient, registryNameArg: string) { + public static async getExternalRegistryById(cloudlyClientRef: CloudlyApiClient, registryNameArg: string) { const getRegistryByIdTR = cloudlyClientRef.typedsocketClient.createTypedRequest( 'getExternalRegistryById' ); @@ -16,7 +16,7 @@ export class ExternalRegistry implements plugins.servezoneInterfaces.data.IExter return newRegistry; } - public static async getRegistries(cloudlyClientRef: CloudlyApiClient) { + public static async getExternalRegistries(cloudlyClientRef: CloudlyApiClient) { const getRegistriesTR = cloudlyClientRef.typedsocketClient.createTypedRequest( 'getExternalRegistries' ); @@ -32,13 +32,12 @@ export class ExternalRegistry implements plugins.servezoneInterfaces.data.IExter return registryConfigs; } - public static async createRegistry(cloudlyClientRef: CloudlyApiClient, registryNameArg: string, registryDataArg: Partial) { + public static async createExternalRegistry(cloudlyClientRef: CloudlyApiClient, registryDataArg: Partial) { const createRegistryTR = cloudlyClientRef.typedsocketClient.createTypedRequest( 'createExternalRegistry' ); const response = await createRegistryTR.fire({ identity: cloudlyClientRef.identity, - registryName: registryNameArg, registryData: registryDataArg as plugins.servezoneInterfaces.data.IExternalRegistry['data'], }); const newRegistry = new ExternalRegistry(cloudlyClientRef); diff --git a/ts_interfaces/requests/externalregistry.ts b/ts_interfaces/requests/externalregistry.ts index 2c7f879..0878985 100644 --- a/ts_interfaces/requests/externalregistry.ts +++ b/ts_interfaces/requests/externalregistry.ts @@ -36,7 +36,6 @@ export interface IReq_CreateRegistry extends plugins.typedrequestInterfaces.impl method: 'createExternalRegistry'; request: { identity: userInterfaces.IIdentity; - registryName: string; registryData: data.IExternalRegistry['data']; }; response: { diff --git a/ts_web/00_commitinfo_data.ts b/ts_web/00_commitinfo_data.ts index 00c57fc..f525271 100644 --- a/ts_web/00_commitinfo_data.ts +++ b/ts_web/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@serve.zone/cloudly', - version: '4.9.0', + version: '4.10.0', description: 'A comprehensive tool for managing containerized applications across multiple cloud providers using Docker Swarmkit, featuring web, CLI, and API interfaces.' }