diff --git a/src/CentralApi/Mappings/ApiContractToDomainMapper.cs b/src/CentralApi/Mappings/ApiContractToDomainMapper.cs index 61d06024..20028cf3 100644 --- a/src/CentralApi/Mappings/ApiContractToDomainMapper.cs +++ b/src/CentralApi/Mappings/ApiContractToDomainMapper.cs @@ -2,6 +2,7 @@ using Middleware.CentralApi.Domain; using Middleware.Common.Enums; using Middleware.Models.Domain; +using Middleware.Models.Enums; namespace Middleware.CentralApi.Mappings; diff --git a/src/CentralApi/Services/LocationService.cs b/src/CentralApi/Services/LocationService.cs index 2ace3817..0ddd492b 100644 --- a/src/CentralApi/Services/LocationService.cs +++ b/src/CentralApi/Services/LocationService.cs @@ -8,6 +8,7 @@ using OneOf.Types; using Middleware.CentralApi.Mappings; using Middleware.Common.Enums; +using Middleware.Models.Enums; namespace Middleware.CentralApi.Services; diff --git a/src/CentralApi/Validation/RegisterRequestValidator.cs b/src/CentralApi/Validation/RegisterRequestValidator.cs index 34334547..50bf3bf6 100644 --- a/src/CentralApi/Validation/RegisterRequestValidator.cs +++ b/src/CentralApi/Validation/RegisterRequestValidator.cs @@ -1,6 +1,7 @@ using FluentValidation; using Middleware.CentralApi.Contracts.Requests; using Middleware.Common.Enums; +using Middleware.Models.Enums; namespace Middleware.CentralApi.Validation; diff --git a/src/Common/Enums/ActionStatusEnum.cs b/src/Common/Enums/ActionStatusEnum.cs new file mode 100644 index 00000000..992da500 --- /dev/null +++ b/src/Common/Enums/ActionStatusEnum.cs @@ -0,0 +1,10 @@ +namespace Middleware.Common.Enums; + +public enum ActionStatusEnum +{ + Unknown, + Running, + Finished, + Idle, + Off +} \ No newline at end of file diff --git a/src/Common/Enums/LocationType.cs b/src/Common/Enums/LocationType.cs deleted file mode 100644 index 66790abe..00000000 --- a/src/Common/Enums/LocationType.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Middleware.Common.Enums; - -public enum LocationType -{ - Edge, - Cloud -} \ No newline at end of file diff --git a/src/DataAccess/ExtensionMethods/DataAccessExtensionMethods.cs b/src/DataAccess/ExtensionMethods/DataAccessExtensionMethods.cs index 09c2c9bf..b47b352b 100644 --- a/src/DataAccess/ExtensionMethods/DataAccessExtensionMethods.cs +++ b/src/DataAccess/ExtensionMethods/DataAccessExtensionMethods.cs @@ -46,6 +46,9 @@ public static IServiceCollection RegisterRepositories(this IServiceCollection se services.AddScoped(); services.AddScoped(); services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); return services; } diff --git a/src/DataAccess/Repositories/Abstract/IActionPlanRepository.cs b/src/DataAccess/Repositories/Abstract/IActionPlanRepository.cs index 13922c2f..ef67abe8 100644 --- a/src/DataAccess/Repositories/Abstract/IActionPlanRepository.cs +++ b/src/DataAccess/Repositories/Abstract/IActionPlanRepository.cs @@ -4,5 +4,5 @@ namespace Middleware.DataAccess.Repositories.Abstract; public interface IActionPlanRepository : IBaseRepository, IRelationRepository { - Task> GetRobotActionPlans(Guid robotId); + Task?> GetRobotActionPlans(Guid robotId); } \ No newline at end of file diff --git a/src/DataAccess/Repositories/Abstract/IActionRunningRepository.cs b/src/DataAccess/Repositories/Abstract/IActionRunningRepository.cs new file mode 100644 index 00000000..264328a8 --- /dev/null +++ b/src/DataAccess/Repositories/Abstract/IActionRunningRepository.cs @@ -0,0 +1,9 @@ +using Middleware.Models.Domain; + +namespace Middleware.DataAccess.Repositories.Abstract +{ + public interface IActionRunningRepository: IBaseRepository, IRelationRepository + { + Task PatchActionAsync(Guid id, ActionRunningModel patch); + } +} diff --git a/src/DataAccess/Repositories/Abstract/IBaseRepository.cs b/src/DataAccess/Repositories/Abstract/IBaseRepository.cs index ba4c19cc..f4d3d8ed 100644 --- a/src/DataAccess/Repositories/Abstract/IBaseRepository.cs +++ b/src/DataAccess/Repositories/Abstract/IBaseRepository.cs @@ -28,7 +28,7 @@ public interface IBaseRepository where T : class /// Get all objects of the specified type from the data store /// /// - Task> GetAllAsync(); + Task?> GetAllAsync(); /// /// Delete object from the data store by its id diff --git a/src/DataAccess/Repositories/Abstract/IHistoricalActionPlanRepository.cs b/src/DataAccess/Repositories/Abstract/IHistoricalActionPlanRepository.cs new file mode 100644 index 00000000..b8338099 --- /dev/null +++ b/src/DataAccess/Repositories/Abstract/IHistoricalActionPlanRepository.cs @@ -0,0 +1,10 @@ +using Middleware.Models.Domain; + +namespace Middleware.DataAccess.Repositories.Abstract; + +public interface IHistoricalActionPlanRepository : IBaseRepository, IRelationRepository +{ + Task> GetRobotActionPlans(Guid robotId); + + Task> GetRobotReplanActionPlans(Guid robotId); +} \ No newline at end of file diff --git a/src/DataAccess/Repositories/Abstract/IInstanceRunningRepository.cs b/src/DataAccess/Repositories/Abstract/IInstanceRunningRepository.cs new file mode 100644 index 00000000..59a94386 --- /dev/null +++ b/src/DataAccess/Repositories/Abstract/IInstanceRunningRepository.cs @@ -0,0 +1,10 @@ +using Middleware.Models.Domain; + +namespace Middleware.DataAccess.Repositories.Abstract +{ + public interface IInstanceRunningRepository : IBaseRepository, IRelationRepository + { + Task PatchInstanceAsync(Guid id, InstanceRunningModel patch); + + } +} diff --git a/src/DataAccess/Repositories/Redis/RedisActionRepository.cs b/src/DataAccess/Repositories/Redis/RedisActionRepository.cs index 3cab4ab7..d045557b 100644 --- a/src/DataAccess/Repositories/Redis/RedisActionRepository.cs +++ b/src/DataAccess/Repositories/Redis/RedisActionRepository.cs @@ -37,7 +37,7 @@ public async Task PatchActionAsync(Guid id, ActionModel patch) { currentModel.Placement = patch.Placement; } - if (!string.IsNullOrEmpty(patch.PlacementType)) + if (patch.PlacementType is not null) { currentModel.PlacementType = patch.PlacementType; } diff --git a/src/DataAccess/Repositories/Redis/RedisActionRunningRepository.cs b/src/DataAccess/Repositories/Redis/RedisActionRunningRepository.cs new file mode 100644 index 00000000..bb2f95e9 --- /dev/null +++ b/src/DataAccess/Repositories/Redis/RedisActionRunningRepository.cs @@ -0,0 +1,68 @@ +using Middleware.DataAccess.Repositories.Abstract; +using Middleware.Models.Domain; +using Middleware.Models.Dto; +using Middleware.Models.Enums; +using Redis.OM.Contracts; +using RedisGraphDotNet.Client; +using Serilog; + +namespace Middleware.DataAccess.Repositories; + +public class RedisActionRunningRepository : RedisRepository, IActionRunningRepository +{ + public RedisActionRunningRepository(IRedisConnectionProvider provider, IRedisGraphClient redisGraph, ILogger logger) : base(provider, redisGraph, true, logger) + { + + } + + public async Task PatchActionAsync(Guid id, ActionRunningModel patch) + { + ActionRunningModel? currentModel = await GetByIdAsync(id); + if (currentModel == null) + { + return null; + } + if (!string.IsNullOrEmpty(patch.Name)) + { + currentModel.Name = patch.Name; + } + if (patch.Tags != null) + { + currentModel.Tags = patch.Tags; + } + if (!string.IsNullOrEmpty(patch.Order.ToString())) + { + currentModel.Order = patch.Order; + } + if (!string.IsNullOrEmpty(patch.Placement)) + { + currentModel.Placement = patch.Placement; + } + if (patch.PlacementType != LocationType.Unspecified) + { + currentModel.PlacementType = patch.PlacementType; + } + if (!string.IsNullOrEmpty(patch.ActionPriority)) + { + currentModel.ActionPriority = patch.ActionPriority; + } + if (!string.IsNullOrEmpty(patch.ActionStatus)) + { + currentModel.ActionStatus = patch.ActionStatus; + } + if (patch.Services != null) + { + currentModel.Services = patch.Services; + } + if (!string.IsNullOrEmpty(patch.MinimumRam.ToString())) + { + currentModel.MinimumRam = patch.MinimumRam; + } + if (!string.IsNullOrEmpty(patch.MinimumNumCores.ToString())) + { + currentModel.MinimumNumCores = patch.MinimumNumCores; + } + await UpdateAsync(currentModel); + return currentModel; + } +} diff --git a/src/DataAccess/Repositories/Redis/RedisHistoricalActionPlanRepository.cs b/src/DataAccess/Repositories/Redis/RedisHistoricalActionPlanRepository.cs new file mode 100644 index 00000000..ebf47dac --- /dev/null +++ b/src/DataAccess/Repositories/Redis/RedisHistoricalActionPlanRepository.cs @@ -0,0 +1,55 @@ +using System.Collections.Generic; +using System.Text.Json; +using Microsoft.Extensions.Logging; +using Middleware.Common.Enums; +using Middleware.DataAccess.Repositories.Abstract; +using Middleware.Models.Domain; +using Middleware.Models.Dto; +using Middleware.Models.Enums; +using NReJSON; +using Redis.OM.Contracts; +using RedisGraphDotNet.Client; +using StackExchange.Redis; +using ILogger = Serilog.ILogger; + + +namespace Middleware.DataAccess.Repositories +{ + public class RedisHistoricalActionPlanRepository : RedisRepository, IHistoricalActionPlanRepository + { + /// + /// Default constructor + /// + /// + /// + /// + public RedisHistoricalActionPlanRepository(IRedisConnectionProvider provider, IRedisGraphClient redisGraph, + ILogger logger) : base(provider, redisGraph, true, logger) + { + } + + /// + /// Retrieves all actionPlanModels associated with an specific robot Id. + /// + /// List of ActionPlanModel + public async Task> GetRobotActionPlans(Guid robotId) + { + var guidStr = robotId.ToString(); + var actionPlans = await FindQuery(dto => dto.RobotId == guidStr).ToListAsync(); + var planModels = actionPlans.Select(ToTModel).ToList(); + return planModels; + } + + /// + /// Retrieves all actionPlanModels associated with an specific robot Id that have a replan set to true. + /// + /// List of HistoricalActionPlanModel + public async Task> GetRobotReplanActionPlans(Guid robotId) + { + var guidStr = robotId.ToString(); + var actionPlans = await FindQuery(dto => dto.RobotId == guidStr && dto.IsReplan == true).ToListAsync(); + var planModels = actionPlans.Select(ToTModel).ToList(); + return planModels; + } + } +} \ No newline at end of file diff --git a/src/DataAccess/Repositories/Redis/RedisInstanceRunningRepository.cs b/src/DataAccess/Repositories/Redis/RedisInstanceRunningRepository.cs new file mode 100644 index 00000000..65b62d53 --- /dev/null +++ b/src/DataAccess/Repositories/Redis/RedisInstanceRunningRepository.cs @@ -0,0 +1,66 @@ +using Microsoft.IdentityModel.Tokens; +using Middleware.DataAccess.Repositories.Abstract; +using Middleware.Models.Domain; +using Middleware.Models.Dto; +using Redis.OM.Contracts; +using RedisGraphDotNet.Client; +using Serilog; + +namespace Middleware.DataAccess.Repositories +{ + public class RedisInstanceRunningRepository : RedisRepository, IInstanceRunningRepository + { + /// + /// Default constructor + /// + /// + /// + /// + public RedisInstanceRunningRepository(IRedisConnectionProvider provider, IRedisGraphClient redisGraph, ILogger logger) : base(provider, redisGraph, true, logger) + { + } + + /// + /// Patching properties for InstaceModel + /// + /// + /// + /// Patched model + public async Task PatchInstanceAsync(Guid id, InstanceRunningModel patch) + { + InstanceRunningModel? currentModel = await GetByIdAsync(id); + if (currentModel == null) + { + return null; + } + if (!string.IsNullOrEmpty(patch.Name)) + { + currentModel.Name = patch.Name; + } + if (!string.IsNullOrEmpty(patch.ServiceType)) + { + currentModel.ServiceType = patch.ServiceType; + } + if (!string.IsNullOrEmpty(patch.ServiceInstanceId.ToString())) + { + currentModel.ServiceInstanceId = patch.ServiceInstanceId; + } + if (!string.IsNullOrEmpty(patch.ServiceUrl)) + { + currentModel.ServiceUrl = patch.ServiceUrl; + } + if (!string.IsNullOrEmpty(patch.ServiceStatus)) + { + currentModel.ServiceStatus = patch.ServiceStatus; + } + if (!string.IsNullOrEmpty(patch.DeployedTime.ToString())) + { + currentModel.DeployedTime = patch.DeployedTime; + } + + await UpdateAsync(currentModel); + return currentModel; + } + + } +} diff --git a/src/DataConverter/Program.cs b/src/DataConverter/Program.cs index b45f73f6..669a2205 100644 --- a/src/DataConverter/Program.cs +++ b/src/DataConverter/Program.cs @@ -3,6 +3,7 @@ using Microsoft.Extensions.Logging.Abstractions; using Middleware.Common.Config; using Middleware.DataAccess.Repositories; +using Middleware.DataAccess.Repositories.Abstract; using Middleware.DataAccess.Repositories.Redis; using Middleware.Models.Domain; using Middleware.RedisInterface.Contracts.Responses; @@ -182,17 +183,18 @@ { actionPlan.LastStatusChange = DateTime.Now; actionPlan.TaskStartedAt = DateTime.Now.AddDays(-1); - actionPlan.ActionSequence.ForEach(a=>a.Services.ForEach(i=>i.OnboardedTime = DateTime.Today.AddDays(-10))); + //actionPlan.ActionSequence.ForEach(a=>a.Services.ForEach(i=>i.OnboardedTime = DateTime.Today.AddDays(-10))); await redisActionPlanRepository.AddAsync(actionPlan); } #endregion + #region relations Console.WriteLine("Writing Relations..."); - +var historicalActionPlanRepository = new RedisHistoricalActionPlanRepository(clusterConnectionProvider, redisGraphClient, Serilog.Log.Logger); var dashboardService = new DashboardService(robotRepository, taskRepository, actionPlanRepository, edgeRepository, - cloudRepository, instanceRepository, actionRepository); + cloudRepository, instanceRepository, actionRepository, historicalActionPlanRepository); var relations = await dashboardService.GetAllRelationModelsAsync(); diff --git a/src/Models/Domain/ActionModel.cs b/src/Models/Domain/ActionModel.cs index 8a1200e1..29e91c1c 100644 --- a/src/Models/Domain/ActionModel.cs +++ b/src/Models/Domain/ActionModel.cs @@ -1,6 +1,7 @@ using System.Text.Json.Serialization; using Middleware.Models.Dto; using Middleware.Models.Dto.Hardware; +using Middleware.Models.Enums; namespace Middleware.Models.Domain; @@ -10,8 +11,7 @@ public class ActionModel : BaseModel public override Guid Id { get; set; } = Guid.NewGuid(); [JsonPropertyName("Name")] - public override string Name { get; set; } - + public override string Name { get; set; } = default!; [JsonPropertyName("Tags")] public List? Tags { get; set; } @@ -23,7 +23,7 @@ public class ActionModel : BaseModel public string? Placement { get; set; } [JsonPropertyName("PlacementType")] - public string? PlacementType { get; set; } // Either edge or cloud. + public LocationType? PlacementType { get; set; } [JsonPropertyName("ActionPriority")] public string? ActionPriority { get; set; } @@ -54,7 +54,26 @@ public override Dto.Dto ToDto() MinimumRam = domain.MinimumRam, MinimumNumCores = domain.MinimumNumCores }, - Tags = domain.Tags + Tags = domain.Tags ?? new List() + }; + } + + public ActionRunningModel ToActionRunningModel(Guid actionPlanId) + { + var that = this; + return new ActionRunningModel() + { + ActionPriority = that.ActionPriority, + ActionId = that.Id, + ActionPlanId = actionPlanId, + Name = that.Name, + ActionStatus = that.ActionStatus, + Placement = that.Placement!, + PlacementType = that.PlacementType!.Value, + Order = that.Order, + MinimumRam = that.MinimumRam, + MinimumNumCores = that.MinimumNumCores, + Tags = that.Tags }; } } \ No newline at end of file diff --git a/src/Models/Domain/ActionPlanModel.cs b/src/Models/Domain/ActionPlanModel.cs index 8bb61f72..6bbad177 100644 --- a/src/Models/Domain/ActionPlanModel.cs +++ b/src/Models/Domain/ActionPlanModel.cs @@ -5,20 +5,20 @@ namespace Middleware.Models.Domain; public sealed class ActionPlanModel : BaseModel { - [JsonPropertyName("Id")] //atuomatically generated plan id by middleware + [JsonPropertyName("Id")] public override Guid Id { get; set; } - [JsonPropertyName("TaskId")] //TaskID + [JsonPropertyName("TaskId")] public Guid TaskId { get; set; } - [JsonPropertyName("Name")] // Name of task - public override string Name { get; set; } + [JsonPropertyName("Name")] + public override string Name { get; set; } = default!; /// /// Status of the whole plan /// [JsonPropertyName("Status")] - public string Status { get; set; } + public string? Status { get; set; } [JsonPropertyName("IsReplan")] //Status of whole plan public bool IsReplan { get; set; } @@ -27,7 +27,7 @@ public sealed class ActionPlanModel : BaseModel public DateTime LastStatusChange { get; set; } // AL 2022-05-10: Not sure we need this one or how to use it. [JsonPropertyName("ActionSequence")] - public List ActionSequence { get; set; } + public List ActionSequence { get; set; } = new(); [JsonPropertyName("RobotId")] public Guid RobotId { get; set; } @@ -56,6 +56,7 @@ public void SetStatus(string status) Status = status; LastStatusChange = DateTime.UtcNow; } + public override Dto.Dto ToDto() { var domain = this; @@ -70,6 +71,6 @@ public override Dto.Dto ToDto() ActionSequence = domain.ActionSequence, RobotId = domain.RobotId.ToString(), TaskStartedAt = domain.TaskStartedAt == default ? DateTimeOffset.Now : domain.TaskStartedAt, - }; ; + }; } } \ No newline at end of file diff --git a/src/Models/Domain/ActionRunningModel.cs b/src/Models/Domain/ActionRunningModel.cs new file mode 100644 index 00000000..c798dbda --- /dev/null +++ b/src/Models/Domain/ActionRunningModel.cs @@ -0,0 +1,83 @@ +using System.Runtime.InteropServices; +using Middleware.Models.Dto.Hardware; +using Middleware.Models.Dto; +using System.Text.Json.Serialization; +using Middleware.Models.Enums; + +namespace Middleware.Models.Domain; + +public class ActionRunningModel : BaseModel +{ + /// + /// Unique identifier of a running action + /// + [JsonPropertyName("Id")] + public override Guid Id { get; set; } = Guid.NewGuid(); + + /// + /// Identifier of the action definition + /// + [JsonPropertyName("ActionId")] + public Guid ActionId { get; set; } + + /// + /// Identifier of the ActionPlan the running action is associated with + /// + [JsonPropertyName("ActionPlanId")] + public Guid ActionPlanId { get; set; } + + /// + /// Name of the running action + /// + [JsonPropertyName("Name")] + public override string Name { get; set; } = default!; + + [JsonPropertyName("Tags")] + public List? Tags { get; set; } + + [JsonPropertyName("Order")] + public int Order { get; set; } + + [JsonPropertyName("Placement")] + public string Placement { get; set; } = default!; + + [JsonPropertyName("PlacementType")] + public LocationType PlacementType { get; set; } + + [JsonPropertyName("ActionPriority")] + public string? ActionPriority { get; set; } + + [JsonPropertyName("ActionStatus")] + public string? ActionStatus { get; set; } + + [JsonPropertyName("Services")] + //[JsonIgnore] + public List? Services { get; set; } + + [JsonPropertyName("MinimumRam")] + public long? MinimumRam { get; set; } + + [JsonPropertyName("MinimumNumCores")] + public int? MinimumNumCores { get; set; } + + public override Dto.Dto ToDto() + { + var domain = this; + return new ActionRunningDto() + { + Id = domain.Id.ToString(), + ActionPriority = domain.ActionPriority, + Name = domain.Name, + ActionId = domain.ActionId.ToString(), + ActionPlanId = domain.ActionPlanId.ToString(), + HardwareRequirements = new HardwareRequirements() + { + MinimumRam = domain.MinimumRam, + MinimumNumCores = domain.MinimumNumCores + }, + Tags = domain.Tags, + Placement = domain.Placement, + PlacementType = domain.PlacementType.ToString() + }; + } +} diff --git a/src/Models/Domain/HistoricalActionPlanModel.cs b/src/Models/Domain/HistoricalActionPlanModel.cs new file mode 100644 index 00000000..4135be8a --- /dev/null +++ b/src/Models/Domain/HistoricalActionPlanModel.cs @@ -0,0 +1,71 @@ +using Middleware.Models.Dto; +using System.Text.Json.Serialization; + +namespace Middleware.Models.Domain; + +public sealed class HistoricalActionPlanModel : BaseModel +{ + [JsonPropertyName("Id")] //atuomatically generated plan id by middleware + public override Guid Id { get; set; } + + [JsonPropertyName("TaskId")] //TaskID + public Guid TaskId { get; set; } + + [JsonPropertyName("Name")] // Name of task + public override string Name { get; set; } + + /// + /// Status of the whole plan + /// + [JsonPropertyName("Status")] + public string Status { get; set; } + + [JsonPropertyName("IsReplan")] //Status of whole plan + public bool IsReplan { get; set; } + + [JsonPropertyName("PreviousPlanId")] //If replan, this field must be set to the id of the previous created HistoricalActionPlan. + public Guid PreviousPlanId { get; set; } + + [JsonPropertyName("LastStatusChange")] + public DateTime LastStatusChange { get; set; } // AL 2022-05-10: Not sure we need this one or how to use it. + + [JsonPropertyName("ActionSequence")] + public List ActionSequence { get; set; } + + [JsonPropertyName("RobotId")] + public Guid RobotId { get; set; } + + [JsonPropertyName("TaskStartedAt")] + public DateTime TaskStartedAt { get; set; } + + [JsonPropertyName("CreationTime")] + public DateTime CreationTime { get; set; } + + + public void SetStatus(string status) + { + if (Status is null) + TaskStartedAt = DateTime.UtcNow; + + Status = status; + LastStatusChange = DateTime.UtcNow; + } + public override Dto.Dto ToDto() + { + var domain = this; + return new HistoricalActionPlanDto() + { + Id = domain.Id.ToString(), + TaskId = domain.TaskId.ToString(), + Name = domain.Name, + Status = domain.Status, + IsReplan = domain.IsReplan, + LastStatusChange = domain.LastStatusChange == default ? DateTimeOffset.Now : domain.LastStatusChange, + ActionSequence = domain.ActionSequence, + RobotId = domain.RobotId.ToString(), + TaskStartedAt = domain.TaskStartedAt == default ? DateTimeOffset.Now : domain.TaskStartedAt, + CreationTime = domain.CreationTime == default ? DateTimeOffset.Now : domain.TaskStartedAt, + PreviousPlanId = domain.PreviousPlanId.ToString() + }; ; + } +} \ No newline at end of file diff --git a/src/Models/Domain/InstanceRunningModel.cs b/src/Models/Domain/InstanceRunningModel.cs new file mode 100644 index 00000000..41d02122 --- /dev/null +++ b/src/Models/Domain/InstanceRunningModel.cs @@ -0,0 +1,45 @@ +using System.Text.Json.Serialization; +using Middleware.Models.Dto; + + +namespace Middleware.Models.Domain; + +public class InstanceRunningModel : BaseModel +{ + [JsonPropertyName("Id")] + public override Guid Id { get; set; } + + [JsonPropertyName("Name")] + public override string Name { get; set; } = default!; + + [JsonPropertyName("ServiceInstanceId")] + public Guid ServiceInstanceId { get; set; } + + [JsonPropertyName("ServiceType")] + + public string ServiceType { get; set; } = default!; + + [JsonPropertyName("ServiceUrl")] + public string ServiceUrl { get; set; } = default!; + + [JsonPropertyName("ServiceStatus")] + public string ServiceStatus { get; set; } = default!; //updated every 10 sec + + [JsonPropertyName("DeployedTime")] + public DateTime DeployedTime { get; set; } // Compulsory field + + public override Dto.Dto ToDto() + { + var domain = this; + return new InstanceRunningDto() + { + Id = domain.Id.ToString(), + Name = domain.Name, + ServiceType = domain.ServiceType, + ServiceInstanceId = domain.ServiceInstanceId.ToString(), + ServiceUrl = domain.ServiceUrl, + ServiceStatus = domain.ServiceStatus, + DeployedTime = domain.DeployedTime == default ? DateTimeOffset.Now : domain.DeployedTime, + }; + } +} diff --git a/src/Models/Domain/SensorModel.cs b/src/Models/Domain/SensorModel.cs index 067dab34..ee613650 100644 --- a/src/Models/Domain/SensorModel.cs +++ b/src/Models/Domain/SensorModel.cs @@ -4,11 +4,14 @@ namespace Middleware.Models.Domain { public class SensorModel { - public string Name { get; set; } - public string Type { get; set; } + public string Name { get; set; } = default!; + public string Type { get; set; } = default!; // public string SensorLocation { get; set; } - public string Description { get; set; } - public List Nodes { get; set; } //A sensor can publish multiple topics + public string? Description { get; set; } + /// + /// List of the topics published by a sensor + /// + public List Nodes { get; set; } = new(); public int Number { get; set; } diff --git a/src/Models/Domain/TaskModel.cs b/src/Models/Domain/TaskModel.cs index dc664a2d..db581b53 100644 --- a/src/Models/Domain/TaskModel.cs +++ b/src/Models/Domain/TaskModel.cs @@ -6,10 +6,10 @@ namespace Middleware.Models.Domain public class TaskModel : BaseModel { [JsonPropertyName("Id")] - public override Guid Id { get; set; } + public override Guid Id { get; set; } = Guid.NewGuid(); [JsonPropertyName("Name")] - public override string Name { get; set; } + public override string Name { get; set; } = default!; /// /// //True: Dont change actions in action sequence replan @@ -54,11 +54,11 @@ public class TaskModel : BaseModel [JsonPropertyName("ActionSequence")] //[JsonIgnore] - public List? ActionSequence { get; set; } + public List ActionSequence { get; set; } = new(); [JsonPropertyName("Tags")] //TODO: define allows tags //[JsonIgnore] - public List Tags { get; set; } + public List? Tags { get; set; } public TaskModel() diff --git a/src/Models/Dto/ActionRunningDto.cs b/src/Models/Dto/ActionRunningDto.cs new file mode 100644 index 00000000..b22e982d --- /dev/null +++ b/src/Models/Dto/ActionRunningDto.cs @@ -0,0 +1,54 @@ +using Middleware.Models.Domain; +using Middleware.Models.Dto.Hardware; +using Middleware.Models.Enums; +using Redis.OM.Modeling; + +namespace Middleware.Models.Dto; + +[Document(IndexName = "actionRunning-idx", StorageType = StorageType.Json, + Prefixes = new[] { ActionRunningDto.Prefix })] +public class ActionRunningDto : Dto +{ + public const string Prefix = "ActionRunning"; + [Indexed] + [RedisIdField] + public override string Id { get; set; } = default!; + /// + /// This is the ID in which the actionRunning is based from the normal Action + /// + [Indexed] + public string ActionId { get; init; } = default!; + [Indexed] + public string ActionPlanId { get; init; } = default!; + [Indexed] + public string Name { get; init; } = default!; + [Indexed] + public List? Tags { get; init; } = new(); + [Indexed] + public string? ActionPriority { get; init; } + [Indexed] + public string Placement { get; init; } = default!; + [Indexed] + public string PlacementType { get; init; } = default!; + public HardwareRequirements HardwareRequirements { get; init; } = new(); + + public override BaseModel ToModel() + { + var dto = this; + return new ActionRunningModel() + { + Id = Guid.Parse(dto.Id), + ActionId = Guid.Parse(dto.ActionId), + ActionPlanId = Guid.Parse(dto.ActionPlanId), + Name = dto.Name, + Tags = dto.Tags, + MinimumRam = dto.HardwareRequirements.MinimumRam, + MinimumNumCores = dto.HardwareRequirements.MinimumNumCores, + ActionPriority = dto.ActionPriority, + Placement = dto.Placement, + PlacementType = Enum.IsDefined(typeof(LocationType), PlacementType) + ? Enum.Parse(dto.PlacementType) + : LocationType.Unspecified + }; + } +} \ No newline at end of file diff --git a/src/Models/Dto/HistoricalActionPlanDto.cs b/src/Models/Dto/HistoricalActionPlanDto.cs new file mode 100644 index 00000000..f56cdf81 --- /dev/null +++ b/src/Models/Dto/HistoricalActionPlanDto.cs @@ -0,0 +1,55 @@ +using Middleware.Models.Domain; +using Redis.OM.Modeling; + +namespace Middleware.Models.Dto; + +[Document(IndexName = "historicalActionPlan-idx", StorageType = StorageType.Json, Prefixes = new[] { HistoricalActionPlanDto.Prefix })] +public class HistoricalActionPlanDto : Dto +{ + public const string Prefix = "HistoricalActionPlan"; + [Indexed] + [RedisIdField] + public override string Id { get; set; } + + [Indexed] + public string? TaskId { get; set; } + [Indexed] + public string Name { get; set; } + [Indexed] + public string? Status { get; set; } + [Indexed] + public bool IsReplan { get; set; } + [Indexed(Sortable = true)] + public DateTimeOffset LastStatusChange { get; set; } + [Indexed] + public List ActionSequence { get; set; } + [Indexed] + public string RobotId { get; set; } + [Indexed(Sortable = true)] + public DateTimeOffset TaskStartedAt { get; set; } + [Indexed(Sortable = true)] + public DateTimeOffset CreationTime { get; set; } + + + [Indexed] + public string PreviousPlanId { get; set; } + +public override BaseModel ToModel() + { + var dto = this; + return new HistoricalActionPlanModel() + { + Id = Guid.Parse(dto.Id!.Replace(Prefix, "")), + TaskId = Guid.Parse(dto.TaskId), + Name = dto.Name, + Status = dto.Status, + IsReplan = dto.IsReplan, + LastStatusChange = dto.LastStatusChange.DateTime, + ActionSequence = dto.ActionSequence, + RobotId = Guid.Parse(dto.RobotId), + TaskStartedAt = dto.TaskStartedAt.DateTime, + CreationTime = dto.CreationTime.DateTime, + PreviousPlanId = Guid.Parse(dto.PreviousPlanId) + }; + } +} \ No newline at end of file diff --git a/src/Models/Dto/InstanceRunningDto.cs b/src/Models/Dto/InstanceRunningDto.cs new file mode 100644 index 00000000..ec73ff7f --- /dev/null +++ b/src/Models/Dto/InstanceRunningDto.cs @@ -0,0 +1,46 @@ +using Middleware.Models.Domain; +using Middleware.Models.Dto.Hardware; +using Redis.OM.Modeling; +using Middleware.Models.Dto.Ros; + +namespace Middleware.Models.Dto; + +[Document(IndexName = "instanceRunning-idx", StorageType = StorageType.Json, Prefixes = new[] { InstanceRunningDto.Prefix })] +public class InstanceRunningDto : Dto +{ + public const string Prefix = "instanceRunning"; + [Indexed] + [RedisIdField] + public override string Id { get; set; } = default!; + [Indexed] + public string? Name { get; set; } = default!; + [Indexed] + public string? ServiceInstanceId { get; set; } = default!; + [Indexed] + public string ServiceType { get; set; } = default!; + [Indexed] + public string ServiceUrl { get; set; } = default!; + [Indexed] + public string ServiceStatus { get; set; } = default!; + + [Indexed(Sortable = true)] + public DateTimeOffset DeployedTime { get; set; } + + + + public override BaseModel ToModel() + { + var dto = this; + return new InstanceRunningModel() + { + Id = Guid.Parse(dto.Id.Replace(Prefix, "")), + Name = dto.Name, + ServiceType = dto.ServiceType, + ServiceUrl = dto.ServiceUrl, + ServiceInstanceId = Guid.Parse(dto.ServiceInstanceId), + ServiceStatus = dto.ServiceStatus, + DeployedTime = dto.DeployedTime.DateTime, + + }; + } +} diff --git a/src/Models/Dto/Ros/Sensor.cs b/src/Models/Dto/Ros/Sensor.cs index 97997ea8..d669cbc1 100644 --- a/src/Models/Dto/Ros/Sensor.cs +++ b/src/Models/Dto/Ros/Sensor.cs @@ -4,10 +4,10 @@ namespace Middleware.Models.Dto.Ros; public class Sensor { - public string? Name { get; set; } - public string? Type { get; set; } - public string? Description { get; set; } - public List Nodes { get; set; } = new(); + public string Name { get; init; } = default!; + public string Type { get; init; } = default!; + public string? Description { get; init; } + public List Nodes { get; init; } = new(); public int Number { get; set; } diff --git a/src/Models/Dto/TaskDto.cs b/src/Models/Dto/TaskDto.cs index 37a4a9eb..9535577a 100644 --- a/src/Models/Dto/TaskDto.cs +++ b/src/Models/Dto/TaskDto.cs @@ -6,34 +6,32 @@ namespace Middleware.Models.Dto; [Document(IndexName = "task-idx", StorageType = StorageType.Json, Prefixes = new[] { TaskDto.Prefix })] public class TaskDto : Dto { - public const string Prefix = "Task"; + private const string Prefix = "Task"; [Indexed] [RedisIdField] - public override string Id { get; set; } + public override string Id { get; set; } = default!; [Indexed] - public string? Name { get; set; } - - + public string Name { get; init; } = default!; + [Indexed(Sortable = true)] - public int TaskPriority { get; set; } - - + public int TaskPriority { get; init; } + + /// + /// Is the result of the task always the same + /// [Indexed(Sortable = true)] - public bool DeterministicTask { get; set; } // The result is always the same if true. - - /*[Indexed] - public List ActionSequence { get; set; }*/ + public bool DeterministicTask { get; init; } + [Indexed] - public List Tags { get; set; } - + public List? Tags { get; init; } public override BaseModel ToModel() { var dto = this; return new TaskModel() { - Id = Guid.Parse(dto.Id!.Replace(Prefix, "")), + Id = Guid.Parse(dto.Id), Name = dto.Name, TaskPriority = dto.TaskPriority, DeterministicTask = dto.DeterministicTask, diff --git a/src/Models/Enums/LocationType.cs b/src/Models/Enums/LocationType.cs new file mode 100644 index 00000000..0ce012ef --- /dev/null +++ b/src/Models/Enums/LocationType.cs @@ -0,0 +1,8 @@ +namespace Middleware.Models.Enums; + +public enum LocationType +{ + Unspecified = 0, + Edge = 1, + Cloud =2 +} \ No newline at end of file diff --git a/src/Orchestrator/Deployment/DeploymentService.cs b/src/Orchestrator/Deployment/DeploymentService.cs index 4ec3bf3f..9cf3320d 100644 --- a/src/Orchestrator/Deployment/DeploymentService.cs +++ b/src/Orchestrator/Deployment/DeploymentService.cs @@ -7,6 +7,7 @@ using Middleware.Common.ExtensionMethods; using Middleware.Common.Responses; using Middleware.Models.Domain; +using Middleware.Models.Enums; using Middleware.Orchestrator.Exceptions; using Middleware.Orchestrator.Models; using Middleware.RedisInterface.Contracts.Mappings; @@ -123,18 +124,76 @@ public async Task DeployAsync(TaskModel task, Guid robotId) } /// - /// Saves the specified task to the redis as an action plan + /// Saves the specified task to the redis as an action plan and add the actionRunnings and InstanceRunning + /// with their corresponding relationships. /// /// /// /// private async Task SaveActionSequence(TaskModel task, Guid robotId) { + //List actionsRunning = new List(); var actionPlan = new ActionPlanModel(task.ActionPlanId, task.Id, task.Name, task.ActionSequence!, robotId); actionPlan.SetStatus("active"); + var robotResponse = await _redisInterfaceClient.RobotGetByIdAsync(robotId); + var robot = robotResponse.ToRobot(); + + //Add the actionPlan to redis var result = await _redisInterfaceClient.ActionPlanAddAsync(actionPlan); + await _redisInterfaceClient.AddRelationAsync(robot, actionPlan, "OWNS"); + + //Add the actionRunning to redis + foreach (ActionModel action in task.ActionSequence) + { + ActionRunningModel actionRunningTemp = new ActionRunningModel(); + actionRunningTemp.ActionPlanId = actionPlan.Id; + actionRunningTemp.ActionId = action.Id; + actionRunningTemp.Name = action.Name; + actionRunningTemp.Tags = action.Tags; + actionRunningTemp.Order = action.Order; + actionRunningTemp.Placement = + action.Placement!.Replace("-Edge", "").Replace("-Cloud", ""); // Trim to proper edge or cloud + actionRunningTemp.PlacementType = action.PlacementType!.Value; + actionRunningTemp.ActionPriority = action.ActionPriority; + actionRunningTemp.ActionStatus = ActionStatusEnum.Running.ToString(); + actionRunningTemp.Services = action.Services!.Select(x => new InstanceRunningModel() + { + Name = x.Name, + ServiceInstanceId = x.ServiceInstanceId, + ServiceType = x.ServiceType, + ServiceUrl = x.ServiceUrl, + ServiceStatus = x.ServiceStatus, + DeployedTime = DateTime.Now + }).ToList(); + actionRunningTemp.MinimumRam = action.MinimumRam; + actionRunningTemp.MinimumNumCores = action.MinimumNumCores; + //actionsRunning.Add(ActionRunningTemp); //Add the runningAction to the actionPlang + await _redisInterfaceClient.ActionRunningAddAsync(actionRunningTemp); + await _redisInterfaceClient.AddRelationAsync(actionPlan, actionRunningTemp, "CONSISTS_OF"); + + + //Add the InstanceRunning to redis + foreach (InstanceRunningModel runningInstance in actionRunningTemp.Services) + { + await _redisInterfaceClient.InstanceRunningAddAsync(runningInstance); + await _redisInterfaceClient.AddRelationAsync(actionRunningTemp, runningInstance, "CONSISTS_OF"); + + if (action.PlacementType == LocationType.Cloud) + { + CloudModel cloud = (await _redisInterfaceClient.GetCloudByNameAsync(action.Placement)).ToCloud(); + await _redisInterfaceClient.AddRelationAsync(runningInstance, cloud, "LOCATED_AT"); + } + + if (action.PlacementType == LocationType.Edge) + { + EdgeModel edge = (await _redisInterfaceClient.GetEdgeByNameAsync(action.Placement)).ToEdge(); + await _redisInterfaceClient.AddRelationAsync(runningInstance, edge, "LOCATED_AT"); + } + } + } + return result; } @@ -292,6 +351,79 @@ public V1Service CreateService(string serviceImageName, K8SServiceKindEnum kind, /// public async Task DeletePlanAsync(ActionPlanModel actionPlan) { + // Delete OWNS relationship between robot and actionPlan + var robotResponse = await _redisInterfaceClient.RobotGetByIdAsync(actionPlan.RobotId); + var robot = robotResponse.ToRobot(); + + await _redisInterfaceClient.DeleteRelationAsync(robot, actionPlan, "OWNS"); + + // Create historical action plan + HistoricalActionPlanModel historicalActionPlan = new HistoricalActionPlanModel(); + historicalActionPlan.IsReplan = actionPlan.IsReplan; + historicalActionPlan.Name = actionPlan.Name; + historicalActionPlan.RobotId = actionPlan.RobotId; + historicalActionPlan.TaskId = actionPlan.TaskId; + historicalActionPlan.Status = ActionStatusEnum.Finished.ToString(); + historicalActionPlan.TaskStartedAt = actionPlan.TaskStartedAt; + + var images = await _redisInterfaceClient.GetRelationAsync(actionPlan, "CONSISTS_OF"); + foreach (RelationModel relation in images) + { + ActionRunningModel runningAction = + await _redisInterfaceClient.ActionRunningGetByIdAsync(relation.PointsTo.Id); + var runningIntancesImages = await _redisInterfaceClient.GetRelationAsync(runningAction, "CONSISTS_OF"); + foreach (RelationModel instanceRelation in runningIntancesImages) + { + InstanceRunningModel runningInstance = + await _redisInterfaceClient.InstanceRunningGetByIdAsync(instanceRelation.PointsTo.Id); + runningAction.Services.Add(runningInstance); + } + + historicalActionPlan.ActionSequence.Add(runningAction); + } + /* + + foreach (RelationModel relation in images) + { + InstanceModel instance = await _redisInterfaceClient.InstanceGetByIdAsync(relation.PointsTo.Id); + + if (CanBeReused(instance) && taskModel.ResourceLock) + { + var reusedInstance = await GetInstanceToReuse(instance, orchestratorApiClient); + if (reusedInstance is not null) + instance = reusedInstance; + } + // add instance to actions + action.Services.Add(instance); + } + + historicalActionPlan.ActionSequence = actionPlan.ActionSequence.Select(x => new ActionRunningModel() + { + Name = x.Name, + ActionId = x.Id, + ActionPlanId = actionPlan.Id, + Tags = x.Tags, + Order = x.Order, + Placement = x.Placement, + PlacementType = x.PlacementType, + ActionPriority = x.ActionPriority, + ActionStatus = x.ActionStatus, + Services = x.Services.Select(y => new InstanceRunningModel() + { + Name = y.Name, + ServiceInstanceId = y.ServiceInstanceId, + ServiceType = y.ServiceType, + ServiceUrl = y.ServiceUrl, + ServiceStatus = y.ServiceStatus, + + }).ToList() + + }).ToList(); + */ + + // Publish to redis the historical action plan + await _redisInterfaceClient.HistoricalActionPlanAddAsync(historicalActionPlan); + bool retVal = true; try { @@ -319,6 +451,7 @@ public async Task DeletePlanAsync(ActionPlanModel actionPlan) retVal = false; } + //Delete actionPlan return retVal; } @@ -370,25 +503,25 @@ public async Task DeployActionAsync(Guid actionPlanId, Guid actionId) var deployments = await kubeClient.AppsV1.ListNamespacedDeploymentAsync(AppConfig.K8SNamespaceName); var deploymentNames = deployments.Items.Select(d => d.Metadata.Name).OrderBy(d => d).ToArray(); - + _logger.LogDebug("Retrieving location details (cloud or edge)"); BaseModel thisLocation = _mwConfig.Value.InstanceType == LocationType.Cloud.ToString() ? (await _redisInterfaceClient.GetCloudByNameAsync(_mwConfig.Value.InstanceName)).ToCloud() : (await _redisInterfaceClient.GetEdgeByNameAsync(_mwConfig.Value.InstanceName)).ToEdge(); - + foreach (var instance in action.Services!) { _logger.LogDebug("Deploying instance '{0}', with serviceInstanceId '{1}'", instance.Name, instance.ServiceInstanceId); await DeployService(kubeClient, instance, deploymentNames); - + _logger.LogDebug("Adding new relation between instance and current location"); await _redisInterfaceClient.AddRelationAsync(instance, thisLocation, "LOCATED_AT"); } - + action.Placement = _mwConfig.Value.InstanceName; - action.PlacementType = _mwConfig.Value.InstanceType; - + action.PlacementType = Enum.Parse(_mwConfig.Value.InstanceType); + _logger.LogDebug("Saving updated ActionPlan"); await _redisInterfaceClient.ActionPlanAddAsync(actionPlan); } @@ -428,13 +561,12 @@ private async Task DeleteInstance(IKubernetes kubeClient, Guid instanceId) // ignored } } - + // TODO: add the removing of the relationships and the bubbles. return retVal; } /// - /// public V1Deployment CreateStartupDeployment(string name, string tag) { var mwConfig = _configuration.GetSection(MiddlewareConfig.ConfigName).Get(); diff --git a/src/Orchestrator/Jobs/UpdateStatusJob.cs b/src/Orchestrator/Jobs/UpdateStatusJob.cs index aeb21814..3fa2f074 100644 --- a/src/Orchestrator/Jobs/UpdateStatusJob.cs +++ b/src/Orchestrator/Jobs/UpdateStatusJob.cs @@ -6,6 +6,7 @@ using Middleware.Common.Enums; using Middleware.Common.ExtensionMethods; using Middleware.Models.Domain; +using Middleware.Models.Enums; using Middleware.Orchestrator.Deployment; using Middleware.RedisInterface.Sdk; using Quartz; @@ -87,7 +88,7 @@ protected override async Task ExecuteJobAsync(IJobExecutionContext context) //check if all instances are down for at least half an hour, then terminate foreach (var action in seq.ActionSequence) { - if (action.Placement != _middlewareConfig.InstanceName || action.PlacementType != _middlewareConfig.InstanceType) + if (action.Placement != _middlewareConfig.InstanceName || action.PlacementType != Enum.Parse(_middlewareConfig.InstanceType)) continue; foreach (var instance in action.Services) diff --git a/src/RedisInterface.Contracts/Mappings/ApiContractToDomainMapper.cs b/src/RedisInterface.Contracts/Mappings/ApiContractToDomainMapper.cs index a2ef868c..bb2ac58f 100644 --- a/src/RedisInterface.Contracts/Mappings/ApiContractToDomainMapper.cs +++ b/src/RedisInterface.Contracts/Mappings/ApiContractToDomainMapper.cs @@ -346,4 +346,19 @@ public static TaskModel ToTask(this TaskResponse x) Tags = x.Tags?.ToList() }; } + + // public static ActionPlanModel ToActionPlan(this ActionPlanRequest x) + // { + // return new ActionPlanModel() + // { + // Id = x.Id, + // Name = x.Name, + // RobotId = x.RobotId, + // TaskId = x.TaskId, + // IsReplan = x.IsReplan, + // TaskStartedAt = x.TaskStartedAt, + // Status = x.Status, + // ActionSequence = x.ActionSequence.t + // } + // } } \ No newline at end of file diff --git a/src/RedisInterface.Contracts/Mappings/DomainToApiContractMapper.cs b/src/RedisInterface.Contracts/Mappings/DomainToApiContractMapper.cs index 1cc1dff5..96e31995 100644 --- a/src/RedisInterface.Contracts/Mappings/DomainToApiContractMapper.cs +++ b/src/RedisInterface.Contracts/Mappings/DomainToApiContractMapper.cs @@ -121,6 +121,7 @@ public static InstanceResponse ToInstanceResponse(this InstanceModel x) OnboardedTime = x.OnboardedTime }; } + public static GetInstancesResponse ToInstancesResponse(this IEnumerable instances) { return new GetInstancesResponse() @@ -185,6 +186,7 @@ public static RobotResponse ToRobotResponse(this RobotModel x) OnboardedTime = x.OnboardedTime }; } + public static GetRobotsResponse ToRobotsResponse(this IEnumerable robots) { return new GetRobotsResponse() @@ -212,4 +214,110 @@ public static GetTasksResponse ToTasksResponse(this IEnumerable tasks Tasks = tasks.Select(x => x.ToTaskResponse()) }; } + + public static IEnumerable ToInstanceRunningList( + this IEnumerable instances) + { + return instances.Select(x => new InstanceRunningResponse() + { + Id = x.Id, + ServiceInstanceId = x.ServiceInstanceId, + Name = x.Name, + ServiceType = x.ServiceType, + ServiceStatus = x.ServiceStatus, + ServiceUrl = x.ServiceUrl, + DeployedTime = x.DeployedTime + }); + } + + public static IEnumerable ToRunningActionResponseList( + this IEnumerable actions) + { + return actions.Select(x => new RunningActionResponse() + { + Id = x.Id, + ActionId = x.ActionId, + ActionPlanId = x.ActionPlanId, + Name = x.Name, + ActionPriority = x.ActionPriority, + ActionStatus = x.ActionStatus, + Placement = x.Placement, + PlacementType = x.PlacementType.ToString(), + Order = x.Order, + Services = x.Services.ToInstanceRunningList(), + Tags = x.Tags + }); + } + + public static RunningActionResponse ToRunningActionResponse(this ActionRunningModel x) + { + return new RunningActionResponse() + { + Id = x.Id, + ActionId = x.ActionId, + ActionPlanId = x.ActionPlanId, + Name = x.Name, + ActionPriority = x.ActionPriority, + ActionStatus = x.ActionStatus, + Placement = x.Placement, + PlacementType = x.PlacementType.ToString(), + Order = x.Order, + Services = x.Services?.ToInstanceRunningList() ?? new List(), + Tags = x.Tags + }; + } + + public static GetRunningActionsResponse ToRunningActionsResponse(this IEnumerable actions) + { + return new GetRunningActionsResponse() + { + RunningActions = actions.Select(x => new RunningActionResponse() + { + Id = x.Id, + ActionId = x.ActionId, + ActionPlanId = x.ActionPlanId, + Name = x.Name, + ActionPriority = x.ActionPriority, + ActionStatus = x.ActionStatus, + Placement = x.Placement, + PlacementType = x.PlacementType.ToString(), + Order = x.Order, + Services = x.Services?.ToInstanceRunningList() ?? new List(), + Tags = x.Tags + }) + }; + } + + public static GetActionPlansResponse ToActionPlansResponse(this IEnumerable plans) + { + return new GetActionPlansResponse() + { + ActionPlans = plans.Select(x => new ActionPlanResponse() + { + Id = x.Id, + Name = x.Name, + RobotId = x.RobotId, + TaskId = x.TaskId, + Status = x.Status, + IsReplan = x.IsReplan, + TaskStartedAt = x.TaskStartedAt, + ActionSequence = x.ActionSequence.Select(a => a.ToActionRunningModel(x.Id)) + .ToRunningActionResponseList() + }) + }; + } + public static ActionPlanResponse ToActionPlanResponse(this ActionPlanModel x) + { + return new ActionPlanResponse() + { + Id = x.Id, + Name = x.Name, + RobotId = x.RobotId, + TaskId = x.TaskId, + Status = x.Status, + IsReplan = x.IsReplan, + TaskStartedAt = x.TaskStartedAt, + ActionSequence = x.ActionSequence.Select(a => a.ToActionRunningModel(x.Id)).ToRunningActionResponseList() + }; + } } \ No newline at end of file diff --git a/src/RedisInterface.Contracts/Requests/ActionPlanRequest.cs b/src/RedisInterface.Contracts/Requests/ActionPlanRequest.cs new file mode 100644 index 00000000..87d2634e --- /dev/null +++ b/src/RedisInterface.Contracts/Requests/ActionPlanRequest.cs @@ -0,0 +1,20 @@ +namespace Middleware.RedisInterface.Contracts.Requests; + +public class ActionPlanRequest +{ + public Guid Id { get; set; } + + public Guid TaskId { get; set; } + + public string Name { get; set; } = default!; + + public string Status { get; set; } + + public bool IsReplan { get; set; } + + public IEnumerable ActionSequence { get; set; } = Enumerable.Empty(); + + public Guid RobotId { get; set; } + + public DateTime TaskStartedAt { get; set; } +} \ No newline at end of file diff --git a/src/RedisInterface.Contracts/Requests/InstanceRunningRequest.cs b/src/RedisInterface.Contracts/Requests/InstanceRunningRequest.cs new file mode 100644 index 00000000..fe092d97 --- /dev/null +++ b/src/RedisInterface.Contracts/Requests/InstanceRunningRequest.cs @@ -0,0 +1,18 @@ +namespace Middleware.RedisInterface.Contracts.Requests; + +public class InstanceRunningRequest +{ + public Guid Id { get; set; } + + public string Name { get; set; } + + public Guid ServiceInstanceId { get; set; } + + public string ServiceType { get; set; } + + public string ServiceUrl { get; set; } + + public string ServiceStatus { get; set; } + + public DateTime DeployedTime { get; set; } +} \ No newline at end of file diff --git a/src/RedisInterface.Contracts/Requests/RunningActionRequest.cs b/src/RedisInterface.Contracts/Requests/RunningActionRequest.cs new file mode 100644 index 00000000..0ec239e7 --- /dev/null +++ b/src/RedisInterface.Contracts/Requests/RunningActionRequest.cs @@ -0,0 +1,26 @@ +namespace Middleware.RedisInterface.Contracts.Requests; + +public class RunningActionRequest +{ + public Guid Id { get; set; } + + public Guid ActionId { get; set; } + + public Guid ActionPlanId { get; set; } + + public string Name { get; set; } = default!; + + public List? Tags { get; set; } + + public int Order { get; set; } + + public string Placement { get; set; } = default!; + + public string PlacementType { get; set; } + + public string ActionPriority { get; set; } + + public string ActionStatus { get; set; } + + public IEnumerable Services { get; set; } +} \ No newline at end of file diff --git a/src/RedisInterface.Contracts/Responses/ActionPlanResponse.cs b/src/RedisInterface.Contracts/Responses/ActionPlanResponse.cs new file mode 100644 index 00000000..1b167840 --- /dev/null +++ b/src/RedisInterface.Contracts/Responses/ActionPlanResponse.cs @@ -0,0 +1,20 @@ +namespace Middleware.RedisInterface.Contracts.Responses; + +public class ActionPlanResponse +{ + public Guid Id { get; set; } + + public Guid TaskId { get; set; } + + public string Name { get; set; } = default!; + + public string Status { get; set; } + + public bool IsReplan { get; set; } + + public IEnumerable ActionSequence { get; set; } = Enumerable.Empty(); + + public Guid RobotId { get; set; } + + public DateTime TaskStartedAt { get; set; } +} \ No newline at end of file diff --git a/src/RedisInterface.Contracts/Responses/GetActionPlansResponse.cs b/src/RedisInterface.Contracts/Responses/GetActionPlansResponse.cs new file mode 100644 index 00000000..04c5ad2d --- /dev/null +++ b/src/RedisInterface.Contracts/Responses/GetActionPlansResponse.cs @@ -0,0 +1,6 @@ +namespace Middleware.RedisInterface.Contracts.Responses; + +public class GetActionPlansResponse +{ + public IEnumerable ActionPlans { get; set; } = Enumerable.Empty(); +} \ No newline at end of file diff --git a/src/RedisInterface.Contracts/Responses/GetRunningActionsResponse.cs b/src/RedisInterface.Contracts/Responses/GetRunningActionsResponse.cs new file mode 100644 index 00000000..4df92bdb --- /dev/null +++ b/src/RedisInterface.Contracts/Responses/GetRunningActionsResponse.cs @@ -0,0 +1,6 @@ +namespace Middleware.RedisInterface.Contracts.Responses; + +public class GetRunningActionsResponse +{ + public IEnumerable RunningActions { get; set; } = Enumerable.Empty(); +} \ No newline at end of file diff --git a/src/RedisInterface.Contracts/Responses/InstanceRunningResponse.cs b/src/RedisInterface.Contracts/Responses/InstanceRunningResponse.cs new file mode 100644 index 00000000..bde1d757 --- /dev/null +++ b/src/RedisInterface.Contracts/Responses/InstanceRunningResponse.cs @@ -0,0 +1,18 @@ +namespace Middleware.RedisInterface.Contracts.Responses; + +public class InstanceRunningResponse +{ + public Guid Id { get; set; } + + public string Name { get; set; } + + public Guid ServiceInstanceId { get; set; } + + public string ServiceType { get; set; } + + public string ServiceUrl { get; set; } + + public string ServiceStatus { get; set; } + + public DateTime DeployedTime { get; set; } +} \ No newline at end of file diff --git a/src/RedisInterface.Contracts/Responses/RunningActionResponse.cs b/src/RedisInterface.Contracts/Responses/RunningActionResponse.cs new file mode 100644 index 00000000..78ed099c --- /dev/null +++ b/src/RedisInterface.Contracts/Responses/RunningActionResponse.cs @@ -0,0 +1,28 @@ +namespace Middleware.RedisInterface.Contracts.Responses; + +public class RunningActionResponse +{ + + public Guid Id { get; set; } + + public Guid ActionId { get; set; } + + public Guid ActionPlanId { get; set; } + + public string Name { get; set; } = default!; + + public List? Tags { get; set; } + + public int Order { get; set; } + + public string Placement { get; set; } = default!; + + public string PlacementType { get; set; } + + public string ActionPriority { get; set; } + + public string ActionStatus { get; set; } + + public IEnumerable Services { get; set; } + +} \ No newline at end of file diff --git a/src/RedisInterface.Sdk/IRedisInterfaceClient.cs b/src/RedisInterface.Sdk/IRedisInterfaceClient.cs index 8299ce2c..6b50e0e6 100644 --- a/src/RedisInterface.Sdk/IRedisInterfaceClient.cs +++ b/src/RedisInterface.Sdk/IRedisInterfaceClient.cs @@ -112,6 +112,19 @@ Task DeleteRelationAsync(TSource source, TDirection d /// Task ContainerImageGetForInstanceAsync(Guid id); + Task ActionRunningAddAsync(ActionRunningModel actionRunning); + + Task InstanceRunningAddAsync(InstanceRunningModel instanceRunning); + + + Task HistoricalActionPlanAddAsync(HistoricalActionPlanModel historicalActionPlan); + + + Task ActionRunningGetByIdAsync(Guid id); + + + Task InstanceRunningGetByIdAsync(Guid id); + /// /// Get Active Global policies in the Middleware /// diff --git a/src/RedisInterface.Sdk/RedisInterfaceClient.cs b/src/RedisInterface.Sdk/RedisInterfaceClient.cs index 5166c5ff..a9c8ad84 100644 --- a/src/RedisInterface.Sdk/RedisInterfaceClient.cs +++ b/src/RedisInterface.Sdk/RedisInterfaceClient.cs @@ -236,6 +236,56 @@ public async Task ActionPlanDeleteAsync(Guid id, CancellationToken token) return await ContainerImageGetForInstanceAsync(id, CancellationToken.None); } + public async Task ActionRunningAddAsync(ActionRunningModel actionRunning) + { + throw new NotImplementedException(); + } + + public async Task ActionRunningAddAsync(ActionRunningModel actionRunning, CancellationToken token) + { + throw new NotImplementedException(); + } + + public async Task InstanceRunningAddAsync(InstanceRunningModel instanceRunning) + { + throw new NotImplementedException(); + } + + public async Task InstanceRunningAddAsync(InstanceRunningModel instanceRunning, CancellationToken token) + { + throw new NotImplementedException(); + } + + public async Task HistoricalActionPlanAddAsync(HistoricalActionPlanModel historicalActionPlan) + { + throw new NotImplementedException(); + } + + public async Task HistoricalActionPlanAddAsync(HistoricalActionPlanModel historicalActionPlan, CancellationToken token) + { + throw new NotImplementedException(); + } + + public async Task ActionRunningGetByIdAsync(Guid id) + { + throw new NotImplementedException(); + } + + public async Task ActionRunningGetByIdAsync(Guid id, CancellationToken token) + { + throw new NotImplementedException(); + } + + public async Task InstanceRunningGetByIdAsync(Guid id) + { + throw new NotImplementedException(); + } + + public async Task InstanceRunningGetByIdAsync(Guid id, CancellationToken token) + { + throw new NotImplementedException(); + } + public async Task PolicyGetActiveAsync() { var result = await _api.PolicyGetActive(); diff --git a/src/RedisInterface/Controllers/ActionController.cs b/src/RedisInterface/Controllers/ActionController.cs index 5f693cd2..11e1b9b2 100644 --- a/src/RedisInterface/Controllers/ActionController.cs +++ b/src/RedisInterface/Controllers/ActionController.cs @@ -21,18 +21,25 @@ public class ActionController : ControllerBase private readonly IActionPlanRepository _actionPlanRepository; private readonly ILogger _logger; private readonly IActionService _actionService; + private readonly IHistoricalActionPlanRepository _historicalActionPlanRepository; + private readonly IActionRunningRepository _actionRunningRepository; - public ActionController(IActionRepository actionRepository, - IActionPlanRepository actionPlanRepository, - ILogger logger, - IActionService actionService) + public ActionController(IActionRepository actionRepository, IActionPlanRepository actionPlanRepository, + ILogger logger, IActionService actionService, + IHistoricalActionPlanRepository historicalActionPlanRepository, + IActionRunningRepository actionRunningRepository) { _actionRepository = actionRepository ?? throw new ArgumentNullException(nameof(actionRepository)); _actionPlanRepository = actionPlanRepository ?? throw new ArgumentNullException(nameof(actionPlanRepository)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _actionService = actionService; + _historicalActionPlanRepository = historicalActionPlanRepository; + _actionRunningRepository = actionRunningRepository; } + + #region Action + /// /// Get all the actions /// @@ -46,10 +53,11 @@ public async Task GetAllAsync() try { List models = await _actionRepository.GetAllAsync(); - if (models.Any() == false) + if (models != null && models.Any() == false) { return NotFound(new ApiResponse((int)HttpStatusCode.NotFound, "No actions were found.")); } + return Ok(models.ToActionsResponse()); } catch (Exception ex) @@ -59,7 +67,7 @@ public async Task GetAllAsync() return StatusCode(statusCode, new ApiResponse(statusCode, $"An error has occurred: {ex.Message}")); } } - + /// /// Get an action entity by id /// @@ -77,8 +85,10 @@ public async Task GetByIdAsync(Guid id) ActionModel model = await _actionService.GetByIdAsync(id); if (model == null) { - return NotFound(new ApiResponse((int)HttpStatusCode.NotFound, $"Action with id: '{id}' was not found.")); + return NotFound(new ApiResponse((int)HttpStatusCode.NotFound, + $"Action with id: '{id}' was not found.")); } + return Ok(model.ToActionResponse()); } catch (Exception ex) @@ -102,7 +112,7 @@ public async Task AddAsync([FromBody] ActionRequest request) { try { - var action = await _actionService.AddAsync(request.ToAction()); + var action = await _actionService.AddAsync(request.ToAction()); return Ok(action.ToActionResponse()); } catch (Exception ex) @@ -134,7 +144,7 @@ public async Task UpdateActionAsync([FromMultiSource] UpdateActio var action = request.ToAction(); await _actionService.UpdateAsync(action); - + var response = action.ToActionResponse(); return Ok(response); } @@ -163,8 +173,10 @@ public async Task DeleteByIdAsync(Guid id) var exists = await _actionService.GetByIdAsync(id); if (exists is null) { - return NotFound(new ApiResponse((int)HttpStatusCode.NotFound, "The specified Action has not been found.")); + return NotFound(new ApiResponse((int)HttpStatusCode.NotFound, + "The specified Action has not been found.")); } + await _actionService.DeleteAsync(id); return Ok(); } @@ -192,12 +204,14 @@ public async Task> AddRelationAsync([FromBody] Relat { return BadRequest("Parameters were not specified."); } + try { bool isValid = await _actionRepository.AddRelationAsync(model); if (!isValid) { - return StatusCode((int)HttpStatusCode.InternalServerError, new ApiResponse((int)HttpStatusCode.InternalServerError, "The relation was not created")); + return StatusCode((int)HttpStatusCode.InternalServerError, + new ApiResponse((int)HttpStatusCode.InternalServerError, "The relation was not created")); } } catch (Exception ex) @@ -206,6 +220,7 @@ public async Task> AddRelationAsync([FromBody] Relat _logger.LogError(ex, "An error occurred:"); return StatusCode(statusCode, new ApiResponse(statusCode, $"An error has occurred: {ex.Message}")); } + return Ok(model); } @@ -224,13 +239,14 @@ public async Task GetRelationAsync(Guid id, string name) //Guid o { if (string.IsNullOrWhiteSpace(name)) { - return BadRequest(new ApiResponse((int) HttpStatusCode.BadRequest, "Relation name not specified")); + return BadRequest(new ApiResponse((int)HttpStatusCode.BadRequest, "Relation name not specified")); } if (id == Guid.Empty) { return BadRequest(new ApiResponse((int)HttpStatusCode.BadRequest, "Relation name not specified")); } + try { var relations = await _actionRepository.GetRelation(id, name); @@ -238,6 +254,7 @@ public async Task GetRelationAsync(Guid id, string name) //Guid o { return NotFound(new ApiResponse((int)HttpStatusCode.NotFound, "Relations were not found.")); } + return Ok(relations); } catch (Exception ex) @@ -270,6 +287,7 @@ public async Task GetRelationsAsync(Guid id, string firstName, st { return NotFound(new ApiResponse((int)HttpStatusCode.NotFound, "Relations were not found")); } + return Ok(relations); } catch (Exception ex) @@ -280,6 +298,9 @@ public async Task GetRelationsAsync(Guid id, string firstName, st } } + #endregion + + #region ActionPlan /// @@ -288,7 +309,7 @@ public async Task GetRelationsAsync(Guid id, string firstName, st /// [HttpGet] [Route("plan", Name = "ActionPlanGetAll")] - [ProducesResponseType(typeof(List), (int)HttpStatusCode.OK)] + [ProducesResponseType(typeof(GetActionPlansResponse), (int)HttpStatusCode.OK)] [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.NotFound)] [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.InternalServerError)] public async Task GetAllActionPlansAsync() @@ -300,7 +321,8 @@ public async Task GetAllActionPlansAsync() { return NotFound(new ApiResponse((int)HttpStatusCode.NotFound, "No plans have been found.")); } - return Ok(plans); + + return Ok(plans.ToActionPlansResponse()); } catch (Exception ex) { @@ -317,7 +339,7 @@ public async Task GetAllActionPlansAsync() /// [HttpGet] [Route("plan/{id:guid}", Name = "ActionPlanGetById")] - [ProducesResponseType(typeof(ActionPlanModel), (int)HttpStatusCode.OK)] + [ProducesResponseType(typeof(ActionPlanResponse), (int)HttpStatusCode.OK)] [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.NotFound)] [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.InternalServerError)] public async Task GetActionPlanByIdAsync(Guid id) @@ -329,7 +351,8 @@ public async Task GetActionPlanByIdAsync(Guid id) { return NotFound(new ApiResponse((int)HttpStatusCode.NotFound, "Specified plan was not found.")); } - return Ok(plan); + + return Ok(plan.ToActionPlanResponse()); } catch (Exception ex) { @@ -346,7 +369,7 @@ public async Task GetActionPlanByIdAsync(Guid id) /// [HttpPost] [Route("plan", Name = "ActionPlanAdd")] - [ProducesResponseType(typeof(ActionPlanModel), (int)HttpStatusCode.OK)] + [ProducesResponseType(typeof(ActionPlanResponse), (int)HttpStatusCode.OK)] [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.BadRequest)] [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.InternalServerError)] public async Task AddActionPlanAsync(ActionPlanModel actionPlan) @@ -357,12 +380,10 @@ public async Task AddActionPlanAsync(ActionPlanModel actionPlan) { return BadRequest(new ApiResponse((int)HttpStatusCode.BadRequest, "Plan cannot be null")); } + var plan = await _actionPlanRepository.AddAsync(actionPlan, () => actionPlan.Id); - if (plan == null) - { - return BadRequest(new ApiResponse((int)HttpStatusCode.BadRequest, "The specified plan has not been added.")); - } - return Ok(plan); + + return Ok(plan.ToActionPlanResponse()); } catch (Exception ex) { @@ -389,13 +410,15 @@ public async Task DeleteActionPlanAsync(Guid id) var deleted = await _actionPlanRepository.DeleteByIdAsync(id); if (deleted == false) { - return NotFound(new ApiResponse((int)HttpStatusCode.NotFound, "The specified plan has not been found.")); + return NotFound(new ApiResponse((int)HttpStatusCode.NotFound, + "The specified plan has not been found.")); } + return Ok(); } catch (Exception ex) { - int statusCode = (int)HttpStatusCode.InternalServerError; + var statusCode = (int)HttpStatusCode.InternalServerError; _logger.LogError(ex, "An error occurred:"); return StatusCode(statusCode, new ApiResponse(statusCode, $"An error has occurred: {ex.Message}")); } @@ -409,7 +432,7 @@ public async Task DeleteActionPlanAsync(Guid id) /// [HttpPut] [Route("plan/{id:guid}", Name = "ActionPlanPatch")] - [ProducesResponseType(typeof(void), (int)HttpStatusCode.OK)] + [ProducesResponseType(typeof(ActionPlanResponse), (int)HttpStatusCode.OK)] [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.NotFound)] [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.BadRequest)] [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.InternalServerError)] @@ -419,16 +442,19 @@ public async Task PatchActionPlanAsync(Guid id, [FromBody] Action { if (actionPlan == null || id == Guid.Empty) { - return BadRequest(new ApiResponse((int)HttpStatusCode.BadRequest, "Id or updated object has not been specified")); + return BadRequest(new ApiResponse((int)HttpStatusCode.BadRequest, + "Id or updated object has not been specified")); } + var deleted = await _actionPlanRepository.DeleteByIdAsync(id); if (deleted == false) { - return NotFound(new ApiResponse((int)HttpStatusCode.NotFound, "The specified plan has not been found.")); + return NotFound(new ApiResponse((int)HttpStatusCode.NotFound, + "The specified plan has not been found.")); } var updatedPlan = await _actionPlanRepository.AddAsync(actionPlan, () => id); - return Ok(updatedPlan); + return Ok(updatedPlan.ToActionPlanResponse()); } catch (Exception ex) { @@ -437,13 +463,13 @@ public async Task PatchActionPlanAsync(Guid id, [FromBody] Action return StatusCode(statusCode, new ApiResponse(statusCode, $"An error has occurred: {ex.Message}")); } } + /// /// Get action plan given robot Id. /// - /// List [HttpGet] [Route("plan/robot/{robotId}", Name = "GetActionPlanByRobotIdAsync")] - [ProducesResponseType(typeof(List), (int)HttpStatusCode.OK)] + [ProducesResponseType(typeof(GetActionPlansResponse), (int)HttpStatusCode.OK)] [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.NotFound)] [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.InternalServerError)] public async Task GetActionPlanByRobotIdAsync(Guid robotId) @@ -454,14 +480,16 @@ public async Task GetActionPlanByRobotIdAsync(Guid robotId) { return BadRequest(new ApiResponse((int)HttpStatusCode.BadRequest, "Robot id has not been specified")); } + // Get list of actionPlans from specific robotId. List actionPlans = await _actionPlanRepository.GetRobotActionPlans(robotId); if (actionPlans == null) { return NotFound(new ApiResponse((int)HttpStatusCode.NotFound, "Object was not found.")); } + //List activePoliciesRecords = actionPlans.Select(p => new ActionPlanModel(p.Id, p.Name, p.Description)).ToList(); - return Ok(actionPlans); + return Ok(actionPlans.ToActionPlansResponse()); } catch (Exception ex) { @@ -470,15 +498,14 @@ public async Task GetActionPlanByRobotIdAsync(Guid robotId) return StatusCode(statusCode, new ApiResponse(statusCode, $"An error has occurred: {ex.Message}")); } } - #endregion + /// /// Get latest action plan given robot Id. /// - /// List [HttpGet] [Route("plan/robot/{robotId}/latest", Name = "GetLatestActionPlanByRobotIdAsync")] - [ProducesResponseType(typeof(ActionPlanModel), (int)HttpStatusCode.OK)] + [ProducesResponseType(typeof(ActionPlanResponse), (int)HttpStatusCode.OK)] [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.NotFound)] [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.InternalServerError)] public async Task GetLatestActionPlanByRobotIdAsync(Guid robotId) @@ -489,35 +516,307 @@ public async Task GetLatestActionPlanByRobotIdAsync(Guid robotId) { return BadRequest(new ApiResponse((int)HttpStatusCode.BadRequest, "Robot id has not been specified")); } + // Get list of actionPlans from specific robotId. - List actionPlans = await _actionPlanRepository.GetRobotActionPlans(robotId); + var actionPlans = await _actionPlanRepository.GetRobotActionPlans(robotId); + + if (actionPlans == null) + { + return NotFound(new ApiResponse((int)HttpStatusCode.NotFound, "Object was not found.")); + } + + //Get the newest task of robot. + var tempDic = new Dictionary(); + var orderedTempDic = new Dictionary(); + + // Complete tempDic + foreach (var plan in actionPlans) + { + DateTime.TryParseExact(plan.Status, "ggyyyy$dd-MMM (dddd)", + System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out var d); + tempDic.Add(plan, d); + } + + // Order a new dictionary + foreach (var pair in tempDic.OrderByDescending(p => p.Value)) + { + orderedTempDic.Add(pair.Key, pair.Value); + } + + // Get last item which is the latest plan. + var last = orderedTempDic.Keys.First(); + + + //List activePoliciesRecords = actionPlans.Select(p => new ActionPlanModel(p.Id, p.Name, p.Description)).ToList(); + return Ok(last.ToActionPlanResponse()); + } + catch (Exception ex) + { + var statusCode = (int)HttpStatusCode.InternalServerError; + _logger.LogError(ex, "An error occurred:"); + return StatusCode(statusCode, new ApiResponse(statusCode, $"An error has occurred: {ex.Message}")); + } + } + + #endregion + + #region HistoricalActionPlan + + /// + /// Retrieves all HistoricalActionPlans + /// + /// + [HttpGet] + [Route("plan/historical", Name = "HistoricalActionPlanGetAll")] + [ProducesResponseType(typeof(List), (int)HttpStatusCode.OK)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.NotFound)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.InternalServerError)] + public async Task GetAllHistoricalActionPlansAsync() + { + try + { + var plans = await _historicalActionPlanRepository.GetAllAsync(); + if (plans == null || plans.Any() == false) + { + return NotFound(new ApiResponse((int)HttpStatusCode.NotFound, "No plans have been found.")); + } + + return Ok(plans); + } + catch (Exception ex) + { + _logger.LogError(ex, "An error occurred:"); + int statusCode = (int)HttpStatusCode.InternalServerError; + return StatusCode(statusCode, new ApiResponse(statusCode, ex.Message)); + } + } + + /// + /// Retrieves an HistoricalActionPlan by id + /// + /// + /// + [HttpGet] + [Route("plan/historical/{id:guid}", Name = "HistoricalActionPlanGetById")] + [ProducesResponseType(typeof(HistoricalActionPlanModel), (int)HttpStatusCode.OK)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.NotFound)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.InternalServerError)] + public async Task GetHistoricalActionPlanByIdAsync(Guid id) + { + try + { + var plan = await _historicalActionPlanRepository.GetByIdAsync(id); + if (plan == null) + { + return NotFound(new ApiResponse((int)HttpStatusCode.NotFound, "Specified plan was not found.")); + } + + return Ok(plan); + } + catch (Exception ex) + { + _logger.LogError(ex, "An error occurred:"); + int statusCode = (int)HttpStatusCode.InternalServerError; + return StatusCode(statusCode, new ApiResponse(statusCode, ex.Message)); + } + } + + /// + /// Creates new HistoricalActionPlan + /// + /// + /// + [HttpPost] + [Route("plan/historical", Name = "HistoricalActionPlanAdd")] + [ProducesResponseType(typeof(HistoricalActionPlanModel), (int)HttpStatusCode.OK)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.BadRequest)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.InternalServerError)] + public async Task AddHistoricalActionPlanAsync(HistoricalActionPlanModel historicalActionPlan) + { + try + { + if (historicalActionPlan == null) + { + return BadRequest(new ApiResponse((int)HttpStatusCode.BadRequest, "Historical plan cannot be null")); + } + + var plan = await _historicalActionPlanRepository.AddAsync(historicalActionPlan, + () => historicalActionPlan.Id); + if (plan == null) + { + return BadRequest(new ApiResponse((int)HttpStatusCode.BadRequest, + "The specified historical plan has not been added.")); + } + + return Ok(plan); + } + catch (Exception ex) + { + int statusCode = (int)HttpStatusCode.InternalServerError; + _logger.LogError(ex, "An error occurred:"); + return StatusCode(statusCode, new ApiResponse(statusCode, $"An error has occurred: {ex.Message}")); + } + } + + /// + /// Delete HistoricalActionPlan by id + /// + /// + /// + [HttpDelete] + [Route("plan/historical/{id}", Name = "HistoricalActionPlanDelete")] + [ProducesResponseType(typeof(void), (int)HttpStatusCode.OK)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.NotFound)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.InternalServerError)] + public async Task DeleteHistoricalActionPlanAsync(Guid id) + { + try + { + var deleted = await _historicalActionPlanRepository.DeleteByIdAsync(id); + if (deleted == false) + { + return NotFound(new ApiResponse((int)HttpStatusCode.NotFound, + "The specified historical plan has not been found.")); + } + + return Ok(); + } + catch (Exception ex) + { + int statusCode = (int)HttpStatusCode.InternalServerError; + _logger.LogError(ex, "An error occurred:"); + return StatusCode(statusCode, new ApiResponse(statusCode, $"An error has occurred: {ex.Message}")); + } + } + + /// + /// Patches an existing HistoricalActionPlan by id + /// + /// + /// + /// + [HttpPut] + [Route("plan/historical/{id:guid}", Name = "HistoricalActionPlanPatch")] + [ProducesResponseType(typeof(void), (int)HttpStatusCode.OK)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.NotFound)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.BadRequest)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.InternalServerError)] + public async Task PatchHistoricalActionPlanAsync(Guid id, + [FromBody] HistoricalActionPlanModel historicalActionPlan) + { + try + { + if (historicalActionPlan == null || id == Guid.Empty) + { + return BadRequest(new ApiResponse((int)HttpStatusCode.BadRequest, + "Id or updated object has not been specified")); + } + + var deleted = await _historicalActionPlanRepository.DeleteByIdAsync(id); + if (deleted == false) + { + return NotFound(new ApiResponse((int)HttpStatusCode.NotFound, + "The specified plan has not been found.")); + } + + var updatedPlan = await _historicalActionPlanRepository.AddAsync(historicalActionPlan, () => id); + return Ok(updatedPlan); + } + catch (Exception ex) + { + int statusCode = (int)HttpStatusCode.InternalServerError; + _logger.LogError(ex, "An error occurred:"); + return StatusCode(statusCode, new ApiResponse(statusCode, $"An error has occurred: {ex.Message}")); + } + } + + /// + /// Get historical action plan given robot Id. + /// + /// List + [HttpGet] + [Route("plan/historical/robot/{robotId}", Name = "GetHistoricalActionPlanByRobotIdAsync")] + [ProducesResponseType(typeof(List), (int)HttpStatusCode.OK)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.NotFound)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.InternalServerError)] + public async Task GetHistoricalActionPlanByRobotIdAsync(Guid robotId) + { + try + { + if (robotId == Guid.Empty) + { + return BadRequest(new ApiResponse((int)HttpStatusCode.BadRequest, "Robot id has not been specified")); + } + + // Get list of actionPlans from specific robotId. + List historicalActionPlans = + await _historicalActionPlanRepository.GetRobotActionPlans(robotId); + if (historicalActionPlans == null) + { + return NotFound(new ApiResponse((int)HttpStatusCode.NotFound, "Object was not found.")); + } + + return Ok(historicalActionPlans); + } + catch (Exception ex) + { + int statusCode = (int)HttpStatusCode.InternalServerError; + _logger.LogError(ex, "An error occurred:"); + return StatusCode(statusCode, new ApiResponse(statusCode, $"An error has occurred: {ex.Message}")); + } + } + + /// + /// Get latest historical action plan given robot Id. + /// + /// List + [HttpGet] + [Route("plan/historical/robot/{robotId}/latest", Name = "GetLatestHistoricalActionPlanByRobotIdAsync")] + [ProducesResponseType(typeof(HistoricalActionPlanModel), (int)HttpStatusCode.OK)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.NotFound)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.InternalServerError)] + public async Task GetLatestHistoricalActionPlanByRobotIdAsync(Guid robotId) + { + try + { + if (robotId == Guid.Empty) + { + return BadRequest(new ApiResponse((int)HttpStatusCode.BadRequest, "Robot id has not been specified")); + } + + // Get list of actionPlans from specific robotId. + List actionPlans = + await _historicalActionPlanRepository.GetRobotActionPlans(robotId); //Get the newest task of robot. - Dictionary tempDic = new Dictionary(); - Dictionary OrderedTempDic = new Dictionary(); + Dictionary tempDic = + new Dictionary(); + Dictionary OrderedTempDic = + new Dictionary(); // Complete tempDic - foreach (ActionPlanModel plan in actionPlans) + foreach (HistoricalActionPlanModel plan in actionPlans) { DateTime d; - DateTime.TryParseExact(plan.Status, "ggyyyy$dd-MMM (dddd)", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out d); + DateTime.TryParseExact(plan.Status, "ggyyyy$dd-MMM (dddd)", + System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out d); tempDic.Add(plan, d); } // Order a new dictionary - foreach (KeyValuePair pair in tempDic.OrderByDescending(p => p.Value)) + foreach (KeyValuePair pair in tempDic.OrderByDescending(p => p.Value)) { OrderedTempDic.Add(pair.Key, pair.Value); } // Get last item which is the latest plan. - ActionPlanModel last = OrderedTempDic.Keys.First(); + HistoricalActionPlanModel last = OrderedTempDic.Keys.First(); if (actionPlans == null) { return NotFound(new ApiResponse((int)HttpStatusCode.NotFound, "Object was not found.")); } - //List activePoliciesRecords = actionPlans.Select(p => new ActionPlanModel(p.Id, p.Name, p.Description)).ToList(); + return Ok(last); } catch (Exception ex) @@ -528,4 +827,275 @@ public async Task GetLatestActionPlanByRobotIdAsync(Guid robotId) } } + #endregion + + #region ActionRunning + + /// + /// Get all the ActionRunningModels entities + /// + /// the list of ActionModel entities + [HttpGet] + [Route("running", Name = "ActionRunningGetAll")] + [ProducesResponseType(typeof(GetRunningActionsResponse), (int)HttpStatusCode.OK)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.NotFound)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.InternalServerError)] + public async Task>> GetAllActionRunningAsync() + { + try + { + List models = await _actionRunningRepository.GetAllAsync(); + if (models != null && models.Any() == false) + { + return NotFound(new ApiResponse((int)HttpStatusCode.NotFound, "No actions were found.")); + } + + return Ok(models.ToRunningActionsResponse()); + } + catch (Exception ex) + { + int statusCode = (int)HttpStatusCode.InternalServerError; + _logger.LogError(ex, "An error occurred:"); + return StatusCode(statusCode, new ApiResponse(statusCode, $"An error has occurred: {ex.Message}")); + } + } + + //New end points for depends_on property for actions. + + /// + /// Get an ActionRunningModel entity by id + /// + /// + /// the ActionRunningModel entity for the specified id + [HttpGet] + [Route("running/{id:guid}", Name = "ActionRunningGetById")] + [ProducesResponseType(typeof(RunningActionResponse), (int)HttpStatusCode.OK)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.NotFound)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.InternalServerError)] + public async Task GetActionRunningByIdAsync(Guid id) + { + try + { + ActionRunningModel model = await _actionRunningRepository.GetByIdAsync(id); + if (model == null) + { + return NotFound(new ApiResponse((int)HttpStatusCode.NotFound, + $"Action with id: '{id}' was not found.")); + } + + return Ok(model.ToRunningActionResponse()); + } + catch (Exception ex) + { + int statusCode = (int)HttpStatusCode.InternalServerError; + _logger.LogError(ex, "An error occurred:"); + return StatusCode(statusCode, new ApiResponse(statusCode, $"An error has occurred: {ex.Message}")); + } + } + + /// + /// Add a new ActionRunningModel entity + /// + /// + /// the newly created ActionModel entity + [HttpPost] + [Route("running", Name = "ActionRunningAdd")] + [ProducesResponseType(typeof(RunningActionResponse), (int)HttpStatusCode.OK)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.BadRequest)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.InternalServerError)] + public async Task> AddActionRunningAsync([FromBody] ActionRunningModel model) + { + if (model == null) + { + return BadRequest(new ApiResponse((int)HttpStatusCode.BadRequest, "Parameters were not specified.")); + } + + try + { + model = await _actionRunningRepository.AddAsync(model); + } + catch (Exception ex) + { + int statusCode = (int)HttpStatusCode.InternalServerError; + _logger.LogError(ex, "An error occurred:"); + return StatusCode(statusCode, new ApiResponse(statusCode, $"An error has occurred: {ex.Message}")); + } + + return Ok(model.ToRunningActionResponse()); + } + + /// + /// Partially update an existing ActionRunningModel entity + /// + /// + /// + /// the modified ActionModel entity + [HttpPatch] + [Route("running/{id:guid}", Name = "ActionRunningPatch")] + [ProducesResponseType(typeof(RunningActionResponse), (int)HttpStatusCode.OK)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.NotFound)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.InternalServerError)] + public async Task PatchActionRunningAsync([FromBody] ActionRunningModel patch, [FromRoute] Guid id) + { + try + { + ActionRunningModel model = await _actionRunningRepository.PatchActionAsync(id, patch); + if (model == null) + { + return NotFound(new ApiResponse((int)HttpStatusCode.NotFound, "Object to be updated was not found.")); + } + + return Ok(model.ToRunningActionResponse()); + } + catch (Exception ex) + { + int statusCode = (int)HttpStatusCode.InternalServerError; + _logger.LogError(ex, "An error occurred:"); + return StatusCode(statusCode, new ApiResponse(statusCode, $"An error has occurred: {ex.Message}")); + } + } + + /// + /// Delete an ActionRunningModel entity for the given id + /// + /// + /// no return + [HttpDelete] + [Route("running/{id}", Name = "ActionRunningDelete")] + [ProducesResponseType(typeof(void), (int)HttpStatusCode.OK)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.NotFound)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.InternalServerError)] + public async Task DeleteActionRunningByIdAsync(Guid id) + { + try + { + var deleted = await _actionRunningRepository.DeleteByIdAsync(id); + if (deleted == false) + { + return NotFound(new ApiResponse((int)HttpStatusCode.NotFound, + "The specified Action has not been found.")); + } + + return Ok(); + } + catch (Exception ex) + { + int statusCode = (int)HttpStatusCode.InternalServerError; + _logger.LogError(ex, "An error occurred:"); + return StatusCode(statusCode, new ApiResponse(statusCode, $"An error has occurred: {ex.Message}")); + } + } + + /// + /// Creates a new relation between two models + /// + /// + /// + [HttpPost] + [Route("running/AddRelation", Name = "ActionRunningAddRelation")] + [ProducesResponseType(typeof(RelationModel), (int)HttpStatusCode.OK)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.BadRequest)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.InternalServerError)] + public async Task> AddActionRunningRelationAsync([FromBody] RelationModel model) + { + if (model == null) + { + return BadRequest("Parameters were not specified."); + } + + try + { + bool isValid = await _actionRunningRepository.AddRelationAsync(model); + if (!isValid) + { + return StatusCode((int)HttpStatusCode.InternalServerError, + new ApiResponse((int)HttpStatusCode.InternalServerError, "The relation was not created")); + } + } + catch (Exception ex) + { + int statusCode = (int)HttpStatusCode.InternalServerError; + _logger.LogError(ex, "An error occurred:"); + return StatusCode(statusCode, new ApiResponse(statusCode, $"An error has occurred: {ex.Message}")); + } + + return Ok(model); + } + + /// + /// Retrieves a single relation by name + /// + /// + /// + /// + [HttpGet] + [Route("running/relation/{name}", Name = "ActionRunningGetRelationByName")] + [ProducesResponseType(typeof(List), (int)HttpStatusCode.OK)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.NotFound)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.InternalServerError)] + public async Task + GetActionRunningRelationAsync(Guid id, string name) //Guid of node and name of relationship + { + if (string.IsNullOrWhiteSpace(name)) + { + return BadRequest(new ApiResponse((int)HttpStatusCode.BadRequest, "Relation name not specified")); + } + + if (id == Guid.Empty) + { + return BadRequest(new ApiResponse((int)HttpStatusCode.BadRequest, "Relation name not specified")); + } + + try + { + var relations = await _actionRunningRepository.GetRelation(id, name); + if (!relations.Any()) + { + return NotFound(new ApiResponse((int)HttpStatusCode.NotFound, "Relations were not found.")); + } + + return Ok(relations); + } + catch (Exception ex) + { + int statusCode = (int)HttpStatusCode.InternalServerError; + _logger.LogError(ex, "An error occurred:"); + return StatusCode(statusCode, new ApiResponse(statusCode, $"An error has occurred: {ex.Message}")); + } + } + + /// + /// Retrieves two relations by their names + /// + /// + /// + /// + /// + [HttpGet] + [Route("running/relations/{firstName}/{secondName}", Name = "ActionRunningGetRelationsByName")] + [ProducesResponseType(typeof(List), (int)HttpStatusCode.OK)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.NotFound)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.InternalServerError)] + public async Task GetActionRunningRelationsAsync(Guid id, string firstName, string secondName) + { + try + { + List relationNames = new List() { firstName, secondName }; + var relations = await _actionRunningRepository.GetRelations(id, relationNames); + if (!relations.Any()) + { + return NotFound(new ApiResponse((int)HttpStatusCode.NotFound, "Relations were not found")); + } + + return Ok(relations); + } + catch (Exception ex) + { + int statusCode = (int)HttpStatusCode.InternalServerError; + _logger.LogError(ex, "An error occurred:"); + return StatusCode(statusCode, new ApiResponse(statusCode, $"An error has occurred: {ex.Message}")); + } + } + + #endregion } \ No newline at end of file diff --git a/src/RedisInterface/Controllers/InstanceController.cs b/src/RedisInterface/Controllers/InstanceController.cs index 35181667..87cbc02c 100644 --- a/src/RedisInterface/Controllers/InstanceController.cs +++ b/src/RedisInterface/Controllers/InstanceController.cs @@ -17,12 +17,14 @@ namespace Middleware.RedisInterface.Controllers public class InstanceController : ControllerBase { private readonly IInstanceRepository _instanceRepository; + private readonly IInstanceRunningRepository _instanceRunningRepository; private readonly ILogger _logger; - public InstanceController(IInstanceRepository instanceRepository, ILogger logger) + public InstanceController(IInstanceRepository instanceRepository, ILogger logger, IInstanceRunningRepository instanceRunningRepository) { _instanceRepository = instanceRepository ?? throw new ArgumentNullException(nameof(instanceRepository)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); + _instanceRunningRepository = instanceRunningRepository ?? throw new ArgumentNullException(nameof(instanceRunningRepository)); } /// @@ -349,5 +351,289 @@ public async Task FindAlternativeInstance(Guid id) } } + #region InstanceRunning + + /// + /// Get all the InstanceModel entities + /// + /// the list of InstanceModel entities + [HttpGet] + [Route("running", Name = "InstanceRunningGetAll")] + [ProducesResponseType(typeof(InstanceRunningModel), (int)HttpStatusCode.OK)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.NotFound)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.InternalServerError)] + public async Task>> GetAllInstanceRunningAsync() + { + try + { + List models = await _instanceRunningRepository.GetAllAsync(); + if (models.Any() == false) + { + return NotFound(new ApiResponse((int)HttpStatusCode.NotFound, "Objects were not found.")); + } + return Ok(models); + } + catch (Exception ex) + { + int statusCode = (int)HttpStatusCode.InternalServerError; + _logger.LogError(ex, "An error occurred:"); + return StatusCode(statusCode, new ApiResponse(statusCode, $"An error has occurred: {ex.Message}")); + } + } + + /// + /// Get an InstanceModel entity by id + /// + /// + /// the InstanceModel entity for the specified id + [HttpGet] + [Route("running/{id:guid}", Name = "InstanceRunningGetById")] + [ProducesResponseType(typeof(InstanceRunningModel), (int)HttpStatusCode.OK)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.NotFound)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.InternalServerError)] + public async Task GetInstanceRunningByIdAsync(Guid id) + { + try + { + InstanceRunningModel model = await _instanceRunningRepository.GetByIdAsync(id); + if (model == null) + { + return NotFound(new ApiResponse((int)HttpStatusCode.NotFound, "Object was not found.")); + } + return Ok(model); + } + catch (Exception ex) + { + int statusCode = (int)HttpStatusCode.InternalServerError; + _logger.LogError(ex, "An error occurred:"); + return StatusCode(statusCode, new ApiResponse(statusCode, $"An error has occurred: {ex.Message}")); + } + } + + /// + /// Add a new InstanceModel entity + /// + /// + /// the newly created InstanceModel entity + [HttpPost] + [Route("running", Name = "InstanceRunningAdd")] + [ProducesResponseType(typeof(InstanceRunningModel), (int)HttpStatusCode.OK)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.BadRequest)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.InternalServerError)] + public async Task> AddInstanceRunningAsync([FromBody] InstanceRunningModel model) + { + if (model == null) + { + return BadRequest("Parameters were not specified."); + } + try + { + InstanceRunningModel instance = await _instanceRunningRepository.AddAsync(model); + if (instance is null) + { + return StatusCode((int)HttpStatusCode.InternalServerError, + new ApiResponse((int)HttpStatusCode.InternalServerError, + "Could not add the instance to the data store")); + } + } + catch (Exception ex) + { + int statusCode = (int)HttpStatusCode.InternalServerError; + _logger.LogError(ex, "An error occurred:"); + return StatusCode(statusCode, new ApiResponse(statusCode, $"An error has occurred: {ex.Message}")); + } + return Ok(model); + } + + /// + /// Partially update an existing InstanceModel entity + /// + /// + /// + /// the modified InstanceModel entity + [HttpPatch] + [Route("running/{id:guid}", Name = "InstanceRunningPatch")] + [ProducesResponseType(typeof(InstanceRunningModel), (int)HttpStatusCode.OK)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.NotFound)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.InternalServerError)] + public async Task PatchInstanceRunningAsync([FromBody] InstanceRunningModel patch, [FromRoute] Guid id) + { + try + { + InstanceRunningModel model = await _instanceRunningRepository.PatchInstanceAsync(id, patch); + if (model == null) + { + return NotFound(new ApiResponse((int)HttpStatusCode.NotFound, "Object to be updated was not found.")); + } + return Ok(model); + } + catch (Exception ex) + { + int statusCode = (int)HttpStatusCode.InternalServerError; + _logger.LogError(ex, "An error occurred:"); + return StatusCode(statusCode, new ApiResponse(statusCode, $"An error has occurred: {ex.Message}")); + } + } + + /// + /// Delete an InstanceModel entity for the given id + /// + /// + /// no return + [HttpDelete] + [Route("running/{id}", Name = "InstanceRunningDelete")] + [ProducesResponseType(typeof(void), (int)HttpStatusCode.OK)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.NotFound)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.InternalServerError)] + public async Task DeleteInstanceRunningByIdAsync(Guid id) + { + try + { + var deleted = await _instanceRunningRepository.DeleteByIdAsync(id); + if (deleted == false) + { + return NotFound(new ApiResponse((int)HttpStatusCode.NotFound, "The specified Instance has not been found.")); + } + return Ok(); + } + catch (Exception ex) + { + int statusCode = (int)HttpStatusCode.InternalServerError; + _logger.LogError(ex, "An error occurred:"); + return StatusCode(statusCode, new ApiResponse(statusCode, $"An error has occurred: {ex.Message}")); + } + } + + /// + /// Creates a new relation between two models + /// + /// + /// + [HttpPost] + [Route("running/AddRelation", Name = "InstanceRunningAddRelation")] + [ProducesResponseType(typeof(RelationModel), (int)HttpStatusCode.OK)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.BadRequest)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.InternalServerError)] + public async Task> AddInstanceRunningRelationAsync([FromBody] RelationModel model) + { + if (model == null) + { + return BadRequest(new ApiResponse((int)HttpStatusCode.BadRequest, "Parameters were not specified.")); + } + try + { + bool isValid = await _instanceRunningRepository.AddRelationAsync(model); + if (!isValid) + { + return StatusCode((int)HttpStatusCode.InternalServerError, new ApiResponse((int)HttpStatusCode.NotFound, "The relation was not created")); + } + } + catch (Exception ex) + { + int statusCode = (int)HttpStatusCode.InternalServerError; + _logger.LogError(ex, "An error occurred:"); + return StatusCode(statusCode, new ApiResponse(statusCode, $"An error has occurred: {ex.Message}")); + } + return Ok(model); + } + + + /// + /// Deletes a new relation between two models + /// + /// + /// + [HttpDelete] + [Route("running/DeleteRelation", Name = "InstanceRunningDeleteRelation")] + [ProducesResponseType(typeof(RelationModel), (int)HttpStatusCode.OK)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.BadRequest)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.InternalServerError)] + public async Task DeleteInstanceRunningRelationAsync([FromBody] RelationModel model) + { + if (model == null) + { + return BadRequest(new ApiResponse((int)HttpStatusCode.BadRequest, "Parameters were not specified.")); + } + try + { + bool isValid = await _instanceRunningRepository.DeleteRelationAsync(model); + if (!isValid) + { + return StatusCode((int)HttpStatusCode.InternalServerError, new ApiResponse((int)HttpStatusCode.NotFound, "The relation was not deleted")); + } + } + catch (Exception ex) + { + int statusCode = (int)HttpStatusCode.InternalServerError; + _logger.LogError(ex, "An error occurred:"); + return StatusCode(statusCode, new ApiResponse(statusCode, $"An error has occurred: {ex.Message}")); + } + return Ok(); + } + + /// + /// Retrieves a single relation by name + /// + /// + /// + /// + [HttpGet] + [Route("running/relation/{name}", Name = "InstanceRunningGetRelationByName")] + [ProducesResponseType(typeof(List), (int)HttpStatusCode.OK)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.NotFound)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.InternalServerError)] + public async Task GetInstanceRunningRelationAsync(Guid id, string name) + { + try + { + var relations = await _instanceRunningRepository.GetRelation(id, name); + if (!relations.Any()) + { + return NotFound(new ApiResponse((int)HttpStatusCode.NotFound, "Relations were not found.")); + } + return Ok(relations); + } + catch (Exception ex) + { + int statusCode = (int)HttpStatusCode.InternalServerError; + _logger.LogError(ex, "An error occurred:"); + return StatusCode(statusCode, new ApiResponse(statusCode, $"An error has occurred: {ex.Message}")); + } + } + + /// + /// Retrieves two relations by their names + /// + /// + /// + /// + /// + [HttpGet] + [Route("running/relations/{firstName}/{secondName}", Name = "InstanceRunningGetRelationsByName")] + [ProducesResponseType(typeof(List), (int)HttpStatusCode.OK)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.NotFound)] + [ProducesResponseType(typeof(ApiResponse), (int)HttpStatusCode.InternalServerError)] + public async Task GetInstanceRunningRelationsAsync(Guid id, string firstName, string secondName) + { + try + { + List relationNames = new List() { firstName, secondName }; + var relations = await _instanceRunningRepository.GetRelations(id, relationNames); + if (!relations.Any()) + { + return NotFound(new ApiResponse((int)HttpStatusCode.NotFound, "Relations were not found")); + } + return Ok(relations); + } + catch (Exception ex) + { + int statusCode = (int)HttpStatusCode.InternalServerError; + _logger.LogError(ex, "An error occurred:"); + return StatusCode(statusCode, new ApiResponse(statusCode, $"An error has occurred: {ex.Message}")); + } + } + + #endregion + } } diff --git a/src/RedisInterface/RedisInterfaceSpec.json b/src/RedisInterface/RedisInterfaceSpec.json index 39f45714..b0e623d8 100644 --- a/src/RedisInterface/RedisInterfaceSpec.json +++ b/src/RedisInterface/RedisInterfaceSpec.json @@ -17,17 +17,26 @@ "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/GetActionsResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/ActionModel" + } } }, "application/json": { "schema": { - "$ref": "#/components/schemas/GetActionsResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/ActionModel" + } } }, "text/json": { "schema": { - "$ref": "#/components/schemas/GetActionsResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/ActionModel" + } } } } @@ -83,22 +92,22 @@ "content": { "application/json-patch+json": { "schema": { - "$ref": "#/components/schemas/ActionRequest" + "$ref": "#/components/schemas/ActionModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/ActionRequest" + "$ref": "#/components/schemas/ActionModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/ActionRequest" + "$ref": "#/components/schemas/ActionModel" } }, "application/*+json": { "schema": { - "$ref": "#/components/schemas/ActionRequest" + "$ref": "#/components/schemas/ActionModel" } } } @@ -109,17 +118,17 @@ "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/ActionResponse" + "$ref": "#/components/schemas/ActionModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/ActionResponse" + "$ref": "#/components/schemas/ActionModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/ActionResponse" + "$ref": "#/components/schemas/ActionModel" } } } @@ -190,17 +199,17 @@ "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/ActionResponse" + "$ref": "#/components/schemas/ActionModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/ActionResponse" + "$ref": "#/components/schemas/ActionModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/ActionResponse" + "$ref": "#/components/schemas/ActionModel" } } } @@ -247,11 +256,11 @@ } } }, - "put": { + "patch": { "tags": [ "Action" ], - "operationId": "ActionUpdate", + "operationId": "ActionPatch", "parameters": [ { "name": "id", @@ -267,22 +276,22 @@ "content": { "application/json-patch+json": { "schema": { - "$ref": "#/components/schemas/ActionRequest" + "$ref": "#/components/schemas/ActionModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/ActionRequest" + "$ref": "#/components/schemas/ActionModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/ActionRequest" + "$ref": "#/components/schemas/ActionModel" } }, "application/*+json": { "schema": { - "$ref": "#/components/schemas/ActionRequest" + "$ref": "#/components/schemas/ActionModel" } } } @@ -293,17 +302,17 @@ "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/ActionResponse" + "$ref": "#/components/schemas/ActionModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/ActionResponse" + "$ref": "#/components/schemas/ActionModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/ActionResponse" + "$ref": "#/components/schemas/ActionModel" } } } @@ -1300,29 +1309,38 @@ } } }, - "/api/v1/Cloud": { + "/api/v1/ActionRunning": { "get": { "tags": [ - "Cloud" + "ActionRunning" ], - "operationId": "CloudGetAll", + "operationId": "ActionRunningGetAll", "responses": { "200": { "description": "Success", "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/GetCloudsResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/ActionRunningModel" + } } }, "application/json": { "schema": { - "$ref": "#/components/schemas/GetCloudsResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/ActionRunningModel" + } } }, "text/json": { "schema": { - "$ref": "#/components/schemas/GetCloudsResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/ActionRunningModel" + } } } } @@ -1371,29 +1389,29 @@ }, "post": { "tags": [ - "Cloud" + "ActionRunning" ], - "operationId": "CloudAdd", + "operationId": "ActionRunningAdd", "requestBody": { "content": { "application/json-patch+json": { "schema": { - "$ref": "#/components/schemas/CloudRequest" + "$ref": "#/components/schemas/ActionRunningModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/CloudRequest" + "$ref": "#/components/schemas/ActionRunningModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/CloudRequest" + "$ref": "#/components/schemas/ActionRunningModel" } }, "application/*+json": { "schema": { - "$ref": "#/components/schemas/CloudRequest" + "$ref": "#/components/schemas/ActionRunningModel" } } } @@ -1404,17 +1422,17 @@ "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/CloudResponse" + "$ref": "#/components/schemas/ActionRunningModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/CloudResponse" + "$ref": "#/components/schemas/ActionRunningModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/CloudResponse" + "$ref": "#/components/schemas/ActionRunningModel" } } } @@ -1462,12 +1480,12 @@ } } }, - "/api/v1/Cloud/{id}": { + "/api/v1/ActionRunning/{id}": { "get": { "tags": [ - "Cloud" + "ActionRunning" ], - "operationId": "CloudGetById", + "operationId": "ActionRunningGetById", "parameters": [ { "name": "id", @@ -1485,17 +1503,17 @@ "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/CloudResponse" + "$ref": "#/components/schemas/ActionRunningModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/CloudResponse" + "$ref": "#/components/schemas/ActionRunningModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/CloudResponse" + "$ref": "#/components/schemas/ActionRunningModel" } } } @@ -1542,11 +1560,11 @@ } } }, - "put": { + "patch": { "tags": [ - "Cloud" + "ActionRunning" ], - "operationId": "CloudPatch", + "operationId": "ActionRunningPatch", "parameters": [ { "name": "id", @@ -1562,22 +1580,22 @@ "content": { "application/json-patch+json": { "schema": { - "$ref": "#/components/schemas/CloudRequest" + "$ref": "#/components/schemas/ActionRunningModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/CloudRequest" + "$ref": "#/components/schemas/ActionRunningModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/CloudRequest" + "$ref": "#/components/schemas/ActionRunningModel" } }, "application/*+json": { "schema": { - "$ref": "#/components/schemas/CloudRequest" + "$ref": "#/components/schemas/ActionRunningModel" } } } @@ -1588,17 +1606,17 @@ "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/CloudResponse" + "$ref": "#/components/schemas/ActionRunningModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/CloudResponse" + "$ref": "#/components/schemas/ActionRunningModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/CloudResponse" + "$ref": "#/components/schemas/ActionRunningModel" } } } @@ -1647,9 +1665,9 @@ }, "delete": { "tags": [ - "Cloud" + "ActionRunning" ], - "operationId": "CloudDelete", + "operationId": "ActionRunningDelete", "parameters": [ { "name": "id", @@ -1708,12 +1726,12 @@ } } }, - "/api/v1/Cloud/AddRelation": { + "/api/v1/ActionRunning/AddRelation": { "post": { "tags": [ - "Cloud" + "ActionRunning" ], - "operationId": "CloudAddRelation", + "operationId": "ActionRunningAddRelation", "requestBody": { "content": { "application/json-patch+json": { @@ -1802,12 +1820,12 @@ } } }, - "/api/v1/Cloud/relation/{name}": { + "/api/v1/ActionRunning/relation/{name}": { "get": { "tags": [ - "Cloud" + "ActionRunning" ], - "operationId": "CloudGetRelationByName", + "operationId": "ActionRunningGetRelationByName", "parameters": [ { "name": "id", @@ -1899,12 +1917,12 @@ } } }, - "/api/v1/Cloud/relations/{firstName}/{secondName}": { + "/api/v1/ActionRunning/relations/{firstName}/{secondName}": { "get": { "tags": [ - "Cloud" + "ActionRunning" ], - "operationId": "CloudGetRelationsByName", + "operationId": "ActionRunningGetRelationsByName", "parameters": [ { "name": "id", @@ -2004,39 +2022,29 @@ } } }, - "/name/{name}": { + "/api/v1/Cloud": { "get": { "tags": [ "Cloud" ], - "operationId": "CloudGetDataByName", - "parameters": [ - { - "name": "name", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], + "operationId": "CloudGetAll", "responses": { "200": { "description": "Success", "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/CloudResponse" + "$ref": "#/components/schemas/CloudModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/CloudResponse" + "$ref": "#/components/schemas/CloudModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/CloudResponse" + "$ref": "#/components/schemas/CloudModel" } } } @@ -2082,46 +2090,32 @@ } } } - } - }, - "/api/v1/Cloud/free": { - "get": { + }, + "post": { "tags": [ "Cloud" ], - "operationId": "GetFreeCloudIds", + "operationId": "CloudAdd", "requestBody": { "content": { "application/json-patch+json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/CloudModel" - } + "$ref": "#/components/schemas/CloudModel" } }, "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/CloudModel" - } + "$ref": "#/components/schemas/CloudModel" } }, "text/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/CloudModel" - } + "$ref": "#/components/schemas/CloudModel" } }, "application/*+json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/CloudModel" - } + "$ref": "#/components/schemas/CloudModel" } } } @@ -2132,37 +2126,17 @@ "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/GetCloudsResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/GetCloudsResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/GetCloudsResponse" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" + "$ref": "#/components/schemas/CloudModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/ApiResponse" + "$ref": "#/components/schemas/CloudModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/ApiResponse" + "$ref": "#/components/schemas/CloudModel" } } } @@ -2210,65 +2184,40 @@ } } }, - "/api/v1/Cloud/lessBusy": { + "/api/v1/Cloud/{id}": { "get": { "tags": [ "Cloud" ], - "operationId": "GetLessBusyClouds", - "requestBody": { - "content": { - "application/json-patch+json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/CloudModel" - } - } - }, - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/CloudModel" - } - } - }, - "text/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/CloudModel" - } - } - }, - "application/*+json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/CloudModel" - } - } + "operationId": "CloudGetById", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uuid" } } - }, + ], "responses": { "200": { "description": "Success", "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/GetCloudsResponse" + "$ref": "#/components/schemas/CloudModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/GetCloudsResponse" + "$ref": "#/components/schemas/CloudModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/GetCloudsResponse" + "$ref": "#/components/schemas/CloudModel" } } } @@ -2293,26 +2242,6 @@ } } }, - "400": { - "description": "Bad Request", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" - } - } - } - }, "500": { "description": "Server Error", "content": { @@ -2334,44 +2263,64 @@ } } } - } - }, - "/api/v1/Cloud/{name}/containers/count": { - "get": { + }, + "patch": { "tags": [ "Cloud" ], - "operationId": "GetNumCloudContainersByName", + "operationId": "CloudPatch", "parameters": [ { - "name": "name", + "name": "id", "in": "path", "required": true, "schema": { - "type": "string" + "type": "string", + "format": "uuid" } } ], + "requestBody": { + "content": { + "application/json-patch+json": { + "schema": { + "$ref": "#/components/schemas/CloudModel" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/CloudModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/CloudModel" + } + }, + "application/*+json": { + "schema": { + "$ref": "#/components/schemas/CloudModel" + } + } + } + }, "responses": { "200": { "description": "Success", "content": { "text/plain": { "schema": { - "type": "integer", - "format": "int32" + "$ref": "#/components/schemas/CloudModel" } }, "application/json": { "schema": { - "type": "integer", - "format": "int32" + "$ref": "#/components/schemas/CloudModel" } }, "text/json": { "schema": { - "type": "integer", - "format": "int32" + "$ref": "#/components/schemas/CloudModel" } } } @@ -2396,26 +2345,6 @@ } } }, - "400": { - "description": "Bad Request", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" - } - } - } - }, "500": { "description": "Server Error", "content": { @@ -2437,58 +2366,49 @@ } } } - } - }, - "/api/v1/Cloud/{id}/containers/count": { - "get": { + }, + "delete": { "tags": [ "Cloud" ], - "operationId": "GetNumCloudContainersById", + "operationId": "CloudDelete", "parameters": [ - { - "name": "cloudId", - "in": "query", - "schema": { - "type": "string", - "format": "uuid" - } - }, { "name": "id", "in": "path", "required": true, "schema": { - "type": "string" + "type": "string", + "format": "uuid" } } ], "responses": { "200": { - "description": "Success", + "description": "Success" + }, + "404": { + "description": "Not Found", "content": { "text/plain": { "schema": { - "type": "integer", - "format": "int32" + "$ref": "#/components/schemas/ApiResponse" } }, "application/json": { "schema": { - "type": "integer", - "format": "int32" + "$ref": "#/components/schemas/ApiResponse" } }, "text/json": { "schema": { - "type": "integer", - "format": "int32" + "$ref": "#/components/schemas/ApiResponse" } } } }, - "404": { - "description": "Not Found", + "500": { + "description": "Server Error", "content": { "text/plain": { "schema": { @@ -2506,6 +2426,60 @@ } } } + } + } + } + }, + "/api/v1/Cloud/AddRelation": { + "post": { + "tags": [ + "Cloud" + ], + "operationId": "CloudAddRelation", + "requestBody": { + "content": { + "application/json-patch+json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + }, + "application/*+json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + } + } + }, + "responses": { + "200": { + "description": "Success", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + } + } }, "400": { "description": "Bad Request", @@ -2550,13 +2524,21 @@ } } }, - "/api/v1/Cloud/{name}/busy": { + "/api/v1/Cloud/relation/{name}": { "get": { "tags": [ "Cloud" ], - "operationId": "IsBusyCloudByName", + "operationId": "CloudGetRelationByName", "parameters": [ + { + "name": "id", + "in": "query", + "schema": { + "type": "string", + "format": "uuid" + } + }, { "name": "name", "in": "path", @@ -2572,20 +2554,26 @@ "content": { "text/plain": { "schema": { - "type": "integer", - "format": "int32" + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } } }, "application/json": { "schema": { - "type": "integer", - "format": "int32" + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } } }, "text/json": { "schema": { - "type": "integer", - "format": "int32" + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } } } } @@ -2610,26 +2598,6 @@ } } }, - "400": { - "description": "Bad Request", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" - } - } - } - }, "500": { "description": "Server Error", "content": { @@ -2653,15 +2621,15 @@ } } }, - "/api/v1/Cloud/{id}/busy": { + "/api/v1/Cloud/relations/{firstName}/{secondName}": { "get": { "tags": [ "Cloud" ], - "operationId": "isBusyCloudById", + "operationId": "CloudGetRelationsByName", "parameters": [ { - "name": "cloudId", + "name": "id", "in": "query", "schema": { "type": "string", @@ -2669,7 +2637,15 @@ } }, { - "name": "id", + "name": "firstName", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "secondName", "in": "path", "required": true, "schema": { @@ -2683,20 +2659,26 @@ "content": { "text/plain": { "schema": { - "type": "integer", - "format": "int32" + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } } }, "application/json": { "schema": { - "type": "integer", - "format": "int32" + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } } }, "text/json": { "schema": { - "type": "integer", - "format": "int32" + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } } } } @@ -2721,26 +2703,6 @@ } } }, - "400": { - "description": "Bad Request", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" - } - } - } - }, "500": { "description": "Server Error", "content": { @@ -2764,29 +2726,39 @@ } } }, - "/api/v1/ContainerImage": { + "/name/{name}": { "get": { "tags": [ - "ContainerImage" + "Cloud" + ], + "operationId": "CloudGetDataByName", + "parameters": [ + { + "name": "name", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } ], - "operationId": "ContainerImageGetAll", "responses": { "200": { "description": "Success", "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/GetContainersResponse" + "$ref": "#/components/schemas/CloudModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/GetContainersResponse" + "$ref": "#/components/schemas/CloudModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/GetContainersResponse" + "$ref": "#/components/schemas/CloudModel" } } } @@ -2832,32 +2804,46 @@ } } } - }, - "post": { + } + }, + "/api/v1/Cloud/free": { + "get": { "tags": [ - "ContainerImage" + "Cloud" ], - "operationId": "ContainerImageAdd", + "operationId": "GetFreeCloudIds", "requestBody": { "content": { "application/json-patch+json": { "schema": { - "$ref": "#/components/schemas/ContainerRequest" + "type": "array", + "items": { + "$ref": "#/components/schemas/CloudModel" + } } }, "application/json": { "schema": { - "$ref": "#/components/schemas/ContainerRequest" + "type": "array", + "items": { + "$ref": "#/components/schemas/CloudModel" + } } }, "text/json": { "schema": { - "$ref": "#/components/schemas/ContainerRequest" + "type": "array", + "items": { + "$ref": "#/components/schemas/CloudModel" + } } }, "application/*+json": { "schema": { - "$ref": "#/components/schemas/ContainerRequest" + "type": "array", + "items": { + "$ref": "#/components/schemas/CloudModel" + } } } } @@ -2868,17 +2854,46 @@ "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/ContainerResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/CloudModel" + } + } + }, + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CloudModel" + } + } + }, + "text/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CloudModel" + } + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/ContainerResponse" + "$ref": "#/components/schemas/ApiResponse" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/ContainerResponse" + "$ref": "#/components/schemas/ApiResponse" } } } @@ -2926,40 +2941,74 @@ } } }, - "/api/v1/ContainerImage/{id}": { + "/api/v1/Cloud/lessBusy": { "get": { "tags": [ - "ContainerImage" + "Cloud" ], - "operationId": "ContainerImageGetById", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid" + "operationId": "GetLessBusyClouds", + "requestBody": { + "content": { + "application/json-patch+json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CloudModel" + } + } + }, + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CloudModel" + } + } + }, + "text/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CloudModel" + } + } + }, + "application/*+json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CloudModel" + } + } } } - ], + }, "responses": { "200": { "description": "Success", "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/ContainerResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/CloudModel" + } } }, "application/json": { "schema": { - "$ref": "#/components/schemas/ContainerResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/CloudModel" + } } }, "text/json": { "schema": { - "$ref": "#/components/schemas/ContainerResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/CloudModel" + } } } } @@ -2984,6 +3033,26 @@ } } }, + "400": { + "description": "Bad Request", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } + }, "500": { "description": "Server Error", "content": { @@ -3005,64 +3074,44 @@ } } } - }, - "put": { + } + }, + "/api/v1/Cloud/{name}/containers/count": { + "get": { "tags": [ - "ContainerImage" + "Cloud" ], - "operationId": "ContainerImagePatch", + "operationId": "GetNumCloudContainersByName", "parameters": [ { - "name": "id", + "name": "name", "in": "path", "required": true, "schema": { - "type": "string", - "format": "uuid" + "type": "string" } } ], - "requestBody": { - "content": { - "application/json-patch+json": { - "schema": { - "$ref": "#/components/schemas/ContainerRequest" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ContainerRequest" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ContainerRequest" - } - }, - "application/*+json": { - "schema": { - "$ref": "#/components/schemas/ContainerRequest" - } - } - } - }, "responses": { "200": { "description": "Success", "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/ContainerResponse" + "type": "integer", + "format": "int32" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/ContainerResponse" + "type": "integer", + "format": "int32" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/ContainerResponse" + "type": "integer", + "format": "int32" } } } @@ -3087,6 +3136,26 @@ } } }, + "400": { + "description": "Bad Request", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } + }, "500": { "description": "Server Error", "content": { @@ -3108,49 +3177,58 @@ } } } - }, - "delete": { + } + }, + "/api/v1/Cloud/{id}/containers/count": { + "get": { "tags": [ - "ContainerImage" + "Cloud" ], - "operationId": "ContainerImageDelete", + "operationId": "GetNumCloudContainersById", "parameters": [ + { + "name": "cloudId", + "in": "query", + "schema": { + "type": "string", + "format": "uuid" + } + }, { "name": "id", "in": "path", "required": true, "schema": { - "type": "string", - "format": "uuid" + "type": "string" } } ], "responses": { "200": { - "description": "Success" - }, - "404": { - "description": "Not Found", + "description": "Success", "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/ApiResponse" + "type": "integer", + "format": "int32" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/ApiResponse" + "type": "integer", + "format": "int32" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/ApiResponse" + "type": "integer", + "format": "int32" } } } }, - "500": { - "description": "Server Error", + "404": { + "description": "Not Found", "content": { "text/plain": { "schema": { @@ -3168,60 +3246,6 @@ } } } - } - } - } - }, - "/api/v1/ContainerImage/AddRelation": { - "post": { - "tags": [ - "ContainerImage" - ], - "operationId": "ContainerImageAddRelation", - "requestBody": { - "content": { - "application/json-patch+json": { - "schema": { - "$ref": "#/components/schemas/RelationModel" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/RelationModel" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/RelationModel" - } - }, - "application/*+json": { - "schema": { - "$ref": "#/components/schemas/RelationModel" - } - } - } - }, - "responses": { - "200": { - "description": "Success", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/RelationModel" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/RelationModel" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/RelationModel" - } - } - } }, "400": { "description": "Bad Request", @@ -3266,21 +3290,13 @@ } } }, - "/api/v1/ContainerImage/relation/{name}": { + "/api/v1/Cloud/{name}/busy": { "get": { "tags": [ - "ContainerImage" + "Cloud" ], - "operationId": "ContainerImageGetRelationByName", + "operationId": "IsBusyCloudByName", "parameters": [ - { - "name": "id", - "in": "query", - "schema": { - "type": "string", - "format": "uuid" - } - }, { "name": "name", "in": "path", @@ -3296,26 +3312,20 @@ "content": { "text/plain": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RelationModel" - } + "type": "integer", + "format": "int32" } }, "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RelationModel" - } + "type": "integer", + "format": "int32" } }, "text/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RelationModel" - } + "type": "integer", + "format": "int32" } } } @@ -3340,6 +3350,26 @@ } } }, + "400": { + "description": "Bad Request", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } + }, "500": { "description": "Server Error", "content": { @@ -3363,15 +3393,15 @@ } } }, - "/api/v1/ContainerImage/relations/{firstName}/{secondName}": { + "/api/v1/Cloud/{id}/busy": { "get": { "tags": [ - "ContainerImage" + "Cloud" ], - "operationId": "ContainerImageGetRelationsByName", + "operationId": "isBusyCloudById", "parameters": [ { - "name": "id", + "name": "cloudId", "in": "query", "schema": { "type": "string", @@ -3379,15 +3409,7 @@ } }, { - "name": "firstName", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "secondName", + "name": "id", "in": "path", "required": true, "schema": { @@ -3401,26 +3423,20 @@ "content": { "text/plain": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RelationModel" - } + "type": "integer", + "format": "int32" } }, "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RelationModel" - } + "type": "integer", + "format": "int32" } }, "text/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RelationModel" - } + "type": "integer", + "format": "int32" } } } @@ -3445,6 +3461,26 @@ } } }, + "400": { + "description": "Bad Request", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } + }, "500": { "description": "Server Error", "content": { @@ -3468,40 +3504,29 @@ } } }, - "/api/v1/ContainerImage/instance/{id}": { + "/api/v1/ContainerImage": { "get": { "tags": [ "ContainerImage" ], - "operationId": "ContainerImageGetForInstance", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid" - } - } - ], + "operationId": "ContainerImageGetAll", "responses": { "200": { "description": "Success", "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/GetContainersResponse" + "$ref": "#/components/schemas/ContainerImageModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/GetContainersResponse" + "$ref": "#/components/schemas/ContainerImageModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/GetContainersResponse" + "$ref": "#/components/schemas/ContainerImageModel" } } } @@ -3547,48 +3572,73 @@ } } } - } - }, - "/api/v1/Dashboard/tasks": { - "get": { + }, + "post": { "tags": [ - "Dashboard" + "ContainerImage" ], - "parameters": [ - { - "name": "PageNumber", - "in": "query", - "schema": { - "type": "integer", - "format": "int32" - } - }, - { - "name": "PageSize", - "in": "query", - "schema": { - "type": "integer", - "format": "int32" + "operationId": "ContainerImageAdd", + "requestBody": { + "content": { + "application/json-patch+json": { + "schema": { + "$ref": "#/components/schemas/ContainerImageModel" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ContainerImageModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ContainerImageModel" + } + }, + "application/*+json": { + "schema": { + "$ref": "#/components/schemas/ContainerImageModel" + } } } - ], + }, "responses": { "200": { "description": "Success", "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/TaskRobotResponseListPagedResponse" + "$ref": "#/components/schemas/ContainerImageModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/TaskRobotResponseListPagedResponse" + "$ref": "#/components/schemas/ContainerImageModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/TaskRobotResponseListPagedResponse" + "$ref": "#/components/schemas/ContainerImageModel" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" } } } @@ -3616,26 +3666,20 @@ } } }, - "/api/v1/Dashboard/locations": { + "/api/v1/ContainerImage/{id}": { "get": { "tags": [ - "Dashboard" + "ContainerImage" ], + "operationId": "ContainerImageGetbyId", "parameters": [ { - "name": "PageNumber", - "in": "query", - "schema": { - "type": "integer", - "format": "int32" - } - }, - { - "name": "PageSize", - "in": "query", + "name": "id", + "in": "path", + "required": true, "schema": { - "type": "integer", - "format": "int32" + "type": "string", + "format": "uuid" } } ], @@ -3645,23 +3689,23 @@ "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/LocationStatusResponseListPagedResponse" + "$ref": "#/components/schemas/ContainerImageModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/LocationStatusResponseListPagedResponse" + "$ref": "#/components/schemas/ContainerImageModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/LocationStatusResponseListPagedResponse" + "$ref": "#/components/schemas/ContainerImageModel" } } } }, - "500": { - "description": "Server Error", + "404": { + "description": "Not Found", "content": { "text/plain": { "schema": { @@ -3679,35 +3723,6 @@ } } } - } - } - } - }, - "/api/v1/Dashboard/tasks/actions": { - "get": { - "tags": [ - "Dashboard" - ], - "responses": { - "200": { - "description": "Success", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ActionSequenceResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ActionSequenceResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ActionSequenceResponse" - } - } - } }, "500": { "description": "Server Error", @@ -3730,30 +3745,84 @@ } } } - } - }, - "/api/v1/Dashboard/types": { - "get": { + }, + "patch": { "tags": [ - "Dashboard" + "ContainerImage" + ], + "operationId": "ContainerImagePatch", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } ], + "requestBody": { + "content": { + "application/json-patch+json": { + "schema": { + "$ref": "#/components/schemas/ContainerImageModel" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ContainerImageModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ContainerImageModel" + } + }, + "application/*+json": { + "schema": { + "$ref": "#/components/schemas/ContainerImageModel" + } + } + } + }, "responses": { "200": { "description": "Success", "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/ActionSequenceResponse" + "$ref": "#/components/schemas/ContainerImageModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/ActionSequenceResponse" + "$ref": "#/components/schemas/ContainerImageModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/ActionSequenceResponse" + "$ref": "#/components/schemas/ContainerImageModel" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" } } } @@ -3779,48 +3848,43 @@ } } } - } - }, - "/api/v1/Dashboard/netApps": { - "get": { + }, + "delete": { "tags": [ - "Dashboard" + "ContainerImage" ], + "operationId": "ContainerImageDelete", "parameters": [ { - "name": "PageNumber", - "in": "query", - "schema": { - "type": "integer", - "format": "int32" - } - }, - { - "name": "PageSize", - "in": "query", + "name": "id", + "in": "path", + "required": true, "schema": { - "type": "integer", - "format": "int32" + "type": "string", + "format": "uuid" } } ], "responses": { "200": { - "description": "Success", + "description": "Success" + }, + "404": { + "description": "Not Found", "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/NetAppsDetailsResponseListPagedResponse" + "$ref": "#/components/schemas/ApiResponse" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/NetAppsDetailsResponseListPagedResponse" + "$ref": "#/components/schemas/ApiResponse" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/NetAppsDetailsResponseListPagedResponse" + "$ref": "#/components/schemas/ApiResponse" } } } @@ -3848,52 +3912,59 @@ } } }, - "/api/v1/Dashboard/robots": { - "get": { + "/api/v1/ContainerImage/AddRelation": { + "post": { "tags": [ - "Dashboard" + "ContainerImage" ], - "parameters": [ - { - "name": "PageNumber", - "in": "query", - "schema": { - "type": "integer", - "format": "int32" - } - }, - { - "name": "PageSize", - "in": "query", - "schema": { - "type": "integer", - "format": "int32" + "operationId": "ContainerImageAddRelation", + "requestBody": { + "content": { + "application/json-patch+json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + }, + "application/*+json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } } } - ], + }, "responses": { "200": { "description": "Success", "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/DashboardRobotResponseListPagedResponse" + "$ref": "#/components/schemas/RelationModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/DashboardRobotResponseListPagedResponse" + "$ref": "#/components/schemas/RelationModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/DashboardRobotResponseListPagedResponse" + "$ref": "#/components/schemas/RelationModel" } } } }, - "500": { - "description": "Server Error", + "400": { + "description": "Bad Request", "content": { "text/plain": { "schema": { @@ -3911,35 +3982,6 @@ } } } - } - } - } - }, - "/api/v1/Dashboard/graph": { - "get": { - "tags": [ - "Dashboard" - ], - "responses": { - "200": { - "description": "Success", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/GraphResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/GraphResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/GraphResponse" - } - } - } }, "500": { "description": "Server Error", @@ -3964,29 +4006,56 @@ } } }, - "/api/v1/Edge": { + "/api/v1/ContainerImage/relation/{name}": { "get": { "tags": [ - "Edge" + "ContainerImage" + ], + "operationId": "ContainerImageGetRelationByName", + "parameters": [ + { + "name": "id", + "in": "query", + "schema": { + "type": "string", + "format": "uuid" + } + }, + { + "name": "name", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } ], - "operationId": "EdgeGetAll", "responses": { "200": { "description": "Success", "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/GetEdgesResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } } }, "application/json": { "schema": { - "$ref": "#/components/schemas/GetEdgesResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } } }, "text/json": { "schema": { - "$ref": "#/components/schemas/GetEdgesResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } } } } @@ -4032,59 +4101,72 @@ } } } - }, - "post": { + } + }, + "/api/v1/ContainerImage/relations/{firstName}/{secondName}": { + "get": { "tags": [ - "Edge" + "ContainerImage" ], - "operationId": "EdgeAdd", - "requestBody": { - "content": { - "application/json-patch+json": { - "schema": { - "$ref": "#/components/schemas/EdgeRequest" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/EdgeRequest" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/EdgeRequest" - } - }, - "application/*+json": { - "schema": { - "$ref": "#/components/schemas/EdgeRequest" - } + "operationId": "ContainerImageGetRelationsByName", + "parameters": [ + { + "name": "id", + "in": "query", + "schema": { + "type": "string", + "format": "uuid" + } + }, + { + "name": "firstName", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "secondName", + "in": "path", + "required": true, + "schema": { + "type": "string" } } - }, + ], "responses": { "200": { "description": "Success", "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/EdgeResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } } }, "application/json": { "schema": { - "$ref": "#/components/schemas/EdgeResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } } }, "text/json": { "schema": { - "$ref": "#/components/schemas/EdgeResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } } } } }, - "400": { - "description": "Bad Request", + "404": { + "description": "Not Found", "content": { "text/plain": { "schema": { @@ -4126,12 +4208,12 @@ } } }, - "/api/v1/Edge/{id}": { + "/api/v1/ContainerImage/instance/{id}": { "get": { "tags": [ - "Edge" + "ContainerImage" ], - "operationId": "EdgeGetById", + "operationId": "ContainerImageGetForInstance", "parameters": [ { "name": "id", @@ -4149,19 +4231,28 @@ "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/EdgeResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/ContainerImageModel" + } } }, "application/json": { "schema": { - "$ref": "#/components/schemas/EdgeResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/ContainerImageModel" + } } }, "text/json": { "schema": { - "$ref": "#/components/schemas/EdgeResponse" - } - } + "type": "array", + "items": { + "$ref": "#/components/schemas/ContainerImageModel" + } + } + } } }, "404": { @@ -4205,84 +4296,48 @@ } } } - }, - "put": { + } + }, + "/api/v1/Dashboard/tasks": { + "get": { "tags": [ - "Edge" + "Dashboard" ], - "operationId": "EdgePatch", "parameters": [ { - "name": "id", - "in": "path", - "required": true, + "name": "PageNumber", + "in": "query", "schema": { - "type": "string", - "format": "uuid" + "type": "integer", + "format": "int32" } - } - ], - "requestBody": { - "content": { - "application/json-patch+json": { - "schema": { - "$ref": "#/components/schemas/EdgeRequest" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/EdgeRequest" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/EdgeRequest" - } - }, - "application/*+json": { - "schema": { - "$ref": "#/components/schemas/EdgeRequest" - } + }, + { + "name": "PageSize", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" } } - }, + ], "responses": { "200": { "description": "Success", "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/EdgeResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/EdgeResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/EdgeResponse" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" + "$ref": "#/components/schemas/TaskRobotResponseListPagedResponse" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/ApiResponse" + "$ref": "#/components/schemas/TaskRobotResponseListPagedResponse" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/ApiResponse" + "$ref": "#/components/schemas/TaskRobotResponseListPagedResponse" } } } @@ -4308,43 +4363,48 @@ } } } - }, - "delete": { + } + }, + "/api/v1/Dashboard/locations": { + "get": { "tags": [ - "Edge" + "Dashboard" ], - "operationId": "EdgeDelete", "parameters": [ { - "name": "id", - "in": "path", - "required": true, + "name": "PageNumber", + "in": "query", "schema": { - "type": "string", - "format": "uuid" + "type": "integer", + "format": "int32" + } + }, + { + "name": "PageSize", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" } } ], "responses": { "200": { - "description": "Success" - }, - "404": { - "description": "Not Found", + "description": "Success", "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/ApiResponse" + "$ref": "#/components/schemas/LocationStatusResponseListPagedResponse" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/ApiResponse" + "$ref": "#/components/schemas/LocationStatusResponseListPagedResponse" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/ApiResponse" + "$ref": "#/components/schemas/LocationStatusResponseListPagedResponse" } } } @@ -4372,59 +4432,34 @@ } } }, - "/api/v1/Edge/AddRelation": { - "post": { + "/api/v1/Dashboard/tasks/actions": { + "get": { "tags": [ - "Edge" + "Dashboard" ], - "operationId": "EdgeAddRelation", - "requestBody": { - "content": { - "application/json-patch+json": { - "schema": { - "$ref": "#/components/schemas/RelationModel" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/RelationModel" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/RelationModel" - } - }, - "application/*+json": { - "schema": { - "$ref": "#/components/schemas/RelationModel" - } - } - } - }, "responses": { "200": { "description": "Success", "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/RelationModel" + "$ref": "#/components/schemas/ActionSequenceResponse" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/RelationModel" + "$ref": "#/components/schemas/ActionSequenceResponse" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/RelationModel" + "$ref": "#/components/schemas/ActionSequenceResponse" } } } }, - "400": { - "description": "Bad Request", + "500": { + "description": "Server Error", "content": { "text/plain": { "schema": { @@ -4442,6 +4477,35 @@ } } } + } + } + } + }, + "/api/v1/Dashboard/types": { + "get": { + "tags": [ + "Dashboard" + ], + "responses": { + "200": { + "description": "Success", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ActionSequenceResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ActionSequenceResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ActionSequenceResponse" + } + } + } }, "500": { "description": "Server Error", @@ -4466,27 +4530,26 @@ } } }, - "/api/v1/Edge/relation/{name}": { + "/api/v1/Dashboard/netApps": { "get": { "tags": [ - "Edge" + "Dashboard" ], - "operationId": "EdgeGetRelationByName", "parameters": [ { - "name": "id", + "name": "PageNumber", "in": "query", "schema": { - "type": "string", - "format": "uuid" + "type": "integer", + "format": "int32" } }, { - "name": "name", - "in": "path", - "required": true, + "name": "PageSize", + "in": "query", "schema": { - "type": "string" + "type": "integer", + "format": "int32" } } ], @@ -4496,46 +4559,17 @@ "content": { "text/plain": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RelationModel" - } - } - }, - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RelationModel" - } - } - }, - "text/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RelationModel" - } - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" + "$ref": "#/components/schemas/NetAppsDetailsResponseListPagedResponse" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/ApiResponse" + "$ref": "#/components/schemas/NetAppsDetailsResponseListPagedResponse" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/ApiResponse" + "$ref": "#/components/schemas/NetAppsDetailsResponseListPagedResponse" } } } @@ -4563,35 +4597,26 @@ } } }, - "/api/v1/Edge/relations/{firstName}/{secondName}": { + "/api/v1/Dashboard/robots": { "get": { "tags": [ - "Edge" + "Dashboard" ], - "operationId": "EdgeGetRelationsByName", "parameters": [ { - "name": "id", + "name": "PageNumber", "in": "query", "schema": { - "type": "string", - "format": "uuid" + "type": "integer", + "format": "int32" } }, { - "name": "firstName", - "in": "path", - "required": true, + "name": "PageSize", + "in": "query", "schema": { - "type": "string" - } - }, - { - "name": "secondName", - "in": "path", - "required": true, - "schema": { - "type": "string" + "type": "integer", + "format": "int32" } } ], @@ -4601,32 +4626,23 @@ "content": { "text/plain": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RelationModel" - } + "$ref": "#/components/schemas/RobotResponseListPagedResponse" } }, "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RelationModel" - } + "$ref": "#/components/schemas/RobotResponseListPagedResponse" } }, "text/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RelationModel" - } + "$ref": "#/components/schemas/RobotResponseListPagedResponse" } } } }, - "404": { - "description": "Not Found", + "500": { + "description": "Server Error", "content": { "text/plain": { "schema": { @@ -4644,6 +4660,35 @@ } } } + } + } + } + }, + "/api/v1/Dashboard/graph": { + "get": { + "tags": [ + "Dashboard" + ], + "responses": { + "200": { + "description": "Success", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/GraphResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/GraphResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/GraphResponse" + } + } + } }, "500": { "description": "Server Error", @@ -4668,65 +4713,29 @@ } } }, - "/api/v1/Edge/free": { + "/api/v1/Edge": { "get": { "tags": [ "Edge" ], - "operationId": "GetFreeEdgesIds", - "requestBody": { - "content": { - "application/json-patch+json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/EdgeModel" - } - } - }, - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/EdgeModel" - } - } - }, - "text/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/EdgeModel" - } - } - }, - "application/*+json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/EdgeModel" - } - } - } - } - }, + "operationId": "EdgeGetAll", "responses": { "200": { "description": "Success", "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/GetEdgesResponse" + "$ref": "#/components/schemas/EdgeModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/GetEdgesResponse" + "$ref": "#/components/schemas/EdgeModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/GetEdgesResponse" + "$ref": "#/components/schemas/EdgeModel" } } } @@ -4751,26 +4760,6 @@ } } }, - "400": { - "description": "Bad Request", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" - } - } - } - }, "500": { "description": "Server Error", "content": { @@ -4792,46 +4781,32 @@ } } } - } - }, - "/api/v1/Edge/lessBusy": { - "get": { + }, + "post": { "tags": [ "Edge" ], - "operationId": "GetLessBusyEdges", + "operationId": "EdgeAdd", "requestBody": { "content": { "application/json-patch+json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/EdgeModel" - } + "$ref": "#/components/schemas/EdgeModel" } }, "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/EdgeModel" - } + "$ref": "#/components/schemas/EdgeModel" } }, "text/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/EdgeModel" - } + "$ref": "#/components/schemas/EdgeModel" } }, "application/*+json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/EdgeModel" - } + "$ref": "#/components/schemas/EdgeModel" } } } @@ -4842,37 +4817,17 @@ "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/GetEdgesResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/GetEdgesResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/GetEdgesResponse" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" + "$ref": "#/components/schemas/EdgeModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/ApiResponse" + "$ref": "#/components/schemas/EdgeModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/ApiResponse" + "$ref": "#/components/schemas/EdgeModel" } } } @@ -4920,19 +4875,20 @@ } } }, - "/api/v1/Edge/name/{name}": { + "/api/v1/Edge/{id}": { "get": { "tags": [ "Edge" ], - "operationId": "EdgeGetDataByName", + "operationId": "EdgeGetById", "parameters": [ { - "name": "name", + "name": "id", "in": "path", "required": true, "schema": { - "type": "string" + "type": "string", + "format": "uuid" } } ], @@ -4942,17 +4898,17 @@ "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/EdgeResponse" + "$ref": "#/components/schemas/EdgeModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/EdgeResponse" + "$ref": "#/components/schemas/EdgeModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/EdgeResponse" + "$ref": "#/components/schemas/EdgeModel" } } } @@ -4998,49 +4954,64 @@ } } } - } - }, - "/api/v1/Edge/{id}/busy": { - "get": { + }, + "patch": { "tags": [ "Edge" ], - "operationId": "IsBusyEdgeById", + "operationId": "EdgePatch", "parameters": [ - { - "name": "edgeId", - "in": "query", - "schema": { - "type": "string", - "format": "uuid" - } - }, { "name": "id", "in": "path", "required": true, "schema": { - "type": "string" + "type": "string", + "format": "uuid" } } ], + "requestBody": { + "content": { + "application/json-patch+json": { + "schema": { + "$ref": "#/components/schemas/EdgeModel" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/EdgeModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/EdgeModel" + } + }, + "application/*+json": { + "schema": { + "$ref": "#/components/schemas/EdgeModel" + } + } + } + }, "responses": { "200": { "description": "Success", "content": { "text/plain": { "schema": { - "type": "boolean" + "$ref": "#/components/schemas/EdgeModel" } }, "application/json": { "schema": { - "type": "boolean" + "$ref": "#/components/schemas/EdgeModel" } }, "text/json": { "schema": { - "type": "boolean" + "$ref": "#/components/schemas/EdgeModel" } } } @@ -5086,44 +5057,26 @@ } } } - } - }, - "/api/v1/Edge/{name}/busy": { - "get": { + }, + "delete": { "tags": [ "Edge" ], - "operationId": "IsBusyEdgeByName", + "operationId": "EdgeDelete", "parameters": [ { - "name": "name", + "name": "id", "in": "path", "required": true, "schema": { - "type": "string" + "type": "string", + "format": "uuid" } } ], "responses": { "200": { - "description": "Success", - "content": { - "text/plain": { - "schema": { - "type": "boolean" - } - }, - "application/json": { - "schema": { - "type": "boolean" - } - }, - "text/json": { - "schema": { - "type": "boolean" - } - } - } + "description": "Success" }, "404": { "description": "Not Found", @@ -5168,70 +5121,53 @@ } } }, - "/api/v1/Edge/{id}/containers/count": { - "get": { + "/api/v1/Edge/AddRelation": { + "post": { "tags": [ "Edge" ], - "operationId": "GetNumEdgeContainersById", - "parameters": [ - { - "name": "edgeId", - "in": "query", - "schema": { - "type": "string", - "format": "uuid" - } - }, - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "string" + "operationId": "EdgeAddRelation", + "requestBody": { + "content": { + "application/json-patch+json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + }, + "application/*+json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } } } - ], + }, "responses": { "200": { "description": "Success", "content": { "text/plain": { "schema": { - "type": "integer", - "format": "int32" - } - }, - "application/json": { - "schema": { - "type": "integer", - "format": "int32" - } - }, - "text/json": { - "schema": { - "type": "integer", - "format": "int32" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" + "$ref": "#/components/schemas/RelationModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/ApiResponse" + "$ref": "#/components/schemas/RelationModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/ApiResponse" + "$ref": "#/components/schemas/RelationModel" } } } @@ -5279,18 +5215,19 @@ } } }, - "/api/v1/Edge/{name}/containers/count": { + "/api/v1/Edge/relation/{name}": { "get": { "tags": [ "Edge" ], - "operationId": "GetNumEdgeContainersByName", + "operationId": "EdgeGetRelationByName", "parameters": [ { - "name": "edgeName", + "name": "id", "in": "query", "schema": { - "type": "string" + "type": "string", + "format": "uuid" } }, { @@ -5308,20 +5245,26 @@ "content": { "text/plain": { "schema": { - "type": "integer", - "format": "int32" + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } } }, "application/json": { "schema": { - "type": "integer", - "format": "int32" + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } } }, "text/json": { "schema": { - "type": "integer", - "format": "int32" + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } } } } @@ -5346,26 +5289,6 @@ } } }, - "400": { - "description": "Bad Request", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" - } - } - } - }, "500": { "description": "Server Error", "content": { @@ -5389,72 +5312,64 @@ } } }, - "/api/Health": { - "get": { - "tags": [ - "Health" - ], - "operationId": "RedisInterfaceHealthCheck", - "responses": { - "200": { - "description": "Success" - } - } - } - }, - "/api/Health/spec": { + "/api/v1/Edge/relations/{firstName}/{secondName}": { "get": { "tags": [ - "Health" + "Edge" ], - "operationId": "GetRedisInterfaceSpec", - "responses": { - "200": { - "description": "Success", - "content": { - "text/plain": { - "schema": { - "type": "string" - } - }, - "application/json": { - "schema": { - "type": "string" - } - }, - "text/json": { - "schema": { - "type": "string" - } - } + "operationId": "EdgeGetRelationsByName", + "parameters": [ + { + "name": "id", + "in": "query", + "schema": { + "type": "string", + "format": "uuid" + } + }, + { + "name": "firstName", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "secondName", + "in": "path", + "required": true, + "schema": { + "type": "string" } } - } - } - }, - "/api/v1/Instance": { - "get": { - "tags": [ - "Instance" ], - "operationId": "InstanceGetAll", "responses": { "200": { "description": "Success", "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/GetInstancesResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } } }, "application/json": { "schema": { - "$ref": "#/components/schemas/GetInstancesResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } } }, "text/json": { "schema": { - "$ref": "#/components/schemas/GetInstancesResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } } } } @@ -5500,32 +5415,46 @@ } } } - }, - "post": { + } + }, + "/api/v1/Edge/free": { + "get": { "tags": [ - "Instance" + "Edge" ], - "operationId": "InstanceAdd", + "operationId": "GetFreeEdgesIds", "requestBody": { "content": { "application/json-patch+json": { "schema": { - "$ref": "#/components/schemas/InstanceRequest" + "type": "array", + "items": { + "$ref": "#/components/schemas/EdgeModel" + } } }, "application/json": { "schema": { - "$ref": "#/components/schemas/InstanceRequest" + "type": "array", + "items": { + "$ref": "#/components/schemas/EdgeModel" + } } }, "text/json": { "schema": { - "$ref": "#/components/schemas/InstanceRequest" + "type": "array", + "items": { + "$ref": "#/components/schemas/EdgeModel" + } } }, "application/*+json": { "schema": { - "$ref": "#/components/schemas/InstanceRequest" + "type": "array", + "items": { + "$ref": "#/components/schemas/EdgeModel" + } } } } @@ -5536,17 +5465,46 @@ "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/InstanceResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/EdgeModel" + } + } + }, + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/EdgeModel" + } + } + }, + "text/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/EdgeModel" + } + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/InstanceResponse" + "$ref": "#/components/schemas/ApiResponse" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/InstanceResponse" + "$ref": "#/components/schemas/ApiResponse" } } } @@ -5594,40 +5552,74 @@ } } }, - "/api/v1/Instance/{id}": { + "/api/v1/Edge/lessBusy": { "get": { "tags": [ - "Instance" - ], - "operationId": "InstanceGetById", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid" - } - } + "Edge" ], + "operationId": "GetLessBusyEdges", + "requestBody": { + "content": { + "application/json-patch+json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/EdgeModel" + } + } + }, + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/EdgeModel" + } + } + }, + "text/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/EdgeModel" + } + } + }, + "application/*+json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/EdgeModel" + } + } + } + } + }, "responses": { "200": { "description": "Success", "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/InstanceResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/EdgeModel" + } } }, "application/json": { "schema": { - "$ref": "#/components/schemas/InstanceResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/EdgeModel" + } } }, "text/json": { "schema": { - "$ref": "#/components/schemas/InstanceResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/EdgeModel" + } } } } @@ -5652,6 +5644,26 @@ } } }, + "400": { + "description": "Bad Request", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } + }, "500": { "description": "Server Error", "content": { @@ -5673,64 +5685,41 @@ } } } - }, - "put": { + } + }, + "/api/v1/Edge/name/{name}": { + "get": { "tags": [ - "Instance" + "Edge" ], - "operationId": "InstancePatch", + "operationId": "EdgeGetDataByName", "parameters": [ { - "name": "id", + "name": "name", "in": "path", "required": true, "schema": { - "type": "string", - "format": "uuid" + "type": "string" } } ], - "requestBody": { - "content": { - "application/json-patch+json": { - "schema": { - "$ref": "#/components/schemas/InstanceRequest" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/InstanceRequest" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/InstanceRequest" - } - }, - "application/*+json": { - "schema": { - "$ref": "#/components/schemas/InstanceRequest" - } - } - } - }, "responses": { "200": { "description": "Success", "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/InstanceResponse" + "$ref": "#/components/schemas/EdgeModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/InstanceResponse" + "$ref": "#/components/schemas/EdgeModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/InstanceResponse" + "$ref": "#/components/schemas/EdgeModel" } } } @@ -5776,26 +5765,52 @@ } } } - }, - "delete": { + } + }, + "/api/v1/Edge/{id}/busy": { + "get": { "tags": [ - "Instance" + "Edge" ], - "operationId": "InstanceDelete", + "operationId": "isBusyEdgeById", "parameters": [ + { + "name": "edgeId", + "in": "query", + "schema": { + "type": "string", + "format": "uuid" + } + }, { "name": "id", "in": "path", "required": true, "schema": { - "type": "string", - "format": "uuid" + "type": "string" } } ], "responses": { "200": { - "description": "Success" + "description": "Success", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/EdgeModel" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/EdgeModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/EdgeModel" + } + } + } }, "404": { "description": "Not Found", @@ -5840,59 +5855,45 @@ } } }, - "/api/v1/Instance/AddRelation": { - "post": { + "/api/v1/Edge/{name}/busy": { + "get": { "tags": [ - "Instance" + "Edge" ], - "operationId": "InstanceAddRelation", - "requestBody": { - "content": { - "application/json-patch+json": { - "schema": { - "$ref": "#/components/schemas/RelationModel" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/RelationModel" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/RelationModel" - } - }, - "application/*+json": { - "schema": { - "$ref": "#/components/schemas/RelationModel" - } + "operationId": "isBusyEdgeByName", + "parameters": [ + { + "name": "name", + "in": "path", + "required": true, + "schema": { + "type": "string" } } - }, + ], "responses": { "200": { "description": "Success", "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/RelationModel" + "$ref": "#/components/schemas/EdgeModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/RelationModel" + "$ref": "#/components/schemas/EdgeModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/RelationModel" + "$ref": "#/components/schemas/EdgeModel" } } } }, - "400": { - "description": "Bad Request", + "404": { + "description": "Not Found", "content": { "text/plain": { "schema": { @@ -5934,59 +5935,56 @@ } } }, - "/api/v1/Instance/DeleteRelation": { - "delete": { + "/api/v1/Edge/{id}/containers/count": { + "get": { "tags": [ - "Instance" + "Edge" ], - "operationId": "InstanceDeleteRelation", - "requestBody": { - "content": { - "application/json-patch+json": { - "schema": { - "$ref": "#/components/schemas/RelationModel" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/RelationModel" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/RelationModel" - } - }, - "application/*+json": { - "schema": { - "$ref": "#/components/schemas/RelationModel" - } + "operationId": "GetNumEdgeContainersById", + "parameters": [ + { + "name": "edgeId", + "in": "query", + "schema": { + "type": "string", + "format": "uuid" + } + }, + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" } } - }, + ], "responses": { "200": { "description": "Success", "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/RelationModel" + "type": "integer", + "format": "int32" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/RelationModel" + "type": "integer", + "format": "int32" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/RelationModel" + "type": "integer", + "format": "int32" } } } }, - "400": { - "description": "Bad Request", + "404": { + "description": "Not Found", "content": { "text/plain": { "schema": { @@ -6005,8 +6003,8 @@ } } }, - "500": { - "description": "Server Error", + "400": { + "description": "Bad Request", "content": { "text/plain": { "schema": { @@ -6024,23 +6022,42 @@ } } } - } - } - } + }, + "500": { + "description": "Server Error", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } + } + } + } }, - "/api/v1/Instance/relation/{name}": { + "/api/v1/Edge/{name}/containers/count": { "get": { "tags": [ - "Instance" + "Edge" ], - "operationId": "InstanceGetRelationByName", + "operationId": "GetNumEdgeContainersByName", "parameters": [ { - "name": "id", + "name": "cloudName", "in": "query", "schema": { - "type": "string", - "format": "uuid" + "type": "string" } }, { @@ -6058,26 +6075,20 @@ "content": { "text/plain": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RelationModel" - } + "type": "integer", + "format": "int32" } }, "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RelationModel" - } + "type": "integer", + "format": "int32" } }, "text/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RelationModel" - } + "type": "integer", + "format": "int32" } } } @@ -6102,8 +6113,8 @@ } } }, - "500": { - "description": "Server Error", + "400": { + "description": "Bad Request", "content": { "text/plain": { "schema": { @@ -6121,74 +6132,9 @@ } } } - } - } - } - }, - "/api/v1/Instance/relations/{firstName}/{secondName}": { - "get": { - "tags": [ - "Instance" - ], - "operationId": "InstanceGetRelationsByName", - "parameters": [ - { - "name": "id", - "in": "query", - "schema": { - "type": "string", - "format": "uuid" - } - }, - { - "name": "firstName", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "secondName", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "text/plain": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RelationModel" - } - } - }, - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RelationModel" - } - } - }, - "text/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RelationModel" - } - } - } - } }, - "404": { - "description": "Not Found", + "500": { + "description": "Server Error", "content": { "text/plain": { "schema": { @@ -6206,23 +6152,46 @@ } } } - }, - "500": { - "description": "Server Error", + } + } + } + }, + "/api/Health": { + "get": { + "tags": [ + "Health" + ], + "operationId": "RedisInterfaceHealthCheck", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/Health/spec": { + "get": { + "tags": [ + "Health" + ], + "operationId": "GetRedisInterfaceSpec", + "responses": { + "200": { + "description": "Success", "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/ApiResponse" + "type": "string" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/ApiResponse" + "type": "string" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/ApiResponse" + "type": "string" } } } @@ -6230,40 +6199,29 @@ } } }, - "/api/v1/Instance/alternative/{id}": { + "/api/v1/Instance": { "get": { "tags": [ "Instance" ], - "operationId": "InstanceGetAlternative", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid" - } - } - ], + "operationId": "InstanceGetAll", "responses": { "200": { "description": "Success", "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/InstanceResponse" + "$ref": "#/components/schemas/InstanceModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/InstanceResponse" + "$ref": "#/components/schemas/InstanceModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/InstanceResponse" + "$ref": "#/components/schemas/InstanceModel" } } } @@ -6309,34 +6267,32 @@ } } } - } - }, - "/api/v1/Policy": { + }, "post": { "tags": [ - "Policy" + "Instance" ], - "operationId": "PolicyAdd", + "operationId": "InstanceAdd", "requestBody": { "content": { "application/json-patch+json": { "schema": { - "$ref": "#/components/schemas/PolicyRequest" + "$ref": "#/components/schemas/InstanceModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/PolicyRequest" + "$ref": "#/components/schemas/InstanceModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/PolicyRequest" + "$ref": "#/components/schemas/InstanceModel" } }, "application/*+json": { "schema": { - "$ref": "#/components/schemas/PolicyRequest" + "$ref": "#/components/schemas/InstanceModel" } } } @@ -6347,17 +6303,17 @@ "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/PolicyResponse" + "$ref": "#/components/schemas/InstanceModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/PolicyResponse" + "$ref": "#/components/schemas/InstanceModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/PolicyResponse" + "$ref": "#/components/schemas/InstanceModel" } } } @@ -6403,29 +6359,42 @@ } } } - }, + } + }, + "/api/v1/Instance/{id}": { "get": { "tags": [ - "Policy" + "Instance" + ], + "operationId": "InstanceGetById", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } ], - "operationId": "PolicyGetAll", "responses": { "200": { "description": "Success", "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/GetPoliciesResponse" + "$ref": "#/components/schemas/InstanceModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/GetPoliciesResponse" + "$ref": "#/components/schemas/InstanceModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/GetPoliciesResponse" + "$ref": "#/components/schemas/InstanceModel" } } } @@ -6471,14 +6440,12 @@ } } } - } - }, - "/api/v1/Policy/{id}": { - "get": { + }, + "patch": { "tags": [ - "Policy" + "Instance" ], - "operationId": "PolicyGetById", + "operationId": "InstancePatch", "parameters": [ { "name": "id", @@ -6490,23 +6457,47 @@ } } ], + "requestBody": { + "content": { + "application/json-patch+json": { + "schema": { + "$ref": "#/components/schemas/InstanceModel" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/InstanceModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/InstanceModel" + } + }, + "application/*+json": { + "schema": { + "$ref": "#/components/schemas/InstanceModel" + } + } + } + }, "responses": { "200": { "description": "Success", "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/PolicyResponse" + "$ref": "#/components/schemas/InstanceModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/PolicyResponse" + "$ref": "#/components/schemas/InstanceModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/PolicyResponse" + "$ref": "#/components/schemas/InstanceModel" } } } @@ -6553,11 +6544,11 @@ } } }, - "put": { + "delete": { "tags": [ - "Policy" + "Instance" ], - "operationId": "PolicyPatch", + "operationId": "InstanceDelete", "parameters": [ { "name": "id", @@ -6569,50 +6560,9 @@ } } ], - "requestBody": { - "content": { - "application/json-patch+json": { - "schema": { - "$ref": "#/components/schemas/PolicyRequest" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/PolicyRequest" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/PolicyRequest" - } - }, - "application/*+json": { - "schema": { - "$ref": "#/components/schemas/PolicyRequest" - } - } - } - }, "responses": { "200": { - "description": "Success", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/PolicyModel" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/PolicyModel" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/PolicyModel" - } - } - } + "description": "Success" }, "404": { "description": "Not Found", @@ -6657,114 +6607,59 @@ } } }, - "/api/v1/Policy/current": { - "get": { + "/api/v1/Instance/AddRelation": { + "post": { "tags": [ - "Policy" + "Instance" ], - "operationId": "PolicyGetActive", - "responses": { - "200": { - "description": "Success", - "content": { - "text/plain": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ActivePolicy" - } - } - }, - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ActivePolicy" - } - } - }, - "text/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ActivePolicy" - } - } + "operationId": "InstanceAddRelation", + "requestBody": { + "content": { + "application/json-patch+json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" } - } - }, - "404": { - "description": "Not Found", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" - } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" } - } - }, - "500": { - "description": "Server Error", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" - } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + }, + "application/*+json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" } } } - } - } - }, - "/api/v1/Robot": { - "get": { - "tags": [ - "Robot" - ], - "operationId": "RobotGetAll", + }, "responses": { "200": { "description": "Success", "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/GetRobotsResponse" + "$ref": "#/components/schemas/RelationModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/GetRobotsResponse" + "$ref": "#/components/schemas/RelationModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/GetRobotsResponse" + "$ref": "#/components/schemas/RelationModel" } } } }, - "404": { - "description": "Not Found", + "400": { + "description": "Bad Request", "content": { "text/plain": { "schema": { @@ -6804,32 +6699,34 @@ } } } - }, - "post": { + } + }, + "/api/v1/Instance/DeleteRelation": { + "delete": { "tags": [ - "Robot" + "Instance" ], - "operationId": "RobotAdd", + "operationId": "InstanceDeleteRelation", "requestBody": { "content": { "application/json-patch+json": { "schema": { - "$ref": "#/components/schemas/RobotRequest" + "$ref": "#/components/schemas/RelationModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/RobotRequest" + "$ref": "#/components/schemas/RelationModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/RobotRequest" + "$ref": "#/components/schemas/RelationModel" } }, "application/*+json": { "schema": { - "$ref": "#/components/schemas/RobotRequest" + "$ref": "#/components/schemas/RelationModel" } } } @@ -6840,17 +6737,17 @@ "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/RobotResponse" + "$ref": "#/components/schemas/RelationModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/RobotResponse" + "$ref": "#/components/schemas/RelationModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/RobotResponse" + "$ref": "#/components/schemas/RelationModel" } } } @@ -6898,21 +6795,28 @@ } } }, - "/api/v1/Robot/{id}": { + "/api/v1/Instance/relation/{name}": { "get": { "tags": [ - "Robot" + "Instance" ], - "operationId": "RobotGetById", + "operationId": "InstanceGetRelationByName", "parameters": [ { "name": "id", - "in": "path", - "required": true, + "in": "query", "schema": { "type": "string", "format": "uuid" } + }, + { + "name": "name", + "in": "path", + "required": true, + "schema": { + "type": "string" + } } ], "responses": { @@ -6921,17 +6825,26 @@ "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/RobotResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } } }, "application/json": { "schema": { - "$ref": "#/components/schemas/RobotResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } } }, "text/json": { "schema": { - "$ref": "#/components/schemas/RobotResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } } } } @@ -6977,64 +6890,66 @@ } } } - }, - "put": { + } + }, + "/api/v1/Instance/relations/{firstName}/{secondName}": { + "get": { "tags": [ - "Robot" + "Instance" ], - "operationId": "RobotPatch", + "operationId": "InstanceGetRelationsByName", "parameters": [ { "name": "id", - "in": "path", - "required": true, + "in": "query", "schema": { "type": "string", "format": "uuid" } - } - ], - "requestBody": { - "content": { - "application/json-patch+json": { - "schema": { - "$ref": "#/components/schemas/RobotRequest" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/RobotRequest" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/RobotRequest" - } - }, - "application/*+json": { - "schema": { - "$ref": "#/components/schemas/RobotRequest" - } + }, + { + "name": "firstName", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "secondName", + "in": "path", + "required": true, + "schema": { + "type": "string" } } - }, + ], "responses": { "200": { "description": "Success", "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/RobotResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } } }, "application/json": { "schema": { - "$ref": "#/components/schemas/RobotResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } } }, "text/json": { "schema": { - "$ref": "#/components/schemas/RobotResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } } } } @@ -7080,12 +6995,14 @@ } } } - }, - "delete": { + } + }, + "/api/v1/Instance/alternative/{id}": { + "get": { "tags": [ - "Robot" + "Instance" ], - "operationId": "RobotDelete", + "operationId": "InstanceGetAlternative", "parameters": [ { "name": "id", @@ -7099,30 +7016,47 @@ ], "responses": { "200": { - "description": "Success" - }, - "404": { - "description": "Not Found", + "description": "Success", "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/ApiResponse" + "$ref": "#/components/schemas/InstanceModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/ApiResponse" + "$ref": "#/components/schemas/InstanceModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/ApiResponse" + "$ref": "#/components/schemas/InstanceModel" } } } }, - "500": { - "description": "Server Error", + "404": { + "description": "Not Found", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } + }, + "500": { + "description": "Server Error", "content": { "text/plain": { "schema": { @@ -7144,59 +7078,35 @@ } } }, - "/api/v1/Robot/AddRelation": { - "post": { + "/api/v1/InstanceRunning": { + "get": { "tags": [ - "Robot" + "InstanceRunning" ], - "operationId": "RobotAddRelation", - "requestBody": { - "content": { - "application/json-patch+json": { - "schema": { - "$ref": "#/components/schemas/RelationModel" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/RelationModel" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/RelationModel" - } - }, - "application/*+json": { - "schema": { - "$ref": "#/components/schemas/RelationModel" - } - } - } - }, + "operationId": "InstanceRunningGetAll", "responses": { "200": { "description": "Success", "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/RelationModel" + "$ref": "#/components/schemas/InstanceRunningModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/RelationModel" + "$ref": "#/components/schemas/InstanceRunningModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/RelationModel" + "$ref": "#/components/schemas/InstanceRunningModel" } } } }, - "400": { - "description": "Bad Request", + "404": { + "description": "Not Found", "content": { "text/plain": { "schema": { @@ -7236,34 +7146,32 @@ } } } - } - }, - "/api/v1/Robot/DeleteRelation": { - "delete": { + }, + "post": { "tags": [ - "Robot" + "InstanceRunning" ], - "operationId": "RobotDeleteRelation", + "operationId": "InstanceRunningAdd", "requestBody": { "content": { "application/json-patch+json": { "schema": { - "$ref": "#/components/schemas/RelationModel" + "$ref": "#/components/schemas/InstanceRunningModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/RelationModel" + "$ref": "#/components/schemas/InstanceRunningModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/RelationModel" + "$ref": "#/components/schemas/InstanceRunningModel" } }, "application/*+json": { "schema": { - "$ref": "#/components/schemas/RelationModel" + "$ref": "#/components/schemas/InstanceRunningModel" } } } @@ -7274,17 +7182,17 @@ "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/RelationModel" + "$ref": "#/components/schemas/InstanceRunningModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/RelationModel" + "$ref": "#/components/schemas/InstanceRunningModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/RelationModel" + "$ref": "#/components/schemas/InstanceRunningModel" } } } @@ -7332,27 +7240,20 @@ } } }, - "/api/v1/Robot/relation/{name}": { + "/api/v1/InstanceRunning/{id}": { "get": { "tags": [ - "Robot" + "InstanceRunning" ], - "operationId": "RobotGetRelationByName", + "operationId": "InstanceRunningGetById", "parameters": [ { "name": "id", - "in": "query", - "schema": { - "type": "string", - "format": "uuid" - } - }, - { - "name": "name", "in": "path", "required": true, "schema": { - "type": "string" + "type": "string", + "format": "uuid" } } ], @@ -7362,26 +7263,17 @@ "content": { "text/plain": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RelationModel" - } + "$ref": "#/components/schemas/InstanceRunningModel" } }, "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RelationModel" - } + "$ref": "#/components/schemas/InstanceRunningModel" } }, "text/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RelationModel" - } + "$ref": "#/components/schemas/InstanceRunningModel" } } } @@ -7427,66 +7319,64 @@ } } } - } - }, - "/api/v1/Robot/relations/{firstName}/{secondName}": { - "get": { + }, + "patch": { "tags": [ - "Robot" + "InstanceRunning" ], - "operationId": "RobotGetRelationsByName", + "operationId": "InstanceRunningPatch", "parameters": [ { "name": "id", - "in": "query", - "schema": { - "type": "string", - "format": "uuid" - } - }, - { - "name": "firstName", "in": "path", "required": true, "schema": { - "type": "string" - } - }, - { - "name": "secondName", - "in": "path", - "required": true, - "schema": { - "type": "string" + "type": "string", + "format": "uuid" } } ], + "requestBody": { + "content": { + "application/json-patch+json": { + "schema": { + "$ref": "#/components/schemas/InstanceRunningModel" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/InstanceRunningModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/InstanceRunningModel" + } + }, + "application/*+json": { + "schema": { + "$ref": "#/components/schemas/InstanceRunningModel" + } + } + } + }, "responses": { "200": { "description": "Success", "content": { "text/plain": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RelationModel" - } + "$ref": "#/components/schemas/InstanceRunningModel" } }, "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RelationModel" - } + "$ref": "#/components/schemas/InstanceRunningModel" } }, "text/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RelationModel" - } + "$ref": "#/components/schemas/InstanceRunningModel" } } } @@ -7532,17 +7422,15 @@ } } } - } - }, - "/api/v1/Robot/{robotId}/edges/connected": { - "get": { + }, + "delete": { "tags": [ - "Robot" + "InstanceRunning" ], - "operationId": "RobotGetConnectedEdgesIds", + "operationId": "InstanceRunningDelete", "parameters": [ { - "name": "robotId", + "name": "id", "in": "path", "required": true, "schema": { @@ -7553,24 +7441,7 @@ ], "responses": { "200": { - "description": "Success", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/GetEdgesResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/GetEdgesResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/GetEdgesResponse" - } - } - } + "description": "Success" }, "404": { "description": "Not Found", @@ -7592,26 +7463,6 @@ } } }, - "400": { - "description": "Bad Request", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" - } - } - } - }, "500": { "description": "Server Error", "content": { @@ -7635,46 +7486,59 @@ } } }, - "/api/v1/Robot/{robotId}/clouds/connected": { - "get": { + "/api/v1/InstanceRunning/AddRelation": { + "post": { "tags": [ - "Robot" + "InstanceRunning" ], - "operationId": "RobotGetConnectedCloudsIds", - "parameters": [ - { - "name": "robotId", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid" + "operationId": "InstanceRunningAddRelation", + "requestBody": { + "content": { + "application/json-patch+json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + }, + "application/*+json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } } } - ], + }, "responses": { "200": { "description": "Success", "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/GetCloudsResponse" + "$ref": "#/components/schemas/RelationModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/GetCloudsResponse" + "$ref": "#/components/schemas/RelationModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/GetCloudsResponse" + "$ref": "#/components/schemas/RelationModel" } } } }, - "404": { - "description": "Not Found", + "400": { + "description": "Bad Request", "content": { "text/plain": { "schema": { @@ -7693,8 +7557,8 @@ } } }, - "400": { - "description": "Bad Request", + "500": { + "description": "Server Error", "content": { "text/plain": { "schema": { @@ -7712,14 +7576,88 @@ } } } - }, - "500": { - "description": "Server Error", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" - } + } + } + } + }, + "/api/v1/InstanceRunning/DeleteRelation": { + "delete": { + "tags": [ + "InstanceRunning" + ], + "operationId": "InstanceRunningDeleteRelation", + "requestBody": { + "content": { + "application/json-patch+json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + }, + "application/*+json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + } + } + }, + "responses": { + "200": { + "description": "Success", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } + }, + "500": { + "description": "Server Error", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } }, "application/json": { "schema": { @@ -7736,38 +7674,23 @@ } } }, - "/api/v1/Robot/{robotId}/topic": { - "put": { + "/api/v1/InstanceRunning/relation/{name}": { + "get": { "tags": [ - "Robot" + "InstanceRunning" ], - "operationId": "RobotChangeTopicStatus", + "operationId": "InstanceRunningGetRelationByName", "parameters": [ { - "name": "Id", - "in": "path", - "required": true, + "name": "id", + "in": "query", "schema": { "type": "string", "format": "uuid" } }, { - "name": "TopicName", - "in": "query", - "schema": { - "type": "string" - } - }, - { - "name": "Enabled", - "in": "query", - "schema": { - "type": "boolean" - } - }, - { - "name": "robotId", + "name": "name", "in": "path", "required": true, "schema": { @@ -7781,17 +7704,26 @@ "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/UpdateTopicResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } } }, "application/json": { "schema": { - "$ref": "#/components/schemas/UpdateTopicResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } } }, "text/json": { "schema": { - "$ref": "#/components/schemas/UpdateTopicResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } } } } @@ -7816,26 +7748,6 @@ } } }, - "400": { - "description": "Bad Request", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" - } - } - } - }, "500": { "description": "Server Error", "content": { @@ -7859,29 +7771,64 @@ } } }, - "/api/v1/Task": { + "/api/v1/InstanceRunning/relations/{firstName}/{secondName}": { "get": { "tags": [ - "Task" + "InstanceRunning" + ], + "operationId": "InstanceRunningGetRelationsByName", + "parameters": [ + { + "name": "id", + "in": "query", + "schema": { + "type": "string", + "format": "uuid" + } + }, + { + "name": "firstName", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "secondName", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } ], - "operationId": "TaskGetAll", "responses": { "200": { "description": "Success", "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/GetTasksResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } } }, "application/json": { "schema": { - "$ref": "#/components/schemas/GetTasksResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } } }, "text/json": { "schema": { - "$ref": "#/components/schemas/GetTasksResponse" + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } } } } @@ -7927,32 +7874,34 @@ } } } - }, + } + }, + "/api/v1/Policy": { "post": { "tags": [ - "Task" + "Policy" ], - "operationId": "TaskAdd", + "operationId": "PolicyAdd", "requestBody": { "content": { "application/json-patch+json": { "schema": { - "$ref": "#/components/schemas/TaskRequest" + "$ref": "#/components/schemas/PolicyModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/TaskRequest" + "$ref": "#/components/schemas/PolicyModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/TaskRequest" + "$ref": "#/components/schemas/PolicyModel" } }, "application/*+json": { "schema": { - "$ref": "#/components/schemas/TaskRequest" + "$ref": "#/components/schemas/PolicyModel" } } } @@ -7963,17 +7912,17 @@ "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/TaskResponse" + "$ref": "#/components/schemas/PolicyModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/TaskResponse" + "$ref": "#/components/schemas/PolicyModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/TaskResponse" + "$ref": "#/components/schemas/PolicyModel" } } } @@ -8019,42 +7968,29 @@ } } } - } - }, - "/api/v1/Task/{id}": { + }, "get": { "tags": [ - "Task" - ], - "operationId": "TaskGetById", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "format": "uuid" - } - } + "Policy" ], + "operationId": "PolicyGetAll", "responses": { "200": { "description": "Success", "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/TaskResponse" + "$ref": "#/components/schemas/PolicyModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/TaskResponse" + "$ref": "#/components/schemas/PolicyModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/TaskResponse" + "$ref": "#/components/schemas/PolicyModel" } } } @@ -8100,12 +8036,14 @@ } } } - }, - "put": { + } + }, + "/api/v1/Policy/{id}": { + "get": { "tags": [ - "Task" + "Policy" ], - "operationId": "TaskPatch", + "operationId": "PolicyGetById", "parameters": [ { "name": "id", @@ -8117,47 +8055,23 @@ } } ], - "requestBody": { - "content": { - "application/json-patch+json": { - "schema": { - "$ref": "#/components/schemas/TaskRequest" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/TaskRequest" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/TaskRequest" - } - }, - "application/*+json": { - "schema": { - "$ref": "#/components/schemas/TaskRequest" - } - } - } - }, "responses": { "200": { "description": "Success", "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/TaskResponse" + "$ref": "#/components/schemas/PolicyModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/TaskResponse" + "$ref": "#/components/schemas/PolicyModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/TaskResponse" + "$ref": "#/components/schemas/PolicyModel" } } } @@ -8204,11 +8118,11 @@ } } }, - "delete": { + "patch": { "tags": [ - "Task" + "Policy" ], - "operationId": "TaskDelete", + "operationId": "PolicyPatch", "parameters": [ { "name": "id", @@ -8220,79 +8134,26 @@ } } ], - "responses": { - "200": { - "description": "Success" - }, - "404": { - "description": "Not Found", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" - } - } - } - }, - "500": { - "description": "Server Error", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ApiResponse" - } - } - } - } - } - } - }, - "/api/v1/Task/AddRelation": { - "post": { - "tags": [ - "Task" - ], - "operationId": "TaskAddRelation", "requestBody": { "content": { "application/json-patch+json": { "schema": { - "$ref": "#/components/schemas/RelationModel" + "$ref": "#/components/schemas/PolicyModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/RelationModel" + "$ref": "#/components/schemas/PolicyModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/RelationModel" + "$ref": "#/components/schemas/PolicyModel" } }, "application/*+json": { "schema": { - "$ref": "#/components/schemas/RelationModel" + "$ref": "#/components/schemas/PolicyModel" } } } @@ -8303,23 +8164,23 @@ "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/RelationModel" + "$ref": "#/components/schemas/PolicyModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/RelationModel" + "$ref": "#/components/schemas/PolicyModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/RelationModel" + "$ref": "#/components/schemas/PolicyModel" } } } }, - "400": { - "description": "Bad Request", + "404": { + "description": "Not Found", "content": { "text/plain": { "schema": { @@ -8361,30 +8222,12 @@ } } }, - "/api/v1/Task/relation/{name}": { + "/api/v1/Policy/current": { "get": { "tags": [ - "Task" - ], - "operationId": "TaskGetRelationByName", - "parameters": [ - { - "name": "id", - "in": "query", - "schema": { - "type": "string", - "format": "uuid" - } - }, - { - "name": "name", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } + "Policy" ], + "operationId": "PolicyGetActive", "responses": { "200": { "description": "Success", @@ -8393,7 +8236,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/components/schemas/RelationModel" + "$ref": "#/components/schemas/ActivePolicy" } } }, @@ -8401,7 +8244,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/components/schemas/RelationModel" + "$ref": "#/components/schemas/ActivePolicy" } } }, @@ -8409,7 +8252,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/components/schemas/RelationModel" + "$ref": "#/components/schemas/ActivePolicy" } } } @@ -8458,64 +8301,29 @@ } } }, - "/api/v1/Task/relations/{firstName}/{secondName}": { + "/api/v1/Robot": { "get": { "tags": [ - "Task" - ], - "operationId": "TaskGetRelationsByName", - "parameters": [ - { - "name": "id", - "in": "query", - "schema": { - "type": "string", - "format": "uuid" - } - }, - { - "name": "firstName", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "secondName", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } + "Robot" ], + "operationId": "RobotGetAll", "responses": { "200": { "description": "Success", "content": { "text/plain": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RelationModel" - } + "$ref": "#/components/schemas/RobotModel" } }, "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RelationModel" - } + "$ref": "#/components/schemas/RobotModel" } }, "text/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RelationModel" - } + "$ref": "#/components/schemas/RobotModel" } } } @@ -8561,34 +8369,32 @@ } } } - } - }, - "/api/v1/Task/ImportTask": { + }, "post": { "tags": [ - "Task" + "Robot" ], - "operationId": "ImportTaskAsync", + "operationId": "RobotAdd", "requestBody": { "content": { "application/json-patch+json": { "schema": { - "$ref": "#/components/schemas/TaskModel" + "$ref": "#/components/schemas/RobotModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/TaskModel" + "$ref": "#/components/schemas/RobotModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/TaskModel" + "$ref": "#/components/schemas/RobotModel" } }, "application/*+json": { "schema": { - "$ref": "#/components/schemas/TaskModel" + "$ref": "#/components/schemas/RobotModel" } } } @@ -8599,17 +8405,17 @@ "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/TaskModelActionResult" + "$ref": "#/components/schemas/RobotModel" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/TaskModelActionResult" + "$ref": "#/components/schemas/RobotModel" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/TaskModelActionResult" + "$ref": "#/components/schemas/RobotModel" } } } @@ -8656,531 +8462,1789 @@ } } } - } - }, - "components": { - "schemas": { - "ActionModel": { - "type": "object", - "properties": { - "relations": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RelationModel" - }, - "nullable": true - }, - "Id": { - "type": "string", - "format": "uuid" - }, - "Name": { - "type": "string", - "nullable": true - }, - "Tags": { - "type": "array", - "items": { - "type": "string" - }, - "nullable": true - }, - "Order": { - "type": "integer", - "format": "int32" - }, - "Placement": { - "type": "string", - "nullable": true - }, - "PlacementType": { - "type": "string", - "nullable": true - }, - "ActionPriority": { - "type": "string", - "nullable": true - }, - "ActionStatus": { - "type": "string", - "nullable": true + }, + "/api/v1/Robot/{id}": { + "get": { + "tags": [ + "Robot" + ], + "operationId": "RobotGetById", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/RobotModel" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/RobotModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/RobotModel" + } + } + } }, - "Services": { - "type": "array", - "items": { - "$ref": "#/components/schemas/InstanceModel" - }, - "nullable": true + "404": { + "description": "Not Found", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } }, - "MinimumRam": { - "type": "integer", - "format": "int64", - "nullable": true - }, - "MinimumNumCores": { - "type": "integer", - "format": "int32", - "nullable": true + "500": { + "description": "Server Error", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } } - }, - "additionalProperties": false + } }, - "ActionPlanModel": { - "type": "object", - "properties": { - "relations": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RelationModel" + "patch": { + "tags": [ + "Robot" + ], + "operationId": "RobotPatch", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "requestBody": { + "content": { + "application/json-patch+json": { + "schema": { + "$ref": "#/components/schemas/RobotModel" + } }, - "nullable": true - }, - "Id": { - "type": "string", - "format": "uuid" - }, - "TaskId": { - "type": "string", - "format": "uuid" - }, - "Name": { - "type": "string", - "nullable": true - }, - "Status": { - "type": "string", - "nullable": true - }, - "IsReplan": { - "type": "boolean" - }, - "LastStatusChange": { - "type": "string", - "format": "date-time" - }, - "ActionSequence": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ActionModel" + "application/json": { + "schema": { + "$ref": "#/components/schemas/RobotModel" + } }, - "nullable": true - }, - "RobotId": { - "type": "string", - "format": "uuid" - }, - "TaskStartedAt": { - "type": "string", - "format": "date-time" - } - }, - "additionalProperties": false - }, - "ActionRequest": { - "type": "object", - "properties": { - "name": { - "type": "string", - "nullable": true - }, - "priority": { - "type": "string", - "nullable": true - }, - "order": { - "type": "integer", - "format": "int32" - }, - "minimumNumCores": { - "type": "integer", - "format": "int32", - "nullable": true - }, - "minimumRam": { - "type": "integer", - "format": "int64", - "nullable": true - }, - "tags": { - "type": "array", - "items": { - "type": "string" + "text/json": { + "schema": { + "$ref": "#/components/schemas/RobotModel" + } }, - "nullable": true + "application/*+json": { + "schema": { + "$ref": "#/components/schemas/RobotModel" + } + } } }, - "additionalProperties": false - }, - "ActionResponse": { - "type": "object", - "properties": { - "id": { - "type": "string", - "format": "uuid" - }, - "name": { - "type": "string", - "nullable": true - }, - "priority": { - "type": "string", - "nullable": true - }, - "order": { - "type": "integer", - "format": "int32" - }, - "minimumNumCores": { - "type": "integer", - "format": "int32", - "nullable": true + "responses": { + "200": { + "description": "Success", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/RobotModel" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/RobotModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/RobotModel" + } + } + } }, - "minimumRam": { - "type": "integer", - "format": "int64", - "nullable": true + "404": { + "description": "Not Found", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } }, - "tags": { - "type": "array", - "items": { - "type": "string" - }, - "nullable": true + "500": { + "description": "Server Error", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } } - }, - "additionalProperties": false - }, - "ActionResult": { - "type": "object", - "additionalProperties": false + } }, - "ActionSequenceResponse": { - "type": "object", - "properties": { - "taskName": { - "type": "string", - "nullable": true - }, - "taskId": { - "type": "string", - "format": "uuid" - }, - "actions": { - "type": "array", - "items": { - "type": "string" - }, - "nullable": true + "delete": { + "tags": [ + "Robot" + ], + "operationId": "RobotDelete", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } } - }, - "additionalProperties": false - }, - "ActivePolicy": { - "type": "object", - "properties": { - "id": { - "type": "string", - "format": "uuid" + ], + "responses": { + "200": { + "description": "Success" }, - "policyName": { - "type": "string", - "nullable": true + "404": { + "description": "Not Found", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } }, - "policyDescription": { - "type": "string", - "nullable": true + "500": { + "description": "Server Error", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } } - }, - "additionalProperties": false - }, - "ActuatorModel": { - "type": "object", - "properties": { - "name": { - "type": "string", - "nullable": true - }, - "type": { - "type": "string", - "nullable": true - }, - "number": { - "type": "integer", - "format": "int32" - }, - "nodes": { - "type": "array", - "items": { - "type": "string" + } + } + }, + "/api/v1/Robot/AddRelation": { + "post": { + "tags": [ + "Robot" + ], + "operationId": "RobotAddRelation", + "requestBody": { + "content": { + "application/json-patch+json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } }, - "nullable": true + "application/json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + }, + "application/*+json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + } } }, - "additionalProperties": false - }, - "ApiResponse": { - "type": "object", - "properties": { - "statusCode": { - "type": "integer", - "format": "int32", - "readOnly": true - }, - "message": { - "type": "string", - "nullable": true, - "readOnly": true + "responses": { + "200": { + "description": "Success", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + } + } }, - "timeStamp": { - "type": "string", - "format": "date-time", - "readOnly": true + "400": { + "description": "Bad Request", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } }, - "isError": { - "type": "boolean", - "readOnly": true + "500": { + "description": "Server Error", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } } - }, - "additionalProperties": false - }, - "CloudModel": { - "type": "object", - "properties": { - "relations": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RelationModel" + } + } + }, + "/api/v1/Robot/DeleteRelation": { + "delete": { + "tags": [ + "Robot" + ], + "operationId": "RobotDeleteRelation", + "requestBody": { + "content": { + "application/json-patch+json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } }, - "nullable": true - }, - "Id": { - "type": "string", - "format": "uuid" + "application/json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + }, + "application/*+json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + } + } + }, + "responses": { + "200": { + "description": "Success", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + } + } }, - "Name": { - "type": "string", - "nullable": true - }, - "Type": { - "type": "string", - "nullable": true, - "deprecated": true + "400": { + "description": "Bad Request", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } }, - "CloudStatus": { - "type": "string", - "nullable": true + "500": { + "description": "Server Error", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } + } + } + } + }, + "/api/v1/Robot/relation/{name}": { + "get": { + "tags": [ + "Robot" + ], + "operationId": "RobotGetRelationByName", + "parameters": [ + { + "name": "id", + "in": "query", + "schema": { + "type": "string", + "format": "uuid" + } }, - "CloudIp": { - "type": "string", - "format": "uri", - "nullable": true + { + "name": "name", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "text/plain": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } + } + }, + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } + } + }, + "text/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } + } + } + } }, - "NumberOfCores": { - "type": "integer", - "format": "int32", - "nullable": true + "404": { + "description": "Not Found", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } }, - "DiskStorage": { - "type": "integer", - "format": "int64", - "nullable": true + "500": { + "description": "Server Error", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } + } + } + } + }, + "/api/v1/Robot/relations/{firstName}/{secondName}": { + "get": { + "tags": [ + "Robot" + ], + "operationId": "RobotGetRelationsByName", + "parameters": [ + { + "name": "id", + "in": "query", + "schema": { + "type": "string", + "format": "uuid" + } }, - "VirtualRam": { - "type": "integer", - "format": "int64", - "nullable": true + { + "name": "firstName", + "in": "path", + "required": true, + "schema": { + "type": "string" + } }, - "CPU": { - "type": "integer", - "format": "int32", - "nullable": true + { + "name": "secondName", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "text/plain": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } + } + }, + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } + } + }, + "text/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } + } + } + } }, - "RAM": { - "type": "integer", - "format": "int64", - "nullable": true + "404": { + "description": "Not Found", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } }, - "MacAddress": { - "type": "string", - "nullable": true + "500": { + "description": "Server Error", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } + } + } + } + }, + "/api/v1/Robot/{robotId}/edges/connected": { + "get": { + "tags": [ + "Robot" + ], + "operationId": "RobotGetConnectedEdgesIds", + "parameters": [ + { + "name": "robotId", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "text/plain": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/EdgeModel" + } + } + }, + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/EdgeModel" + } + } + }, + "text/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/EdgeModel" + } + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } + }, + "500": { + "description": "Server Error", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } + } + } + } + }, + "/api/v1/Robot/{robotId}/clouds/connected": { + "get": { + "tags": [ + "Robot" + ], + "operationId": "RobotGetConnectedCloudsIds", + "parameters": [ + { + "name": "robotId", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "text/plain": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CloudModel" + } + } + }, + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CloudModel" + } + } + }, + "text/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CloudModel" + } + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } + }, + "500": { + "description": "Server Error", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } + } + } + } + }, + "/api/v1/Robot/{robotId}/topic": { + "get": { + "tags": [ + "Robot" + ], + "operationId": "RobotChangeTopicStatus", + "parameters": [ + { + "name": "robotId", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + }, + { + "name": "topicName", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "topicEnabled", + "in": "query", + "schema": { + "type": "boolean" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/RosTopicModel" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/RosTopicModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/RosTopicModel" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } + }, + "500": { + "description": "Server Error", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } + } + } + } + }, + "/api/v1/Task": { + "get": { + "tags": [ + "Task" + ], + "operationId": "TaskGetAll", + "responses": { + "200": { + "description": "Success", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/TaskModel" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/TaskModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/TaskModel" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } + }, + "500": { + "description": "Server Error", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } + } + } + }, + "post": { + "tags": [ + "Task" + ], + "operationId": "TaskAdd", + "requestBody": { + "content": { + "application/json-patch+json": { + "schema": { + "$ref": "#/components/schemas/TaskModel" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/TaskModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/TaskModel" + } + }, + "application/*+json": { + "schema": { + "$ref": "#/components/schemas/TaskModel" + } + } + } + }, + "responses": { + "200": { + "description": "Success", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/TaskModel" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/TaskModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/TaskModel" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } + }, + "500": { + "description": "Server Error", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } + } + } + } + }, + "/api/v1/Task/{id}": { + "get": { + "tags": [ + "Task" + ], + "operationId": "TaskGetById", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/TaskModel" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/TaskModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/TaskModel" + } + } + } }, - "LastUpdatedTime": { - "type": "string", - "format": "date-time" + "404": { + "description": "Not Found", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } }, - "IsOnline": { - "type": "boolean" + "500": { + "description": "Server Error", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } } - }, - "additionalProperties": false + } }, - "CloudRequest": { - "type": "object", - "properties": { - "name": { - "type": "string", - "nullable": true - }, - "type": { - "type": "string", - "nullable": true - }, - "status": { - "type": "string", - "nullable": true - }, - "ipAddress": { - "type": "string", - "format": "uri", - "nullable": true - }, - "cpu": { - "type": "integer", - "format": "int32", - "nullable": true - }, - "numberOfCores": { - "type": "integer", - "format": "int32", - "nullable": true + "patch": { + "tags": [ + "Task" + ], + "operationId": "TaskPatch", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "requestBody": { + "content": { + "application/json-patch+json": { + "schema": { + "$ref": "#/components/schemas/TaskModel" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/TaskModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/TaskModel" + } + }, + "application/*+json": { + "schema": { + "$ref": "#/components/schemas/TaskModel" + } + } + } + }, + "responses": { + "200": { + "description": "Success", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/TaskModel" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/TaskModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/TaskModel" + } + } + } }, - "diskStorage": { - "type": "integer", - "format": "int64", - "nullable": true + "404": { + "description": "Not Found", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } }, - "ram": { - "type": "integer", - "format": "int64", - "nullable": true + "500": { + "description": "Server Error", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } + } + } + }, + "delete": { + "tags": [ + "Task" + ], + "operationId": "TaskDelete", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "responses": { + "200": { + "description": "Success" }, - "virtualRam": { - "type": "integer", - "format": "int64", - "nullable": true + "404": { + "description": "Not Found", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } }, - "macAddress": { - "type": "string", - "nullable": true + "500": { + "description": "Server Error", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } + } + } + } + }, + "/api/v1/Task/AddRelation": { + "post": { + "tags": [ + "Task" + ], + "operationId": "TaskAddRelation", + "requestBody": { + "content": { + "application/json-patch+json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + }, + "application/*+json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + } } }, - "additionalProperties": false - }, - "CloudResponse": { - "type": "object", - "properties": { - "id": { - "type": "string", - "format": "uuid" - }, - "name": { - "type": "string", - "nullable": true - }, - "type": { - "type": "string", - "nullable": true + "responses": { + "200": { + "description": "Success", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/RelationModel" + } + } + } }, - "status": { - "type": "string", - "nullable": true + "400": { + "description": "Bad Request", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } }, - "ipAddress": { - "type": "string", - "format": "uri", - "nullable": true + "500": { + "description": "Server Error", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } + } + } + } + }, + "/api/v1/Task/relation/{name}": { + "get": { + "tags": [ + "Task" + ], + "operationId": "TaskGetRelationByName", + "parameters": [ + { + "name": "id", + "in": "query", + "schema": { + "type": "string", + "format": "uuid" + } }, - "cpu": { - "type": "integer", - "format": "int32", - "nullable": true + { + "name": "name", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "text/plain": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } + } + }, + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } + } + }, + "text/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } + } + } + } }, - "numberOfCores": { - "type": "integer", - "format": "int32", - "nullable": true + "404": { + "description": "Not Found", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } }, - "diskStorage": { - "type": "integer", - "format": "int64", - "nullable": true + "500": { + "description": "Server Error", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } + } + } + } + }, + "/api/v1/Task/relations/{firstName}/{secondName}": { + "get": { + "tags": [ + "Task" + ], + "operationId": "TaskGetRelationsByName", + "parameters": [ + { + "name": "id", + "in": "query", + "schema": { + "type": "string", + "format": "uuid" + } }, - "ram": { - "type": "integer", - "format": "int64", - "nullable": true + { + "name": "firstName", + "in": "path", + "required": true, + "schema": { + "type": "string" + } }, - "virtualRam": { - "type": "integer", - "format": "int64", - "nullable": true + { + "name": "secondName", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "text/plain": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } + } + }, + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } + } + }, + "text/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + } + } + } + } }, - "macAddress": { - "type": "string", - "nullable": true + "404": { + "description": "Not Found", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } }, - "lastUpdatedTime": { - "type": "string", - "format": "date-time" + "500": { + "description": "Server Error", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } + } + } + } + }, + "/api/v1/Task/ImportTask": { + "post": { + "tags": [ + "Task" + ], + "operationId": "ImportTaskAsync", + "requestBody": { + "content": { + "application/json-patch+json": { + "schema": { + "$ref": "#/components/schemas/TaskModel" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/TaskModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/TaskModel" + } + }, + "application/*+json": { + "schema": { + "$ref": "#/components/schemas/TaskModel" + } + } } }, - "additionalProperties": false - }, - "ContainerRequest": { - "type": "object", - "properties": { - "name": { - "type": "string", - "nullable": true - }, - "description": { - "type": "string", - "nullable": true + "responses": { + "200": { + "description": "Success", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/TaskModelActionResult" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/TaskModelActionResult" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/TaskModelActionResult" + } + } + } }, - "k8SDeployment": { - "type": "string", - "nullable": true + "400": { + "description": "Bad Request", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } }, - "k8SService": { - "type": "string", - "nullable": true + "500": { + "description": "Server Error", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ApiResponse" + } + } + } } - }, - "additionalProperties": false - }, - "ContainerResponse": { + } + } + } + }, + "components": { + "schemas": { + "ActionModel": { "type": "object", "properties": { - "id": { - "type": "string", - "format": "uuid" - }, - "name": { - "type": "string", - "nullable": true - }, - "lastUpdateTime": { - "type": "string", - "format": "date-time" - }, - "description": { - "type": "string", - "nullable": true - }, - "k8sDeployment": { - "type": "string", + "relations": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + }, "nullable": true }, - "k8sService": { - "type": "string", - "nullable": true - } - }, - "additionalProperties": false - }, - "DashboardRobotResponse": { - "type": "object", - "properties": { "Id": { "type": "string", "format": "uuid" @@ -9189,94 +10253,52 @@ "type": "string", "nullable": true }, - "Status": { - "type": "string", - "nullable": true - }, - "OnboardedTime": { - "type": "string", - "format": "date-time", + "Tags": { + "type": "array", + "items": { + "type": "string" + }, "nullable": true }, - "rosVersion": { + "Order": { "type": "integer", "format": "int32" }, - "rosDistro": { + "Placement": { "type": "string", "nullable": true }, - "manufacturer": { + "PlacementType": { "type": "string", "nullable": true - } - }, - "additionalProperties": false - }, - "DashboardRobotResponseListPagedResponse": { - "type": "object", - "properties": { - "statusCode": { - "type": "integer", - "format": "int32", - "readOnly": true }, - "message": { + "ActionPriority": { "type": "string", - "nullable": true, - "readOnly": true + "nullable": true }, - "timeStamp": { + "ActionStatus": { "type": "string", - "format": "date-time", - "readOnly": true - }, - "isError": { - "type": "boolean", - "readOnly": true + "nullable": true }, - "data": { + "Services": { "type": "array", "items": { - "$ref": "#/components/schemas/DashboardRobotResponse" + "$ref": "#/components/schemas/InstanceModel" }, "nullable": true }, - "pageNumber": { - "type": "integer", - "format": "int32" - }, - "pageSize": { - "type": "integer", - "format": "int32" - }, - "firstPage": { - "type": "integer", - "format": "int32" - }, - "lastPage": { - "type": "string", - "format": "uri", - "nullable": true - }, - "totalPages": { + "MinimumRam": { "type": "integer", "format": "int32" }, - "nextPage": { - "type": "string", - "format": "uri", - "nullable": true - }, - "previousPage": { - "type": "string", - "format": "uri", - "nullable": true + "MinimumNumCores": { + "type": "integer", + "format": "int32" } }, "additionalProperties": false }, - "DialogueModel": { + "ActionPlanModel": { "type": "object", "properties": { "relations": { @@ -9290,24 +10312,48 @@ "type": "string", "format": "uuid" }, + "TaskId": { + "type": "string", + "format": "uuid" + }, "Name": { "type": "string", "nullable": true }, - "IsSingleAnswer": { + "Status": { + "type": "string", + "nullable": true + }, + "IsReplan": { "type": "boolean" }, - "Answer": { + "LastStatusChange": { + "type": "string", + "format": "date-time" + }, + "ActionSequence": { "type": "array", "items": { - "$ref": "#/components/schemas/KeyValuePair" + "$ref": "#/components/schemas/ActionModel" }, "nullable": true + }, + "RobotId": { + "type": "string", + "format": "uuid" + }, + "TaskStartedAt": { + "type": "string", + "format": "date-time" } }, "additionalProperties": false }, - "EdgeModel": { + "ActionResult": { + "type": "object", + "additionalProperties": false + }, + "ActionRunningModel": { "type": "object", "properties": { "relations": { @@ -9321,267 +10367,348 @@ "type": "string", "format": "uuid" }, - "Name": { + "ActionParentId": { "type": "string", - "nullable": true + "format": "uuid" }, - "Type": { + "ActionPlanId": { "type": "string", - "nullable": true, - "deprecated": true + "format": "uuid" }, - "EdgeStatus": { + "Name": { "type": "string", "nullable": true }, - "EdgeIp": { + "Tags": { + "type": "array", + "items": { + "type": "string" + }, + "nullable": true + }, + "Order": { + "type": "integer", + "format": "int32" + }, + "Placement": { "type": "string", - "format": "uri", "nullable": true }, - "MacAddress": { + "PlacementType": { "type": "string", "nullable": true }, - "CPU": { - "type": "integer", - "format": "int32", + "ActionPriority": { + "type": "string", "nullable": true }, - "RAM": { - "type": "integer", - "format": "int64", + "ActionStatus": { + "type": "string", "nullable": true }, - "VirtualRam": { - "type": "integer", - "format": "int64", + "Services": { + "type": "array", + "items": { + "$ref": "#/components/schemas/InstanceRunningModel" + }, "nullable": true }, - "DiskStorage": { + "MinimumRam": { "type": "integer", - "format": "int64", - "nullable": true + "format": "int32" }, - "NumberOfCores": { + "MinimumNumCores": { "type": "integer", - "format": "int32", + "format": "int32" + } + }, + "additionalProperties": false + }, + "ActionSequenceResponse": { + "type": "object", + "properties": { + "taskName": { + "type": "string", "nullable": true }, - "LastUpdatedTime": { + "taskId": { "type": "string", - "format": "date-time" + "format": "uuid" }, - "IsOnline": { - "type": "boolean" + "actions": { + "type": "array", + "items": { + "type": "string" + }, + "nullable": true } }, "additionalProperties": false }, - "EdgeRequest": { + "ActivePolicy": { "type": "object", "properties": { - "name": { + "id": { "type": "string", - "nullable": true + "format": "uuid" }, - "status": { + "policyName": { "type": "string", "nullable": true }, - "ipAddress": { + "policyDescription": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "ActuatorModel": { + "type": "object", + "properties": { + "name": { "type": "string", - "format": "uri", "nullable": true }, - "macAddress": { + "type": { "type": "string", "nullable": true }, - "cpu": { + "number": { "type": "integer", - "format": "int32", - "nullable": true + "format": "int32" }, - "numberOfCores": { + "nodes": { + "type": "array", + "items": { + "type": "string" + }, + "nullable": true + } + }, + "additionalProperties": false + }, + "ApiResponse": { + "type": "object", + "properties": { + "statusCode": { "type": "integer", "format": "int32", - "nullable": true + "readOnly": true }, - "ram": { - "type": "integer", - "format": "int64", - "nullable": true + "message": { + "type": "string", + "nullable": true, + "readOnly": true }, - "virtualRam": { - "type": "integer", - "format": "int64", - "nullable": true + "timeStamp": { + "type": "string", + "format": "date-time", + "readOnly": true }, - "diskStorage": { - "type": "integer", - "format": "int64", - "nullable": true + "isError": { + "type": "boolean", + "readOnly": true } }, "additionalProperties": false }, - "EdgeResponse": { + "CloudModel": { "type": "object", "properties": { - "id": { + "relations": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + }, + "nullable": true + }, + "Id": { "type": "string", "format": "uuid" }, - "name": { + "Name": { "type": "string", "nullable": true }, - "status": { + "Type": { "type": "string", "nullable": true }, - "ipAddress": { + "CloudStatus": { "type": "string", - "format": "uri", "nullable": true }, - "macAddress": { + "CloudIp": { "type": "string", + "format": "uri", "nullable": true }, - "cpu": { + "NumberOfCores": { "type": "integer", - "format": "int32", - "nullable": true + "format": "int32" }, - "numberOfCores": { + "DiskStorage": { "type": "integer", - "format": "int32", - "nullable": true + "format": "int64" }, - "ram": { + "VirtualRam": { "type": "integer", "format": "int64", "nullable": true }, - "virtualRam": { + "CPU": { "type": "integer", - "format": "int64", - "nullable": true + "format": "int32" }, - "diskStorage": { + "RAM": { "type": "integer", - "format": "int64", + "format": "int64" + }, + "MacAddress": { + "type": "string", "nullable": true }, - "lastUpdatedTime": { + "LastUpdatedTime": { "type": "string", "format": "date-time" + }, + "IsOnline": { + "type": "boolean" } }, "additionalProperties": false }, - "GetActionsResponse": { + "ContainerImageModel": { "type": "object", "properties": { - "actions": { + "relations": { "type": "array", "items": { - "$ref": "#/components/schemas/ActionResponse" + "$ref": "#/components/schemas/RelationModel" }, "nullable": true - } - }, - "additionalProperties": false - }, - "GetCloudsResponse": { - "type": "object", - "properties": { - "clouds": { - "type": "array", - "items": { - "$ref": "#/components/schemas/CloudResponse" - }, + }, + "Id": { + "type": "string", + "format": "uuid" + }, + "Name": { + "type": "string", "nullable": true - } - }, - "additionalProperties": false - }, - "GetContainersResponse": { - "type": "object", - "properties": { - "containers": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ContainerResponse" - }, + }, + "Timestamp": { + "type": "string", + "format": "date-time" + }, + "Description": { + "type": "string", + "nullable": true + }, + "K8SDeployment": { + "type": "string", "nullable": true - } - }, - "additionalProperties": false - }, - "GetEdgesResponse": { - "type": "object", - "properties": { - "edges": { - "type": "array", - "items": { - "$ref": "#/components/schemas/EdgeResponse" - }, + }, + "K8SService": { + "type": "string", "nullable": true } }, "additionalProperties": false }, - "GetInstancesResponse": { + "DialogueModel": { "type": "object", "properties": { - "instances": { + "relations": { "type": "array", "items": { - "$ref": "#/components/schemas/InstanceResponse" + "$ref": "#/components/schemas/RelationModel" }, "nullable": true - } - }, - "additionalProperties": false - }, - "GetPoliciesResponse": { - "type": "object", - "properties": { - "policies": { - "type": "array", - "items": { - "$ref": "#/components/schemas/PolicyResponse" - }, + }, + "Id": { + "type": "string", + "format": "uuid" + }, + "Name": { + "type": "string", "nullable": true - } - }, - "additionalProperties": false - }, - "GetRobotsResponse": { - "type": "object", - "properties": { - "robots": { + }, + "IsSingleAnswer": { + "type": "boolean" + }, + "Answer": { "type": "array", "items": { - "$ref": "#/components/schemas/RobotResponse" + "$ref": "#/components/schemas/KeyValuePair" }, "nullable": true } }, "additionalProperties": false }, - "GetTasksResponse": { + "EdgeModel": { "type": "object", "properties": { - "tasks": { + "relations": { "type": "array", "items": { - "$ref": "#/components/schemas/TaskResponse" + "$ref": "#/components/schemas/RelationModel" }, "nullable": true + }, + "Id": { + "type": "string", + "format": "uuid" + }, + "Name": { + "type": "string", + "nullable": true + }, + "Type": { + "type": "string", + "nullable": true + }, + "EdgeStatus": { + "type": "string", + "nullable": true + }, + "EdgeIp": { + "type": "string", + "format": "uri", + "nullable": true + }, + "MacAddress": { + "type": "string", + "nullable": true + }, + "CPU": { + "type": "integer", + "format": "int32" + }, + "RAM": { + "type": "integer", + "format": "int64" + }, + "VirtualRam": { + "type": "integer", + "format": "int64", + "nullable": true + }, + "DiskStorage": { + "type": "integer", + "format": "int64" + }, + "NumberOfCores": { + "type": "integer", + "format": "int32" + }, + "LastUpdatedTime": { + "type": "string", + "format": "date-time" + }, + "IsOnline": { + "type": "boolean" } }, "additionalProperties": false @@ -9705,13 +10832,11 @@ }, "MinimumRam": { "type": "integer", - "format": "int64", - "nullable": true + "format": "int32" }, "MinimumNumCores": { "type": "integer", - "format": "int32", - "nullable": true + "format": "int32" }, "OnboardedTime": { "type": "string", @@ -9720,131 +10845,43 @@ }, "additionalProperties": false }, - "InstanceRequest": { + "InstanceRunningModel": { "type": "object", "properties": { - "name": { - "type": "string", - "nullable": true - }, - "type": { - "type": "string", - "nullable": true - }, - "isReusable": { - "type": "boolean" - }, - "rosTopicPublishers": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RosTopicModel" - }, - "nullable": true - }, - "rosTopicSubscribers": { + "relations": { "type": "array", "items": { - "$ref": "#/components/schemas/RosTopicModel" + "$ref": "#/components/schemas/RelationModel" }, "nullable": true }, - "rosVersion": { - "type": "integer", - "format": "int32" - }, - "rosDistro": { + "Id": { "type": "string", - "nullable": true + "format": "uuid" }, - "family": { + "Name": { "type": "string", "nullable": true }, - "minimumRam": { - "type": "integer", - "format": "int32", - "nullable": true - }, - "minimumNumOfCores": { - "type": "integer", - "format": "int32", - "nullable": true - }, - "tags": { - "type": "array", - "items": { - "type": "string" - }, - "nullable": true - } - }, - "additionalProperties": false - }, - "InstanceResponse": { - "type": "object", - "properties": { - "id": { + "ServiceInstanceId": { "type": "string", "format": "uuid" }, - "name": { - "type": "string", - "nullable": true - }, - "type": { + "ServiceType": { "type": "string", "nullable": true }, - "isReusable": { - "type": "boolean", - "nullable": true - }, - "rosTopicPublishers": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RosTopicModel" - }, - "nullable": true - }, - "rosTopicSubscribers": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RosTopicModel" - }, - "nullable": true - }, - "rosVersion": { - "type": "integer", - "format": "int32" - }, - "rosDistro": { + "ServiceUrl": { "type": "string", "nullable": true }, - "family": { + "ServiceStatus": { "type": "string", "nullable": true }, - "minimumRam": { - "type": "integer", - "format": "int64", - "nullable": true - }, - "minimumNumOfCores": { - "type": "integer", - "format": "int32", - "nullable": true - }, - "onboardedTime": { + "DeployedTime": { "type": "string", "format": "date-time" - }, - "tags": { - "type": "array", - "items": { - "type": "string" - }, - "nullable": true } }, "additionalProperties": false @@ -9968,10 +11005,6 @@ "number": { "type": "integer", "format": "int32" - }, - "type": { - "type": "string", - "nullable": true } }, "additionalProperties": false @@ -10088,82 +11121,21 @@ "type": "string", "nullable": true }, - "Timestamp": { - "type": "string", - "format": "date-time" - }, - "IsActive": { - "type": "boolean" - }, - "Description": { - "type": "string", - "nullable": true - }, - "IsExclusiveWithinType": { - "type": "integer", - "format": "int32" - } - }, - "additionalProperties": false - }, - "PolicyRequest": { - "type": "object", - "properties": { - "name": { - "type": "string", - "nullable": true - }, - "type": { - "type": "string", - "nullable": true - }, - "isActive": { - "type": "boolean" - }, - "description": { - "type": "string", - "nullable": true - }, - "isExclusiveWithinType": { - "type": "integer", - "format": "int32" - }, - "lastTimeUpdated": { - "type": "string", - "format": "date-time" - } - }, - "additionalProperties": false - }, - "PolicyResponse": { - "type": "object", - "properties": { - "id": { - "type": "string", - "format": "uuid" - }, - "name": { - "type": "string", - "nullable": true - }, - "type": { + "Timestamp": { "type": "string", - "nullable": true + "format": "date-time" }, - "isActive": { - "type": "boolean" + "IsActive": { + "type": "boolean", + "nullable": true }, - "description": { + "Description": { "type": "string", "nullable": true }, - "isExclusiveWithinType": { + "IsExclusiveWithinType": { "type": "integer", "format": "int32" - }, - "lastTimeUpdated": { - "type": "string", - "format": "date-time" } }, "additionalProperties": false @@ -10236,133 +11208,155 @@ }, "additionalProperties": false }, - "RobotRequest": { + "RobotModel": { "type": "object", "properties": { - "name": { - "type": "string", + "relations": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RelationModel" + }, "nullable": true }, - "modelName": { + "Id": { "type": "string", - "nullable": true + "format": "uuid" }, - "status": { + "Name": { "type": "string", "nullable": true }, - "batteryStatus": { - "type": "integer", - "format": "int32" - }, - "rosVersion": { + "RosVersion": { "type": "integer", "format": "int32" }, - "rosDistro": { + "RosDistro": { "type": "string", "nullable": true }, - "maximumPayload": { + "MaximumPayload": { "type": "integer", - "format": "int64", - "nullable": true + "format": "int64" }, - "maximumTranslationalVelocity": { + "MaximumTranslationalVelocity": { "type": "integer", - "format": "int64", - "nullable": true + "format": "int64" }, - "maximumRotationalVelocity": { + "MaximumRotationalVelocity": { "type": "integer", - "format": "int64", - "nullable": true + "format": "int64" }, - "robotWeight": { + "RobotWeight": { "type": "integer", - "format": "int64", - "nullable": true + "format": "int64" }, - "rosRepo": { + "ROSRepo": { "type": "string", "format": "uri", "nullable": true }, - "rosNodes": { + "ROSNodes": { "type": "array", "items": { "$ref": "#/components/schemas/ROSNodeModel" }, "nullable": true }, - "manufacturer": { + "Manufacturer": { "type": "string", "nullable": true }, - "manufacturerUrl": { + "ManufacturerUrl": { "type": "string", "format": "uri", "nullable": true }, - "macAddress": { + "RobotModelName": { + "type": "string", + "nullable": true + }, + "RobotStatus": { + "type": "string", + "nullable": true + }, + "currentTaskId": { + "type": "string", + "format": "uuid" + }, + "TaskList": { + "type": "array", + "items": { + "type": "string" + }, + "nullable": true + }, + "BatteryStatus": { + "type": "integer", + "format": "int64" + }, + "MacAddress": { "type": "string", "nullable": true }, - "locomotionSystem": { + "LocomotionSystem": { "type": "string", "nullable": true }, - "locomotionType": { + "LocomotionTypes": { "type": "string", "nullable": true }, - "sensors": { + "Sensors": { "type": "array", "items": { "$ref": "#/components/schemas/SensorModel" }, "nullable": true }, - "actuators": { + "Actuators": { "type": "array", "items": { "$ref": "#/components/schemas/ActuatorModel" }, "nullable": true }, - "manipulators": { + "Manipulators": { "type": "array", "items": { "$ref": "#/components/schemas/ManipulatorModel" }, "nullable": true }, - "cpu": { + "CPU": { "type": "integer", - "format": "int32", - "nullable": true + "format": "int32" }, - "numberOfCores": { + "RAM": { "type": "integer", - "format": "int32", - "nullable": true + "format": "int64" }, - "ram": { + "StorageDisk": { "type": "integer", - "format": "int64", - "nullable": true + "format": "int64" }, - "storageDisk": { + "NumberCores": { "type": "integer", - "format": "int64", - "nullable": true + "format": "int32" }, - "questions": { + "Questions": { "type": "array", "items": { "$ref": "#/components/schemas/DialogueModel" }, "nullable": true + }, + "LastUpdatedTime": { + "type": "string", + "format": "date-time" + }, + "OnboardedTime": { + "type": "string", + "format": "date-time" } }, "additionalProperties": false @@ -10370,26 +11364,23 @@ "RobotResponse": { "type": "object", "properties": { - "id": { + "Id": { "type": "string", "format": "uuid" }, - "name": { + "Name": { "type": "string", "nullable": true }, - "modelName": { + "Status": { "type": "string", "nullable": true }, - "status": { + "OnboardedTime": { "type": "string", + "format": "date-time", "nullable": true }, - "batteryStatus": { - "type": "integer", - "format": "int32" - }, "rosVersion": { "type": "integer", "format": "int32" @@ -10398,114 +11389,72 @@ "type": "string", "nullable": true }, - "maximumPayload": { - "type": "integer", - "format": "int64", - "nullable": true - }, - "maximumTranslationalVelocity": { - "type": "integer", - "format": "int64", - "nullable": true - }, - "maximumRotationalVelocity": { - "type": "integer", - "format": "int64", - "nullable": true - }, - "robotWeight": { - "type": "integer", - "format": "int64", - "nullable": true - }, - "rosRepo": { - "type": "string", - "format": "uri", - "nullable": true - }, - "rosNodes": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ROSNodeModel" - }, - "nullable": true - }, "manufacturer": { "type": "string", "nullable": true + } + }, + "additionalProperties": false + }, + "RobotResponseListPagedResponse": { + "type": "object", + "properties": { + "statusCode": { + "type": "integer", + "format": "int32", + "readOnly": true }, - "manufacturerUrl": { - "type": "string", - "format": "uri", - "nullable": true - }, - "macAddress": { - "type": "string", - "nullable": true - }, - "locomotionSystem": { + "message": { "type": "string", - "nullable": true + "nullable": true, + "readOnly": true }, - "locomotionType": { + "timeStamp": { "type": "string", - "nullable": true - }, - "sensors": { - "type": "array", - "items": { - "$ref": "#/components/schemas/SensorModel" - }, - "nullable": true + "format": "date-time", + "readOnly": true }, - "actuators": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ActuatorModel" - }, - "nullable": true + "isError": { + "type": "boolean", + "readOnly": true }, - "manipulators": { + "data": { "type": "array", "items": { - "$ref": "#/components/schemas/ManipulatorModel" + "$ref": "#/components/schemas/RobotResponse" }, "nullable": true }, - "cpu": { + "pageNumber": { "type": "integer", - "format": "int32", - "nullable": true + "format": "int32" }, - "numberOfCores": { + "pageSize": { "type": "integer", - "format": "int32", - "nullable": true + "format": "int32" }, - "ram": { + "firstPage": { "type": "integer", - "format": "int64", - "nullable": true + "format": "int32" }, - "storageDisk": { - "type": "integer", - "format": "int64", + "lastPage": { + "type": "string", + "format": "uri", "nullable": true }, - "questions": { - "type": "array", - "items": { - "$ref": "#/components/schemas/DialogueModel" - }, - "nullable": true + "totalPages": { + "type": "integer", + "format": "int32" }, - "lastUpdatedTime": { + "nextPage": { "type": "string", - "format": "date-time" + "format": "uri", + "nullable": true }, - "onboardedTime": { + "previousPage": { "type": "string", - "format": "date-time" + "format": "uri", + "nullable": true } }, "additionalProperties": false @@ -10651,58 +11600,6 @@ }, "additionalProperties": false }, - "TaskRequest": { - "type": "object", - "properties": { - "name": { - "type": "string", - "nullable": true - }, - "priority": { - "type": "string", - "nullable": true - }, - "isDeterministic": { - "type": "boolean" - }, - "tags": { - "type": "array", - "items": { - "type": "string" - }, - "nullable": true - } - }, - "additionalProperties": false - }, - "TaskResponse": { - "type": "object", - "properties": { - "id": { - "type": "string", - "format": "uuid" - }, - "name": { - "type": "string", - "nullable": true - }, - "priority": { - "type": "string", - "nullable": true - }, - "isDeterministic": { - "type": "boolean" - }, - "tags": { - "type": "array", - "items": { - "type": "string" - }, - "nullable": true - } - }, - "additionalProperties": false - }, "TaskRobotResponse": { "type": "object", "properties": { @@ -10801,31 +11698,6 @@ } }, "additionalProperties": false - }, - "UpdateTopicResponse": { - "type": "object", - "properties": { - "robotId": { - "type": "string", - "format": "uuid" - }, - "topicName": { - "type": "string", - "nullable": true - }, - "topicType": { - "type": "string", - "nullable": true - }, - "topicDescription": { - "type": "string", - "nullable": true - }, - "topicEnabled": { - "type": "boolean" - } - }, - "additionalProperties": false } } } diff --git a/src/RedisInterface/Services/Abstract/IActionRunningService.cs b/src/RedisInterface/Services/Abstract/IActionRunningService.cs new file mode 100644 index 00000000..0a052a6c --- /dev/null +++ b/src/RedisInterface/Services/Abstract/IActionRunningService.cs @@ -0,0 +1,9 @@ +using Middleware.Models.Domain; + +namespace Middleware.RedisInterface.Services.Abstract; + +public interface IActionRunningService +{ + Task GetByIdAsync(Guid id); + Task AddAsync(ActionRunningModel model); +} diff --git a/src/RedisInterface/Services/ActionRunningService.cs b/src/RedisInterface/Services/ActionRunningService.cs new file mode 100644 index 00000000..2d668d9e --- /dev/null +++ b/src/RedisInterface/Services/ActionRunningService.cs @@ -0,0 +1,26 @@ +using Middleware.DataAccess.Repositories.Abstract; +using Middleware.Models.Domain; +using Middleware.RedisInterface.Services.Abstract; + +namespace Middleware.RedisInterface.Services; + +public class ActionRunningService : IActionRunningService +{ + private readonly IActionRunningRepository _actionRunningRepository; + public ActionRunningService(IActionRunningRepository actionRunningRepository) + { + _actionRunningRepository = actionRunningRepository; + } + public async Task AddAsync(ActionRunningModel model) + { + var action = await _actionRunningRepository.AddAsync(model); + return action; + } + + public async Task GetByIdAsync(Guid id) + { + var action = await _actionRunningRepository.GetByIdAsync(id); + + return action; + } +} \ No newline at end of file diff --git a/src/RedisInterface/Services/DashboardService.cs b/src/RedisInterface/Services/DashboardService.cs index f4c28655..af05f7c6 100644 --- a/src/RedisInterface/Services/DashboardService.cs +++ b/src/RedisInterface/Services/DashboardService.cs @@ -18,6 +18,7 @@ public class DashboardService : IDashboardService private readonly ICloudRepository _cloudRepository; private readonly IInstanceRepository _instanceRepository; private readonly IActionRepository _actionRepository; + private readonly IHistoricalActionPlanRepository _historicalActionPlanRepository; public DashboardService(IRobotRepository robotRepository, @@ -26,7 +27,8 @@ public DashboardService(IRobotRepository robotRepository, IEdgeRepository edgeRepository, ICloudRepository cloudRepository, IInstanceRepository instanceRepository, - IActionRepository actionRepository) + IActionRepository actionRepository, + IHistoricalActionPlanRepository historicalActionPlanRepository) { _instanceRepository = instanceRepository; _cloudRepository = cloudRepository; @@ -35,6 +37,7 @@ public DashboardService(IRobotRepository robotRepository, _taskRepository = taskRepository; _robotRepository = robotRepository; _actionRepository = actionRepository; + _historicalActionPlanRepository = historicalActionPlanRepository; } /// @@ -122,7 +125,7 @@ public async Task, int>> GetLocationsStatusLi public async Task, int>> GetRobotStatusListAsync(PaginationFilter filter) { var robots = await _robotRepository.GetAllAsync(); - var actionPlans = await _actionPlanRepository.GetAllAsync(); + var actionPlans = await _historicalActionPlanRepository.GetAllAsync(); var tasks = await _taskRepository.GetAllAsync(); var responses = new List(); diff --git a/src/ResourcePlanner/ResourcePlanner.cs b/src/ResourcePlanner/ResourcePlanner.cs index 126bcca6..ca49bda9 100644 --- a/src/ResourcePlanner/ResourcePlanner.cs +++ b/src/ResourcePlanner/ResourcePlanner.cs @@ -7,6 +7,7 @@ using Middleware.ResourcePlanner.ApiReference; using KeyValuePair = Middleware.Models.Domain.KeyValuePair; using Middleware.Common.Config; +using Middleware.Models.Enums; using Middleware.RedisInterface.Contracts.Mappings; using Middleware.RedisInterface.Contracts.Responses; using Middleware.RedisInterface.Sdk; @@ -76,7 +77,7 @@ public async Task Plan(TaskModel taskModel, RobotModel robot) } action.Placement = _mwConfig.InstanceName; - action.PlacementType = _mwConfig.InstanceType; + action.PlacementType = Enum.Parse(_mwConfig.InstanceType); } return taskModel; diff --git a/src/TaskPlanner/Controllers/PlanController.cs b/src/TaskPlanner/Controllers/PlanController.cs index e5fa05bd..5e94ff31 100644 --- a/src/TaskPlanner/Controllers/PlanController.cs +++ b/src/TaskPlanner/Controllers/PlanController.cs @@ -77,7 +77,7 @@ public async Task> GetPlan([FromBody] CreatePlanRequest if (dryRun) return Ok(resourcePlan); - await _redisInterfaceClient.AddRelationAsync(robot2, resourcePlan, "OWNS"); + await _redisInterfaceClient.AddRelationAsync(robot2, resourcePlan, "WANTS_TO_RUN"); await _publishService.PublishPlanAsync(resourcePlan, robot2); @@ -150,7 +150,7 @@ public async Task> GetSemanticPlan([FromBody] CreatePlan if (dryRun) // Will skip the orchestrator if true (will not deploy the actual plan.) return Ok(resourcePlan); - await _redisInterfaceClient.AddRelationAsync(robot2, resourcePlan, "OWNS"); + await _redisInterfaceClient.AddRelationAsync(robot2, resourcePlan, "WANTS_TO_RUN"); await _publishService.PublishPlanAsync(resourcePlan, robot2); diff --git a/src/TaskPlanner/Controllers/RePlanController.cs b/src/TaskPlanner/Controllers/RePlanController.cs index 47787168..f88ec7c8 100644 --- a/src/TaskPlanner/Controllers/RePlanController.cs +++ b/src/TaskPlanner/Controllers/RePlanController.cs @@ -78,7 +78,7 @@ public async Task> GetReplan([FromBody] CreateRePlanRequ //Delete previous plan in orchestrator and graph. --> TODO: AL 06/11/22 The replan is not shown in the graph, only in the ActionPlanModel index db. await _orchestratorClient.DeletePlanByIdAsync(oldPlan.ActionPlanId); - await _redisInterfaceClient.AddRelationAsync(robot, plan, "OWNS"); + //await _redisInterfaceClient.AddRelationAsync(robot, plan, "OWNS"); // Deploy replan Orchestrator.OrchestratorResourceInput tmpTaskOrchestratorSend = new Orchestrator.OrchestratorResourceInput() diff --git a/src/TaskPlanner/Services/PublishingService.cs b/src/TaskPlanner/Services/PublishingService.cs index 3d977620..b5d6670f 100644 --- a/src/TaskPlanner/Services/PublishingService.cs +++ b/src/TaskPlanner/Services/PublishingService.cs @@ -37,7 +37,7 @@ public async Task PublishPlanAsync(TaskModel task, RobotModel robot) if (action == null) return; - var location = QueueHelpers.ConstructRoutingKey(action.Placement, action.PlacementType); + var location = QueueHelpers.ConstructRoutingKey(action.Placement, action.PlacementType.ToString()); var message = new DeployPlanMessage() { Task = task, diff --git a/test/CentralApi.Tests.Unit/Services/LocationServiceTests.cs b/test/CentralApi.Tests.Unit/Services/LocationServiceTests.cs index e8f42ea7..0c12fc47 100644 --- a/test/CentralApi.Tests.Unit/Services/LocationServiceTests.cs +++ b/test/CentralApi.Tests.Unit/Services/LocationServiceTests.cs @@ -5,6 +5,7 @@ using Middleware.Common.Enums; using Middleware.DataAccess.Repositories.Abstract; using Middleware.Models.Domain; +using Middleware.Models.Enums; using NSubstitute; using OneOf.Types;