fix(secret-management): Refactor secret management to use distinct secret bundle and group APIs. Introduce API client classes for secret bundles and groups.
This commit is contained in:
@@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@serve.zone/cloudly',
|
||||
version: '4.5.2',
|
||||
version: '4.5.3',
|
||||
description: 'A comprehensive tool for managing containerized applications across multiple cloud providers using Docker Swarmkit, featuring web, CLI, and API interfaces.'
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@ export const loginAction = loginStatePart.createAction<{ username: string; passw
|
||||
async (statePartArg, payloadArg) => {
|
||||
const currentState = statePartArg.getState();
|
||||
const trLogin =
|
||||
new domtools.plugins.typedrequest.TypedRequest<plugins.interfaces.requests.secret.IReq_Admin_LoginWithUsernameAndPassword>(
|
||||
new domtools.plugins.typedrequest.TypedRequest<plugins.interfaces.requests.admin.IReq_Admin_LoginWithUsernameAndPassword>(
|
||||
'/typedrequest',
|
||||
'adminLoginWithUsernameAndPassword'
|
||||
);
|
||||
@@ -77,20 +77,34 @@ export const dataState = await appstate.getStatePart<IDataState>(
|
||||
);
|
||||
|
||||
// Getting data
|
||||
export const getAllDataAction = dataState.createAction(async (statePartArg, partialArg?: 'secrets' | 'images') => {
|
||||
export const getAllDataAction = dataState.createAction(async (statePartArg) => {
|
||||
let currentState = statePartArg.getState();
|
||||
// Secrets
|
||||
const trGetSecrets =
|
||||
new domtools.plugins.typedrequest.TypedRequest<plugins.interfaces.requests.secret.IReq_Admin_GetConfigBundlesAndSecretGroups>(
|
||||
// SecretsGroups
|
||||
const trGetSecretGroups =
|
||||
new domtools.plugins.typedrequest.TypedRequest<plugins.interfaces.requests.secretgroup.IReq_GetSecretGroups>(
|
||||
'/typedrequest',
|
||||
'adminGetConfigBundlesAndSecretGroups'
|
||||
'getSecretGroups'
|
||||
);
|
||||
const response = await trGetSecrets.fire({
|
||||
const response = await trGetSecretGroups.fire({
|
||||
identity: loginStatePart.getState().identity,
|
||||
});
|
||||
currentState = {
|
||||
...currentState,
|
||||
...response,
|
||||
secretGroups: response.secretGroups,
|
||||
};
|
||||
|
||||
// SecretBundles
|
||||
const trGetSecretBundles =
|
||||
new domtools.plugins.typedrequest.TypedRequest<plugins.interfaces.requests.secretbundle.IReq_GetSecretBundles>(
|
||||
'/typedrequest',
|
||||
'getSecretBundles'
|
||||
);
|
||||
const responseSecretBundles = await trGetSecretBundles.fire({
|
||||
identity: loginStatePart.getState().identity,
|
||||
});
|
||||
currentState = {
|
||||
...currentState,
|
||||
secretBundles: responseSecretBundles.secretBundles,
|
||||
};
|
||||
|
||||
// images
|
||||
@@ -104,7 +118,7 @@ export const getAllDataAction = dataState.createAction(async (statePartArg, part
|
||||
});
|
||||
currentState = {
|
||||
...currentState,
|
||||
...responseImages,
|
||||
images: responseImages.images,
|
||||
};
|
||||
|
||||
// Clusters
|
||||
@@ -119,7 +133,7 @@ export const getAllDataAction = dataState.createAction(async (statePartArg, part
|
||||
|
||||
currentState = {
|
||||
...currentState,
|
||||
...responseClusters,
|
||||
clusters: responseClusters.clusters,
|
||||
}
|
||||
|
||||
return currentState;
|
||||
@@ -130,9 +144,9 @@ export const createSecretGroupAction = dataState.createAction(
|
||||
async (statePartArg, payloadArg: plugins.interfaces.data.ISecretGroup) => {
|
||||
let currentState = statePartArg.getState();
|
||||
const trCreateSecretGroup =
|
||||
new domtools.plugins.typedrequest.TypedRequest<plugins.interfaces.requests.secret.IReq_Admin_CreateConfigBundlesAndSecretGroups>(
|
||||
new domtools.plugins.typedrequest.TypedRequest<plugins.interfaces.requests.secret.IReq_Admin_CreateSecretBundlesAndGroups>(
|
||||
'/typedrequest',
|
||||
'adminCreateConfigBundlesAndSecretGroups'
|
||||
'adminCreateSecretBundlesAndGroups'
|
||||
);
|
||||
const response = await trCreateSecretGroup.fire({
|
||||
identity: loginStatePart.getState().identity,
|
||||
@@ -149,7 +163,7 @@ export const deleteSecretGroupAction = dataState.createAction(
|
||||
async (statePartArg, payloadArg: { secretGroupId: string }) => {
|
||||
let currentState = statePartArg.getState();
|
||||
const trDeleteSecretGroup =
|
||||
new domtools.plugins.typedrequest.TypedRequest<plugins.interfaces.requests.secret.IReq_Admin_DeleteConfigBundlesAndSecretGroups>(
|
||||
new domtools.plugins.typedrequest.TypedRequest<plugins.interfaces.requests.secret.IReq_Admin_DeleteSecretBundlesAndGroups>(
|
||||
'/typedrequest',
|
||||
'adminDeleteConfigBundlesAndSecretGroups'
|
||||
);
|
||||
@@ -168,7 +182,7 @@ export const deleteSecretBundleAction = dataState.createAction(
|
||||
async (statePartArg, payloadArg: { configBundleId: string }) => {
|
||||
let currentState = statePartArg.getState();
|
||||
const trDeleteConfigBundle =
|
||||
new domtools.plugins.typedrequest.TypedRequest<plugins.interfaces.requests.secret.IReq_Admin_DeleteConfigBundlesAndSecretGroups>(
|
||||
new domtools.plugins.typedrequest.TypedRequest<plugins.interfaces.requests.secret.IReq_Admin_DeleteSecretBundlesAndGroups>(
|
||||
'/typedrequest',
|
||||
'adminDeleteConfigBundlesAndSecretGroups'
|
||||
);
|
||||
|
Reference in New Issue
Block a user