// Copyright Epic Games, Inc. All Rights Reserved. using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using EpicGames.Horde.ServiceAccounts; using HordeServer.Users; namespace HordeServer.ServiceAccounts { /// /// Interface for a collection of accounts /// public interface IServiceAccountCollection { /// /// Adds a new account to the collection /// /// Options for the new account /// Cancellation token for the operation Task<(IServiceAccount, string)> CreateAsync(CreateServiceAccountOptions options, CancellationToken cancellationToken = default); /// /// Searches service accounts /// /// Index of the first account /// Number of results to return /// Cancellation token for the operation /// The service account Task> FindAsync(int? index = null, int? count = null, CancellationToken cancellationToken = default); /// /// Get service account via secret token /// /// Secret token to use for searching /// Cancellation token for the operation /// The service account Task FindBySecretTokenAsync(string secretToken, CancellationToken cancellationToken = default); /// /// Get service account via ID /// /// The unique service account id /// Cancellation token for the operation /// The service account Task GetAsync(ServiceAccountId id, CancellationToken cancellationToken = default); /// /// Delete a service account from the collection /// /// The service account /// Cancellation token for the operation /// Async task Task DeleteAsync(ServiceAccountId id, CancellationToken cancellationToken = default); } /// /// Options for creating a new service account /// /// Name of the account /// Description for the account /// Optional list of claims /// Whether the account should be enabled public record CreateServiceAccountOptions(string Name, string Description, IReadOnlyList? Claims = null, bool? Enabled = null); }