/* * dbMango * * Copyright 2025 Deutsche Bank AG * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ namespace Rms.Risk.Mango.Interfaces; /// /// Represents the base context for database configurations. /// public class ContextBase { /// /// Gets or sets the type of the context. /// public string Type { get; set; } = "dbMangoDatabase"; /// /// Gets or sets the name of the context. /// public string Name { get; set; } = ""; /// /// Gets or sets the unique identifier of the context. /// public long ID { get; set; } /// /// Gets or sets the unique identifier of the parent context. /// public long ParentID { get; set; } /// /// Gets or sets a value indicating whether the context is a template. /// public bool IsTemplate { get; set; } /// /// Gets or sets a value indicating whether the context is proposed for deletion. /// public bool ProposedForDeletion { get; set; } } /// /// Represents the database configuration context for a Mango database. /// public class DbMangoDatabaseConfigContext : ContextBase { /// /// Gets or sets the database parameters for the configuration. /// public DatabaseParams DatabaseParams { get; set; } = new(); /// /// Gets or sets the LDAP group parameters for the configuration. /// public DatabasesConfig.DatabaseConfig.LdapGroups LdapParams { get; set; } = new(); } /// /// Interface for managing database configuration storage operations. /// public interface IDatabaseConfigurationStorage { /// /// Reads a database configuration by its identifier. /// /// The unique identifier of the database configuration. /// A cancellation token to observe while waiting for the task to complete. /// A task that represents the asynchronous operation. The task result contains the database configuration context. Task Read(long id, CancellationToken token); /// /// Creates a new database configuration. /// /// The database configuration context to create. /// The email of the user performing the operation. /// A cancellation token to observe while waiting for the task to complete. /// A task that represents the asynchronous operation. The task result contains the unique identifier of the created configuration. Task Create(DbMangoDatabaseConfigContext ctx, string email, CancellationToken token); /// /// Updates an existing database configuration. /// /// The database configuration context to update. /// The email of the user performing the operation. /// A cancellation token to observe while waiting for the task to complete. /// A task that represents the asynchronous operation. Task Update(DbMangoDatabaseConfigContext ctx, string email, CancellationToken token); /// /// Deletes a database configuration by its identifier. /// /// The unique identifier of the database configuration to delete. /// The email of the user performing the operation. /// A cancellation token to observe while waiting for the task to complete. /// A task that represents the asynchronous operation. Task Delete(long id, string email, CancellationToken token); /// /// Lists all database configurations associated with a specific user. /// /// The email of the user whose configurations are to be listed. /// A cancellation token to observe while waiting for the task to complete. /// A task that represents the asynchronous operation. The task result contains a list of database configuration contexts. Task> List(string email, CancellationToken token); /// /// Retrieves configuration settings for a specific user. /// /// The email of the user whose configuration settings are to be retrieved. /// A cancellation token to observe while waiting for the task to complete. /// A task that represents the asynchronous operation. The task result contains a dictionary of configuration settings. Task> GetConfiguration(string email, CancellationToken token); /// /// Updates configuration settings for a specific user. /// /// The dictionary of configuration settings to update. /// The email of the user performing the operation. /// A cancellation token to observe while waiting for the task to complete. /// A task that represents the asynchronous operation. Task UpdateConfiguration(Dictionary configuration, string email, CancellationToken token); }