feat(service): Add support for service creation, update, and deletion.
This commit is contained in:
parent
f3d5c21fab
commit
6e5dd9b05a
@ -1,5 +1,12 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2025-01-20 - 4.13.0 - feat(service)
|
||||||
|
Add support for service creation, update, and deletion.
|
||||||
|
|
||||||
|
- Implemented TypedHandlers for creating a new service.
|
||||||
|
- Added features to update existing service details.
|
||||||
|
- Enabled deletion of services by their unique ID.
|
||||||
|
|
||||||
## 2025-01-20 - 4.12.2 - fix(service)
|
## 2025-01-20 - 4.12.2 - fix(service)
|
||||||
Fix secret bundle and service management bugs
|
Fix secret bundle and service management bugs
|
||||||
|
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@serve.zone/cloudly',
|
name: '@serve.zone/cloudly',
|
||||||
version: '4.12.2',
|
version: '4.13.0',
|
||||||
description: 'A comprehensive tool for managing containerized applications across multiple cloud providers using Docker Swarmkit, featuring web, CLI, and API interfaces.'
|
description: 'A comprehensive tool for managing containerized applications across multiple cloud providers using Docker Swarmkit, featuring web, CLI, and API interfaces.'
|
||||||
}
|
}
|
||||||
|
@ -62,5 +62,39 @@ export class ServiceManager {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this.typedrouter.addTypedHandler(
|
||||||
|
new plugins.typedrequest.TypedHandler<plugins.servezoneInterfaces.requests.service.IRequest_Any_Cloudly_UpdateService>(
|
||||||
|
'updateService',
|
||||||
|
async (dataArg) => {
|
||||||
|
const service = await Service.getInstance({
|
||||||
|
id: dataArg.serviceId,
|
||||||
|
});
|
||||||
|
service.data = {
|
||||||
|
...service.data,
|
||||||
|
...dataArg.serviceData,
|
||||||
|
};
|
||||||
|
await service.save();
|
||||||
|
return {
|
||||||
|
service: await service.createSavableObject(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
this.typedrouter.addTypedHandler(
|
||||||
|
new plugins.typedrequest.TypedHandler<plugins.servezoneInterfaces.requests.service.IRequest_Any_Cloudly_DeleteServiceById>(
|
||||||
|
'deleteServiceById',
|
||||||
|
async (dataArg) => {
|
||||||
|
const service = await Service.getInstance({
|
||||||
|
id: dataArg.serviceId,
|
||||||
|
});
|
||||||
|
await service.delete();
|
||||||
|
return {
|
||||||
|
success: true,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,19 +40,7 @@ export class Service implements plugins.servezoneInterfaces.data.IService {
|
|||||||
);
|
);
|
||||||
const response = await createServiceTR.fire({
|
const response = await createServiceTR.fire({
|
||||||
identity: cloudlyClientRef.identity,
|
identity: cloudlyClientRef.identity,
|
||||||
name: serviceDataArg.name,
|
serviceData: serviceDataArg as plugins.servezoneInterfaces.data.IService['data'],
|
||||||
description: serviceDataArg.description,
|
|
||||||
imageId: serviceDataArg.imageId,
|
|
||||||
imageVersion: serviceDataArg.imageVersion,
|
|
||||||
environment: {},
|
|
||||||
secretBundleId: null,
|
|
||||||
scaleFactor: 1,
|
|
||||||
balancingStrategy: serviceDataArg.balancingStrategy,
|
|
||||||
ports: {
|
|
||||||
web: null,
|
|
||||||
},
|
|
||||||
resources: serviceDataArg.resources,
|
|
||||||
domains: [],
|
|
||||||
});
|
});
|
||||||
const newService = new Service(cloudlyClientRef);
|
const newService = new Service(cloudlyClientRef);
|
||||||
Object.assign(newService, response.service);
|
Object.assign(newService, response.service);
|
||||||
|
@ -40,24 +40,7 @@ extends plugins.typedrequestInterfaces.implementsTR<
|
|||||||
method: 'createService';
|
method: 'createService';
|
||||||
request: {
|
request: {
|
||||||
identity: IIdentity;
|
identity: IIdentity;
|
||||||
name: string;
|
serviceData: IService['data'];
|
||||||
description: string;
|
|
||||||
imageId: string;
|
|
||||||
imageVersion: string;
|
|
||||||
environment: { [key: string]: string };
|
|
||||||
secretBundleId: string;
|
|
||||||
scaleFactor: number;
|
|
||||||
balancingStrategy: 'round-robin' | 'least-connections';
|
|
||||||
ports: {
|
|
||||||
web: number;
|
|
||||||
custom?: { [domain: string]: string };
|
|
||||||
};
|
|
||||||
resources?: IServiceRessources;
|
|
||||||
domains: {
|
|
||||||
name: string;
|
|
||||||
port?: number;
|
|
||||||
protocol?: 'http' | 'https' | 'ssh';
|
|
||||||
}[];
|
|
||||||
};
|
};
|
||||||
response: {
|
response: {
|
||||||
service: IService;
|
service: IService;
|
||||||
@ -73,36 +56,19 @@ extends plugins.typedrequestInterfaces.implementsTR<
|
|||||||
request: {
|
request: {
|
||||||
identity: IIdentity;
|
identity: IIdentity;
|
||||||
serviceId: string;
|
serviceId: string;
|
||||||
name: string;
|
serviceData: IService['data'];
|
||||||
description: string;
|
|
||||||
imageId: string;
|
|
||||||
imageVersion: string;
|
|
||||||
environment: { [key: string]: string };
|
|
||||||
secretBundleId: string;
|
|
||||||
scaleFactor: number;
|
|
||||||
balancingStrategy: 'round-robin' | 'least-connections';
|
|
||||||
ports: {
|
|
||||||
web: number;
|
|
||||||
custom?: { [domain: string]: string };
|
|
||||||
};
|
|
||||||
resources?: IServiceRessources;
|
|
||||||
domains: {
|
|
||||||
name: string;
|
|
||||||
port?: number;
|
|
||||||
protocol?: 'http' | 'https' | 'ssh';
|
|
||||||
}[];
|
|
||||||
};
|
};
|
||||||
response: {
|
response: {
|
||||||
service: IService;
|
service: IService;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IRequest_Any_Cloudly_DeleteService
|
export interface IRequest_Any_Cloudly_DeleteServiceById
|
||||||
extends plugins.typedrequestInterfaces.implementsTR<
|
extends plugins.typedrequestInterfaces.implementsTR<
|
||||||
plugins.typedrequestInterfaces.ITypedRequest,
|
plugins.typedrequestInterfaces.ITypedRequest,
|
||||||
IRequest_Any_Cloudly_DeleteService
|
IRequest_Any_Cloudly_DeleteServiceById
|
||||||
> {
|
> {
|
||||||
method: 'deleteService';
|
method: 'deleteServiceById';
|
||||||
request: {
|
request: {
|
||||||
identity: IIdentity;
|
identity: IIdentity;
|
||||||
serviceId: string;
|
serviceId: string;
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@serve.zone/cloudly',
|
name: '@serve.zone/cloudly',
|
||||||
version: '4.12.2',
|
version: '4.13.0',
|
||||||
description: 'A comprehensive tool for managing containerized applications across multiple cloud providers using Docker Swarmkit, featuring web, CLI, and API interfaces.'
|
description: 'A comprehensive tool for managing containerized applications across multiple cloud providers using Docker Swarmkit, featuring web, CLI, and API interfaces.'
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user