initial commit

This commit is contained in:
2026-04-15 15:02:32 +02:00
commit 3bfc79e6d9
1380 changed files with 69684 additions and 0 deletions

12
.config/dotnet-tools.json Normal file
View File

@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "7.0.9",
"commands": [
"dotnet-ef"
]
}
}
}

141
Context/DataContext.cs Normal file
View File

@@ -0,0 +1,141 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.SelfService.Portal.Core.API.Extensions.Dataannotations;
using Microsoft.SelfService.Portal.Core.API.Models;
using System.Reflection;
namespace Microsoft.SelfService.Portal.Core.API.Context
{
public class DataContext : DbContext
{
public DataContext(DbContextOptions<DataContext> options) : base(options)
{
}
public DbSet<EventModel> Events { get; set; }
public DbSet<EnvironmentModel> Environments { get; set; }
public DbSet<EnvironmentDomainsModel> EnvironmentDomains { get; set; }
public DbSet<DomainModel> Domains { get; set; }
public DbSet<VirtualMachineModel> VirtualMachines { get; set; }
public DbSet<DeploymentModel> Deployments { get; set; }
public DbSet<DeploymentGroupModel> DeploymentGroups { get; set; }
public DbSet<TemplateModel> Templates { get; set; }
public DbSet<TemplateCategoryModel> TemplateCategories { get; set; }
public DbSet<ServiceModel> Services { get; set; }
public DbSet<TemplateOptionModel> TemplateOptions { get; set; }
public DbSet<OptionModel> Options { get; set; }
public DbSet<OptionCategoryModel> OptionCategories { get; set; }
public DbSet<JobModel> Jobs { get; set; }
public DbSet<RunbookModel> Runbooks { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<EnvironmentDomainsModel>()
.HasKey(ed => new { ed.EnvironmentId, ed.DomainId });
modelBuilder.Entity<EnvironmentDomainsModel>()
.HasOne(ed => ed.Environment)
.WithMany(e => e.EnvironmentDomains)
.HasForeignKey(ed => ed.EnvironmentId);
modelBuilder.Entity<EnvironmentDomainsModel>()
.HasOne(ed => ed.Domain)
.WithMany(d => d.EnvironmentDomains)
.HasForeignKey(ed => ed.DomainId);
modelBuilder.Entity<TemplateOptionModel>()
.HasKey(to => new { to.OptionId, to.TemplateId });
modelBuilder.Entity<TemplateOptionModel>()
.HasOne(to => to.Option)
.WithMany(o => o.TemplateOptions)
.HasForeignKey(to => to.OptionId);
modelBuilder.Entity<TemplateOptionModel>()
.HasOne(to => to.Template)
.WithMany(t => t.TemplateOptions)
.HasForeignKey(to => to.TemplateId);
modelBuilder.Entity<TemplateCategoryModel>()
.HasOne(tc => tc.Service)
.WithMany(s => s.TemplateCategories)
.HasForeignKey(tc => tc.ServiceId);
modelBuilder.Entity<DeploymentModel>()
.HasKey(d => new { d.VirtualMachineId, d.DeploymentGroupId });
modelBuilder.Entity<DeploymentModel>()
.HasOne(d => d.VirtualMachine)
.WithMany(vm => vm.Deployments)
.HasForeignKey(d => d.VirtualMachineId);
modelBuilder.Entity<DeploymentModel>()
.HasOne(d => d.DeploymentGroup)
.WithMany(dg => dg.Deployments)
.HasForeignKey(d => d.DeploymentGroupId);
modelBuilder.Entity<DeploymentGroupModel>()
.HasOne(dg => dg.Template)
.WithMany(t => t.DeploymentGroups)
.HasForeignKey(dg => dg.TemplateId);
modelBuilder.Entity<JobModel>()
.HasKey(j => new { j.RunbookId, j.DeploymentId });
modelBuilder.Entity<JobModel>()
.HasOne(j => j.Deployment)
.WithMany(d => d.Jobs)
.HasPrincipalKey(d => d.Id)
.HasForeignKey(j => j.DeploymentId);
modelBuilder.Entity<JobModel>()
.HasOne(j => j.Runbook)
.WithMany(r => r.Jobs)
.HasPrincipalKey(r => r.Id)
.HasForeignKey(j => j.RunbookId);
modelBuilder.Entity<EventModel>()
.HasOne(e => e.Runbook)
.WithMany(r => r.Events)
.HasPrincipalKey(e => e.Id)
.HasForeignKey(r => r.RunbookId);
OnModelCreatingAddDefaultSqlValues(modelBuilder);
}
private void OnModelCreatingAddDefaultSqlValues(ModelBuilder modelBuilder)
{
var assemblyName = "Microsoft.SelfService.Portal.Core.API";
var nameSpace = "Microsoft.SelfService.Portal.Core.API.Models";
var asm = Assembly.Load(assemblyName);
List<Type> types = asm.GetTypes().Where(p => p.Namespace == nameSpace).ToList();
var dbSets = typeof(DataContext).GetProperties().Where(p => p.PropertyType.Name.ToLower().Contains("dbset")).ToList();
List<Type> dbSetTypes = new List<Type>();
foreach (PropertyInfo pi in dbSets)
{
dbSetTypes.Add(pi.PropertyType.GetGenericArguments()[0]);
}
foreach (Type t in types)
{
if (typeof(BaseModel).IsAssignableFrom(t) && t.Name != nameof(BaseModel) && dbSetTypes.Contains(t))
{
var properties = t.GetProperties().ToList();
foreach (var p in properties)
{
var att = p.GetCustomAttribute<DefaultValueSqlAttribute>();
if (att != null)
{
modelBuilder.Entity(t).Property(p.Name).HasDefaultValueSql(att.DefaultValueSql);
}
}
}
}
}
}
}

View File

@@ -0,0 +1,27 @@
using AutoMapper;
using Microsoft.AspNetCore.Mvc;
using Microsoft.SelfService.Portal.Core.API.Events.Interfaces;
using Microsoft.SelfService.Portal.Core.API.Models;
namespace Microsoft.SelfService.Portal.Core.API.Controllers
{
public class AbstractController : Controller
{
private readonly IEventHandlerInterface _eventHandlerInterface;
private readonly string _class;
private readonly string _method;
public AbstractController( string Class, string Method)
{
}
[NonAction]
ICollection<EventModel> GetEvents()
{
return _eventHandlerInterface.GetEvents(_class, _method);
}
}
}

View File

@@ -0,0 +1,135 @@
using AutoMapper;
using Microsoft.AspNetCore.Mvc;
using Microsoft.SelfService.Portal.Core.API.Dto.Deployment.Add;
using Microsoft.SelfService.Portal.Core.API.Dto.Deployment.Get;
using Microsoft.SelfService.Portal.Core.API.Dto.Deployment.Edit;
using Microsoft.SelfService.Portal.Core.API.Interfaces;
using Microsoft.SelfService.Portal.Core.API.Models;
using Microsoft.SelfService.Portal.Core.API.Events.Interfaces;
using System.Reflection;
using System.Collections;
using System.Dynamic;
using System.Text.Json;
namespace Microsoft.SelfService.Portal.Core.API.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class DeploymentController : Controller
{
private readonly IDeploymentInterface _deploymentInterface;
private readonly IMapper _mapper;
private readonly IEventHandlerInterface _eventHandlerInterface;
public DeploymentController(IDeploymentInterface deploymentInterface, IMapper mapper, IEventHandlerInterface eventHandlerInterface)
{
_deploymentInterface = deploymentInterface;
_mapper = mapper;
_eventHandlerInterface = eventHandlerInterface;
}
[HttpGet]
[ProducesResponseType(200, Type = typeof(IEnumerable<DeploymentModel>))]
public IActionResult GetDeployments()
{
var deployment = _mapper.Map<List<GetDeploymentDto>>(_deploymentInterface.GetDeployments());
if (!ModelState.IsValid)
return BadRequest(ModelState);
return Ok(deployment);
}
[HttpGet("{Id}")]
[ProducesResponseType(200, Type = typeof(DeploymentModel))]
[ProducesResponseType(400)]
public IActionResult GetDeploymentById(Guid Id)
{
if (!_deploymentInterface.CheckDeploymentById(Id))
return NotFound();
var deployment = _mapper.Map<GetDeploymentDetailsDto>(_deploymentInterface.GetDeploymentById(Id));
if (!ModelState.IsValid)
return BadRequest(ModelState);
return Ok(deployment);
}
[HttpPost]
[ProducesResponseType(204)]
[ProducesResponseType(400)]
public IActionResult AddDeploymentById([FromBody] AddDeploymentDto deployment)
{
if (deployment == null)
return BadRequest(ModelState);
if (!ModelState.IsValid)
return BadRequest(ModelState);
var deploymentMap = _mapper.Map<DeploymentModel>(deployment);
if (!_deploymentInterface.AddDeploymentById(deploymentMap))
{
ModelState.AddModelError("", "Something went wrong while saving");
return StatusCode(500, ModelState);
}
return Ok(deploymentMap.Id);
}
[HttpDelete("{Id}")]
[ProducesResponseType(204)]
[ProducesResponseType(400)]
[ProducesResponseType(404)]
public IActionResult DeleteDeploymentById(Guid Id)
{
if (!_deploymentInterface.CheckDeploymentById(Id))
return NotFound();
if (!ModelState.IsValid)
return BadRequest(ModelState);
var deployment = _deploymentInterface.GetDeploymentById(Id);
if (!_deploymentInterface.DeleteDeploymentById(deployment))
{
ModelState.AddModelError("", "Something went wrong while deleting");
return StatusCode(500, ModelState);
}
return NoContent();
}
[HttpPut("{Id}")]
[ProducesResponseType(204)]
[ProducesResponseType(400)]
[ProducesResponseType(404)]
public IActionResult EditDeploymentById(Guid Id, [FromBody] EditDeploymentDto deployment)
{
if (deployment == null)
return BadRequest(ModelState);
if (!_deploymentInterface.CheckDeploymentById(Id))
return NotFound();
if (!ModelState.IsValid)
return BadRequest(ModelState);
var deploymentMap = _mapper.Map<DeploymentModel>(deployment);
deploymentMap.Id = Id;
if (!_deploymentInterface.EditDeploymentById(deploymentMap))
{
ModelState.AddModelError("", "Something went wrong");
return StatusCode(500, ModelState);
}
_eventHandlerInterface.FireEvent(this.GetType().Name, MethodBase.GetCurrentMethod().Name, Id);
return NoContent();
}
}
}

View File

@@ -0,0 +1,125 @@
using AutoMapper;
using Microsoft.AspNetCore.Mvc;
using Microsoft.SelfService.Portal.Core.API.Dto.DeploymentGroup.Get;
using Microsoft.SelfService.Portal.Core.API.Dto.DeploymentGroup.Add;
using Microsoft.SelfService.Portal.Core.API.Dto.DeploymentGroup.Edit;
using Microsoft.SelfService.Portal.Core.API.Interfaces;
using Microsoft.SelfService.Portal.Core.API.Models;
namespace Microsoft.SelfService.Portal.Core.API.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class DeploymentGroupController : Controller
{
private readonly IDeploymentGroupInterface _deploymentgroupInterface;
private readonly IMapper _mapper;
public DeploymentGroupController(IDeploymentGroupInterface deploymentGroupInterface, IMapper mapper)
{
_deploymentgroupInterface = deploymentGroupInterface;
_mapper = mapper;
}
[HttpGet]
[ProducesResponseType(200, Type = typeof(IEnumerable<DomainModel>))]
public IActionResult GetDeploymentGroups()
{
var deploymentgroups = _mapper.Map<List<GetDeploymentGroupDto>>(_deploymentgroupInterface.GetDeploymentGroups());
if (!ModelState.IsValid)
return BadRequest(ModelState);
return Ok(deploymentgroups);
}
[HttpGet("{Id}")]
[ProducesResponseType(200, Type = typeof(DeploymentGroupModel))]
[ProducesResponseType(400)]
public IActionResult GetDeploymentGroupById(Guid Id)
{
if (!_deploymentgroupInterface.CheckDeploymentGroupById(Id))
return NotFound();
var deploymentgroup = _mapper.Map<GetDeploymentGroupDetailsDto>(_deploymentgroupInterface.GetDeploymentGroupById(Id));
if (!ModelState.IsValid)
return BadRequest(ModelState);
return Ok(deploymentgroup);
}
[HttpPost]
[ProducesResponseType(204)]
[ProducesResponseType(400)]
public IActionResult AddDeploymentGroupById([FromBody] AddDeploymentGroupDto deploymentgroup)
{
if (deploymentgroup == null)
return BadRequest(ModelState);
if (!ModelState.IsValid)
return BadRequest(ModelState);
var deploymentgroupMap = _mapper.Map<DeploymentGroupModel>(deploymentgroup);
if (!_deploymentgroupInterface.AddDeploymentGroupById(deploymentgroupMap))
{
ModelState.AddModelError("", "Something went wrong while saving");
return StatusCode(500, ModelState);
}
return Ok(deploymentgroupMap.Id);
}
[HttpDelete("{Id}")]
[ProducesResponseType(204)]
[ProducesResponseType(400)]
[ProducesResponseType(404)]
public IActionResult DeleteDeploymentGroupById(Guid Id)
{
if (!_deploymentgroupInterface.CheckDeploymentGroupById(Id))
return NotFound();
if (!ModelState.IsValid)
return BadRequest(ModelState);
var deploymentgroup = _deploymentgroupInterface.GetDeploymentGroupById(Id);
if (!_deploymentgroupInterface.DeleteDeploymentGroupById(deploymentgroup))
{
ModelState.AddModelError("", "Something went wrong while deleting");
return StatusCode(500, ModelState);
}
return NoContent();
}
[HttpPut("{Id}")]
[ProducesResponseType(204)]
[ProducesResponseType(400)]
[ProducesResponseType(404)]
public IActionResult EditDeploymentGroupById(Guid Id, [FromBody] EditDeploymentGroupDto deploymentgroup)
{
if (deploymentgroup == null)
return BadRequest(ModelState);
if (!_deploymentgroupInterface.CheckDeploymentGroupById(Id))
return NotFound();
if (!ModelState.IsValid)
return BadRequest(ModelState);
var deploymentgroupMap = _mapper.Map<DeploymentGroupModel>(deploymentgroup);
deploymentgroupMap.Id = Id;
if (!_deploymentgroupInterface.EditDeploymentGroupById(deploymentgroupMap))
{
ModelState.AddModelError("", "Something went wrong");
return StatusCode(500, ModelState);
}
return NoContent();
}
}
}

View File

@@ -0,0 +1,230 @@
using AutoMapper;
using Microsoft.AspNetCore.Mvc;
using Microsoft.SelfService.Portal.Core.API.Dto.Domain.Add;
using Microsoft.SelfService.Portal.Core.API.Dto.Domain.Edit;
using Microsoft.SelfService.Portal.Core.API.Dto.Domain.Get;
using Microsoft.SelfService.Portal.Core.API.Interfaces;
using Microsoft.SelfService.Portal.Core.API.Models;
namespace Microsoft.SelfService.Portal.Core.API.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class DomainController : Controller
{
private readonly IDomainInterface _domainInterface;
private readonly IEnvironmentInterface _environmentInterface;
private readonly IMapper _mapper;
public DomainController(IDomainInterface domainInterface,IEnvironmentInterface environmentInterface, IMapper mapper)
{
_domainInterface = domainInterface;
_environmentInterface = environmentInterface;
_mapper = mapper;
}
[HttpGet]
[ProducesResponseType(200, Type = typeof(IEnumerable<DomainModel>))]
public IActionResult GetDomains()
{
var domains = _mapper.Map<List<GetDomainDto>>(_domainInterface.GetDomains());
if (!ModelState.IsValid)
return BadRequest(ModelState);
return Ok(domains);
}
[HttpGet("{Id}")]
[ProducesResponseType(200, Type = typeof(DomainModel))]
[ProducesResponseType(400)]
public IActionResult GetDomainById(Guid Id)
{
if (!_domainInterface.CheckDomainById(Id))
return NotFound();
var domain = _mapper.Map<GetDomainDetailsDto>(_domainInterface.GetDomainById(Id));
if(!ModelState.IsValid)
return BadRequest(ModelState);
return Ok(domain);
}
[HttpPost]
[ProducesResponseType(204)]
[ProducesResponseType(400)]
public IActionResult AddDomainById([FromBody] AddDomainDto domain)
{
if (domain == null)
return BadRequest(ModelState);
if (_domainInterface.CheckDomainByName(domain.Name))
{
ModelState.AddModelError("", "Domain already exists");
return StatusCode(422, ModelState);
}
if (!ModelState.IsValid)
return BadRequest(ModelState);
var domainMap = _mapper.Map<DomainModel>(domain);
if (!_domainInterface.AddDomainById(domainMap))
{
ModelState.AddModelError("", "Something went wrong while saving");
return StatusCode(500, ModelState);
}
//return Ok("Successfully created");
return Ok(domainMap.Id);
}
[HttpDelete("{Id}")]
[ProducesResponseType(204)]
[ProducesResponseType(400)]
[ProducesResponseType(404)]
public IActionResult DeleteDomainById(Guid Id)
{
if (!_domainInterface.CheckDomainById(Id))
return NotFound();
if (!ModelState.IsValid)
return BadRequest(ModelState);
var domain = _domainInterface.GetDomainById(Id);
if (!_domainInterface.DeleteDomainById(domain))
{
ModelState.AddModelError("", "Something went wrong while deleting");
return StatusCode(500, ModelState);
}
return NoContent();
}
[HttpPut("{Id}")]
[ProducesResponseType(204)]
[ProducesResponseType(400)]
[ProducesResponseType(404)]
public IActionResult EditDomainById(Guid Id, [FromBody] EditDomainDto domain)
{
if (domain == null)
return BadRequest(ModelState);
if (!_domainInterface.CheckDomainById(Id))
return NotFound();
if (!ModelState.IsValid)
return BadRequest(ModelState);
var domainMap = _mapper.Map<DomainModel>(domain);
domainMap.Id = Id;
if (!_domainInterface.EditDomainById(domainMap))
{
ModelState.AddModelError("", "Something went wrong");
return StatusCode(500, ModelState);
}
return NoContent();
}
[HttpGet("{Id}/Environments")]
[ProducesResponseType(200, Type = typeof(DomainModel))]
[ProducesResponseType(400)]
public IActionResult GetDomainByIdInEnvironments(Guid Id)
{
if (!_domainInterface.CheckDomainById(Id))
return NotFound();
var domain = _mapper.Map<GetDomainEnvironmentDto>(_domainInterface.GetDomainByIdInEnvironments(Id));
if (!ModelState.IsValid)
return BadRequest(ModelState);
return Ok(domain);
}
[HttpPost("{DomainId}/Environment/{EnvironmentId}")]
[ProducesResponseType(200, Type = typeof(EnvironmentDomainsModel))]
[ProducesResponseType(400)]
public IActionResult LinkDomainByIdToEnvironment(Guid DomainId, Guid EnvironmentId)
{
if(!_domainInterface.CheckDomainById(DomainId))
return new NotFoundObjectResult("Domain with Id was not found");
if(!_environmentInterface.CheckEnvironmentById(EnvironmentId))
return new NotFoundObjectResult("Environment with Id was not found");
if (!ModelState.IsValid)
return BadRequest(ModelState);
var environmentDomain = new EnvironmentDomainsModel
{
DomainId = DomainId,
Domain = _domainInterface.GetDomainById(DomainId),
EnvironmentId = EnvironmentId,
Environment = _environmentInterface.GetEnvironmentById(EnvironmentId)
};
var environmentDomainMap = _mapper.Map<EnvironmentDomainsModel>(environmentDomain);
if (!_domainInterface.LinkDomainByIdToEnvironment(environmentDomainMap))
{
ModelState.AddModelError("", "Something went wrong while saving");
return StatusCode(500, ModelState);
}
return Ok("Successfully created");
}
[HttpDelete("{DomainId}/Environment/{EnvironmentId}")]
[ProducesResponseType(200, Type = typeof(EnvironmentDomainsModel))]
[ProducesResponseType(400)]
public IActionResult UnlinkDomainByIdFromEnvironment(Guid DomainId, Guid EnvironmentId)
{
if (!_domainInterface.CheckDomainById(DomainId) & !_environmentInterface.CheckEnvironmentById(EnvironmentId))
return new NotFoundObjectResult("Domain with Id is not linked to Environment");
if (!ModelState.IsValid)
return BadRequest(ModelState);
var environmentDomain = new EnvironmentDomainsModel
{
DomainId = DomainId,
Domain = _domainInterface.GetDomainById(DomainId),
EnvironmentId = EnvironmentId,
Environment = _environmentInterface.GetEnvironmentById(EnvironmentId)
};
if (!_domainInterface.UnlinkDomainByIdFromEnvironment(environmentDomain))
{
ModelState.AddModelError("", "Something went wrong while deleting");
return StatusCode(500, ModelState);
}
return NoContent();
}
[HttpGet("{Id}/VirtualMachines")]
[ProducesResponseType(200, Type = typeof(DomainModel))]
[ProducesResponseType(400)]
public IActionResult GetVirtualMachinesByDomainId(Guid Id)
{
if (!_domainInterface.CheckDomainById(Id))
return NotFound();
var domain = _mapper.Map<GetDomainVirtualMachineDetailsDto>(_domainInterface.GetVirtualMachinesByDomainId(Id));
if (!ModelState.IsValid)
return BadRequest(ModelState);
return Ok(domain);
}
}
}

View File

@@ -0,0 +1,162 @@
using AutoMapper;
using Microsoft.AspNetCore.Mvc;
using Microsoft.SelfService.Portal.Core.API.Dto.Environment.Add;
using Microsoft.SelfService.Portal.Core.API.Dto.Environment.Edit;
using Microsoft.SelfService.Portal.Core.API.Dto.Environment.Get;
using Microsoft.SelfService.Portal.Core.API.Dto.Service.Get;
using Microsoft.SelfService.Portal.Core.API.Dto.Template.Get;
using Microsoft.SelfService.Portal.Core.API.Interfaces;
using Microsoft.SelfService.Portal.Core.API.Models;
namespace Microsoft.SelfService.Portal.Core.API.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class EnvironmentController : Controller
{
private readonly IEnvironmentInterface _environmentInterface;
private readonly IMapper _mapper;
public EnvironmentController(IEnvironmentInterface environmentInterface, IMapper mapper)
{
_environmentInterface = environmentInterface;
_mapper = mapper;
}
[HttpGet]
[ProducesResponseType(200, Type = typeof(IEnumerable<EnvironmentModel>))]
public IActionResult GetEnvironments()
{
var environments = _mapper.Map<List<GetEnvironmentDto>>(_environmentInterface.GetEnvironments());
if (!ModelState.IsValid)
return BadRequest(ModelState);
return Ok(environments);
}
[HttpGet("{Id}")]
[ProducesResponseType(200, Type = typeof(EnvironmentModel))]
[ProducesResponseType(400)]
public IActionResult GetEnvironmentByID(Guid Id)
{
if (!_environmentInterface.CheckEnvironmentById(Id))
return NotFound();
var environment = _mapper.Map<GetEnvironmentDetailsDto>(_environmentInterface.GetEnvironmentById(Id));
if (!ModelState.IsValid)
return BadRequest(ModelState);
return Ok(environment);
}
[HttpPost]
[ProducesResponseType(204)]
[ProducesResponseType(400)]
public IActionResult AddEnvironmentById([FromBody] AddEnvironmentDto environment)
{
if (environment == null)
return BadRequest(ModelState);
if (_environmentInterface.CheckEnvironmentByName(environment.Name))
{
ModelState.AddModelError("", "Domain already exists");
return StatusCode(422, ModelState);
}
if (!ModelState.IsValid)
return BadRequest(ModelState);
var environmentMap = _mapper.Map<EnvironmentModel>(environment);
if (!_environmentInterface.AddEnvironmentById(environmentMap))
{
ModelState.AddModelError("", "Something went wrong while saving");
return StatusCode(500, ModelState);
}
return Ok("Successfully created");
}
[HttpDelete("{Id}")]
[ProducesResponseType(204)]
[ProducesResponseType(400)]
[ProducesResponseType(404)]
public IActionResult DeleteEnvironmentById(Guid Id)
{
if (!_environmentInterface.CheckEnvironmentById(Id))
return NotFound();
if (!ModelState.IsValid)
return BadRequest(ModelState);
var domain = _environmentInterface.GetEnvironmentById(Id);
if (!_environmentInterface.DeleteEnvironmentById(domain))
{
ModelState.AddModelError("", "Something went wrong while deleting");
return StatusCode(500, ModelState);
}
return NoContent();
}
[HttpPut("{Id}")]
[ProducesResponseType(204)]
[ProducesResponseType(400)]
[ProducesResponseType(404)]
public IActionResult EditDomainById(Guid Id, [FromBody] EditEnvironmentDto environment)
{
if (environment == null)
return BadRequest(ModelState);
if (!_environmentInterface.CheckEnvironmentById(Id))
return NotFound();
if (!ModelState.IsValid)
return BadRequest(ModelState);
var environmentMap = _mapper.Map<EnvironmentModel>(environment);
environmentMap.Id = Id;
if (!_environmentInterface.EditEnvironmentById(environmentMap))
{
ModelState.AddModelError("", "Something went wrong");
return StatusCode(500, ModelState);
}
return NoContent();
}
[HttpGet("{Id}/Domains")]
[ProducesResponseType(200, Type = typeof(EnvironmentModel))]
[ProducesResponseType(400)]
public IActionResult GetLinkedDomainsByEnvironmentId(Guid Id)
{
if (!_environmentInterface.CheckEnvironmentById(Id))
return NotFound();
var environment = _mapper.Map<GetEnvironmentDomainDto>(_environmentInterface.GetLinkedDomainsByEnvironmentId(Id));
if (!ModelState.IsValid)
return BadRequest(ModelState);
return Ok(environment);
}
[HttpGet("{Id}/Templates")]
[ProducesResponseType(200, Type = typeof(IEnumerable<TemplateModel>))]
public IActionResult GetAvailableTemplatesByEnvironmentId(Guid Id)
{
var templates = _mapper.Map<List<GetTemplateDetailsDto>>(_environmentInterface.GetAvailableTemplatesByEnvironmentId(Id));
if (!ModelState.IsValid)
return BadRequest(ModelState);
return Ok(templates);
}
}
}

View File

@@ -0,0 +1,113 @@
using AutoMapper;
using Microsoft.AspNetCore.Mvc;
using Microsoft.SelfService.Portal.Core.API.Dto.Runbook.Get;
using Microsoft.SelfService.Portal.Core.API.Dto.Runbook.Add;
using Microsoft.SelfService.Portal.Core.API.Interfaces;
using Microsoft.SelfService.Portal.Core.API.Models;
namespace Microsoft.SelfService.Portal.Core.API.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class RunbookController : Controller
{
private readonly IRunbookInterface _runbookInterface;
private readonly IMapper _mapper;
public RunbookController(IRunbookInterface runbookInterface, IMapper mapper)
{
_runbookInterface = runbookInterface;
_mapper = mapper;
}
[HttpGet]
[ProducesResponseType(200, Type = typeof(IEnumerable<RunbookModel>))]
public IActionResult GetRunbooks()
{
var runbooks = _mapper.Map<List<GetRunbookDto>>(_runbookInterface.GetRunbooks());
if (!ModelState.IsValid)
return BadRequest(ModelState);
return Ok(runbooks);
}
[HttpGet("{Id}")]
[ProducesResponseType(200, Type = typeof(RunbookModel))]
[ProducesResponseType(400)]
public IActionResult GetRunbookById(Guid Id)
{
if (!_runbookInterface.CheckRunbookById(Id))
return NotFound();
var runbook = _mapper.Map<GetRunbookDetailsDto>(_runbookInterface.GetRunbookById(Id));
if (!ModelState.IsValid)
return BadRequest(ModelState);
return Ok(runbook);
}
[HttpPost]
[ProducesResponseType(204)]
[ProducesResponseType(400)]
public IActionResult AddRunbookById([FromBody] AddRunbookDto runbook)
{
if (runbook == null)
return BadRequest(ModelState);
if (_runbookInterface.CheckRunbookByName(runbook.Name))
{
ModelState.AddModelError("", "Runbook already exists");
return StatusCode(422, ModelState);
}
if (!ModelState.IsValid)
return BadRequest(ModelState);
var runbookMap = _mapper.Map<RunbookModel>(runbook);
if (!_runbookInterface.AddRunbookById(runbookMap))
{
ModelState.AddModelError("", "Something went wrong while saving");
return StatusCode(500, ModelState);
}
return Ok("Successfully created");
}
[HttpPut("{Id}")]
[ProducesResponseType(204)]
[ProducesResponseType(400)]
[ProducesResponseType(404)]
public IActionResult EditRunbookById(Guid Id, [FromBody] GetRunbookDetailsDto runbook)
{
if (runbook == null)
return BadRequest(ModelState);
if (Id != runbook.Id)
return BadRequest(ModelState);
if (!_runbookInterface.CheckRunbookById(Id))
return NotFound();
if (!ModelState.IsValid)
return BadRequest(ModelState);
var runbookMap = _mapper.Map<RunbookModel>(runbook);
if (_runbookInterface.EditRunbookById(runbookMap))
{
ModelState.AddModelError("", "Something went wrong");
return StatusCode(500, ModelState);
}
return NoContent();
}
}
}

View File

@@ -0,0 +1,51 @@
using AutoMapper;
using Microsoft.AspNetCore.Mvc;
using Microsoft.SelfService.Portal.Core.API.Dto.Service.Get;
using Microsoft.SelfService.Portal.Core.API.Events;
using Microsoft.SelfService.Portal.Core.API.Events.Interfaces;
using Microsoft.SelfService.Portal.Core.API.Interfaces;
using Microsoft.SelfService.Portal.Core.API.Models;
namespace Microsoft.SelfService.Portal.Core.API.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class ServiceController : Controller
{
private readonly IMapper _mapper;
private readonly IServiceInterface _serviceInterface;
public ServiceController(IMapper mapper, IServiceInterface serviceInterface)
{
_mapper = mapper;
_serviceInterface = serviceInterface;
}
[HttpGet]
[ProducesResponseType(200, Type = typeof(IEnumerable<ServiceModel>))]
public IActionResult GetServices()
{
var services = _mapper.Map<List<GetServiceDto>>(_serviceInterface.GetServices());
if (!ModelState.IsValid)
return BadRequest(ModelState);
return Ok(services);
}
[HttpGet("{Id}")]
[ProducesResponseType(200, Type = typeof(ServiceModel))]
public IActionResult GetServiceById(Guid Id)
{
if(!_serviceInterface.CheckServiceById(Id))
return NotFound();
var service = _mapper.Map<GetServiceDetailsDto>(_serviceInterface.GetServiceById(Id));
if(!ModelState.IsValid)
return BadRequest(ModelState);
return Ok(service);
}
}
}

View File

@@ -0,0 +1,51 @@
using AutoMapper;
using Microsoft.AspNetCore.Mvc;
using Microsoft.SelfService.Portal.Core.API.Dto.Service.Get;
using Microsoft.SelfService.Portal.Core.API.Dto.Template.Get;
using Microsoft.SelfService.Portal.Core.API.Interfaces;
using Microsoft.SelfService.Portal.Core.API.Models;
using System.Reflection;
namespace Microsoft.SelfService.Portal.Core.API.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class TemplateController : Controller
{
private readonly ITemplateInterface _templateInterface;
private readonly IMapper _mapper;
public TemplateController(ITemplateInterface templateInterface, IMapper mapper)
{
_templateInterface = templateInterface;
_mapper = mapper;
}
[HttpGet]
[ProducesResponseType(200, Type = typeof(IEnumerable<TemplateModel>))]
public IActionResult GetTemplates()
{
var templates = _mapper.Map<List<GetTemplateDto>>(_templateInterface.GetTemplates());
if (!ModelState.IsValid)
return BadRequest(ModelState);
return Ok(templates);
}
[HttpGet("{Id}")]
[ProducesResponseType(200, Type = typeof(TemplateModel))]
public IActionResult GetTemplateById(Guid Id)
{
if (!_templateInterface.CheckTemplateById(Id))
return NotFound();
var template = _mapper.Map<GetTemplateDetailsDto>(_templateInterface.GetTemplateById(Id));
if (!ModelState.IsValid)
return BadRequest(ModelState);
return Ok(template);
}
}
}

View File

@@ -0,0 +1,51 @@
using AutoMapper;
using Microsoft.AspNetCore.Mvc;
using Microsoft.SelfService.Portal.Core.API.Dto.VirtualMachine.Get;
using Microsoft.SelfService.Portal.Core.API.Interfaces;
using Microsoft.SelfService.Portal.Core.API.Models;
namespace Microsoft.SelfService.Portal.Core.API.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class VirtualMachineController : Controller
{
private readonly IVirtualMachineInterface _virtualmachineInterface;
private readonly IMapper _mapper;
public VirtualMachineController(IVirtualMachineInterface virtualmachineInterface, IMapper mapper)
{
_virtualmachineInterface = virtualmachineInterface;
_mapper = mapper;
}
[HttpGet]
[ProducesResponseType(200, Type = typeof(IEnumerable<VirtualMachineModel>))]
public IActionResult GetVirtualMachines()
{
var virtualmachines = _mapper.Map<List<GetVirtualMachineDto>>(_virtualmachineInterface.GetVirtualMachines());
if (!ModelState.IsValid)
return BadRequest(ModelState);
return Ok(virtualmachines);
}
[HttpGet("{Id}")]
[ProducesResponseType(200, Type = typeof(VirtualMachineModel))]
[ProducesResponseType(400)]
public IActionResult GetVirtualMachineById(Guid Id)
{
if (!_virtualmachineInterface.CheckVirtualMachineById(Id))
return NotFound();
var virtualmachines = _mapper.Map<GetVirtualMachineDetailsDto>(_virtualmachineInterface.GetVirtualMachineById(Id));
if(!ModelState.IsValid)
return BadRequest(ModelState);
return Ok(virtualmachines);
}
}
}

View File

@@ -0,0 +1,8 @@
namespace Microsoft.SelfService.Portal.Core.API.Dto
{
public class AddEnvironmentDomainDto
{
public Guid EnvironmentId { get; set; }
public Guid DomainId { get; set; }
}
}

29
Dto/BaseDetailsDto.cs Normal file
View File

@@ -0,0 +1,29 @@
using Microsoft.SelfService.Portal.Core.API.Extensions.Dataannotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel;
namespace Microsoft.SelfService.Portal.Core.API.Dto
{
public class BaseDetailsDto : BaseDto
{
[Column(Order = 50)]
[DefaultValueSql("GETDATE()")]
//[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
public DateTime Modified { get; set; } = DateTime.Now;
[Column(Order = 51)]
[DefaultValue("CCIS-P01S01-CM\\ASA_SSP_Admin")]
//[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
public string ModifiedBy { get; set; } = new HttpContextAccessor().HttpContext.User.Identity.Name;
[Column(Order = 52)]
[DefaultValueSql("GETDATE()")]
//[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public DateTime Created { get; set; } = DateTime.Now;
[Column(Order = 53)]
[DefaultValue("CCIS-P01S01-CM\\ASA_SSP_Admin")]
//[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public string CreatedBy { get; set; } = new HttpContextAccessor().HttpContext.User.Identity.Name;
}
}

14
Dto/BaseDto.cs Normal file
View File

@@ -0,0 +1,14 @@
using Microsoft.SelfService.Portal.Core.API.Extensions.Dataannotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel;
namespace Microsoft.SelfService.Portal.Core.API.Dto
{
public class BaseDto
{
[Column(Order = 1)]
[DefaultValueSql("NEWID()")]
//[DatabaseGenerated(DatabaseGeneratedOption.None)]
public Guid Id { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
namespace Microsoft.SelfService.Portal.Core.API.Dto.Deployment.Add
{
public class AddDeploymentDto
{
public Guid DeploymentGroupId { get; set; }
public Guid VirtualMachineId { get; set; }
public string Status { get; set; }
public string JsonData { get; set; }
}
}

View File

@@ -0,0 +1,19 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Dto.Deployment.Edit
{
public class EditDeploymentDto
{
[Column(Order = 1)]
public string Status { get; set; }
[Column(Order = 2)]
public string jsonData { get; set; }
[Column(Order = 1)]
public Guid VirtualMachineId { get; set; }
[Column(Order = 1)]
public Guid DeploymentGroupId { get; set; }
}
}

View File

@@ -0,0 +1,16 @@
using Microsoft.SelfService.Portal.Core.API.Dto.DeploymentGroup.Get;
using Microsoft.SelfService.Portal.Core.API.Dto.VirtualMachine.Get;
namespace Microsoft.SelfService.Portal.Core.API.Dto.Deployment.Get
{
public class GetDeploymentDetailsDto : BaseDetailsDto
{
public string Status { get; set; }
public string JSONData { get; set; }
public GetVirtualMachineDetailsDto VirtualMachine { get; set; }
public GetDeploymentGroupDetailsDto DeploymentGroup { get; set; }
}
}

View File

@@ -0,0 +1,10 @@
using Microsoft.SelfService.Portal.Core.API.Dto.Deployment.Get;
namespace Microsoft.SelfService.Portal.Core.API.Dto.Deployment.Get
{
public class GetDeploymentDto : BaseDto
{
public string Status { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Dto.DeploymentGroup.Add
{
public class AddDeploymentGroupDto
{
[Column(Order = 1)]
public Guid TemplateId { get; set; }
[Column(Order = 2)]
public string Status { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Dto.DeploymentGroup.Edit
{
public class EditDeploymentGroupDto
{
[Column(Order = 1)]
public Guid TemplateId { get; set; }
[Column(Order = 2)]
public string Status { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
using Microsoft.SelfService.Portal.Core.API.Dto.Deployment.Get;
using Microsoft.SelfService.Portal.Core.API.Dto.Template.Get;
namespace Microsoft.SelfService.Portal.Core.API.Dto.DeploymentGroup.Get
{
public class GetDeploymentGroupDetailsDto : BaseDto
{
public string Status { get; set; }
public GetTemplateDetailsDto Template { get; set; }
public ICollection <GetDeploymentDetailsDto> Deployments { get; set; }
}
}

View File

@@ -0,0 +1,8 @@
namespace Microsoft.SelfService.Portal.Core.API.Dto.DeploymentGroup.Get
{
public class GetDeploymentGroupDto
{
public Guid Id { get; set; }
public string Status { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Dto.Domain.Add
{
public class AddDomainDto
{
[Column(Order = 1)]
public string Name { get; set; }
[Column(Order = 2)]
public string FQDN { get; set; }
[Column(Order = 3)]
public string NetBIOS { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Dto.Domain.Edit
{
public class EditDomainDto
{
[Column(Order = 1)]
public string Name { get; set; }
[Column(Order = 2)]
public string FQDN { get; set; }
[Column(Order = 3)]
public string NetBIOS { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Dto.Domain.Get
{
public class GetDomainDetailsDto : BaseDetailsDto
{
[Column(Order = 1)]
public string Name { get; set; }
[Column(Order = 2)]
public string FQDN { get; set; }
[Column(Order = 3)]
public string NetBIOS { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Dto.Domain.Get
{
public class GetDomainDto : BaseDto
{
[Column(Order = 1)]
public string FQDN { get; set; }
[Column(Order = 2)]
public string NetBIOS { get; set; }
[Column(Order = 3)]
public string Name { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
using Microsoft.SelfService.Portal.Core.API.Dto.Environment.Get;
using Microsoft.SelfService.Portal.Core.API.Models;
namespace Microsoft.SelfService.Portal.Core.API.Dto.Domain.Get
{
public class GetDomainEnvironmentDetailsDto
{
public GetEnvironmentDetailsDto Environment { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Dto.Domain.Get
{
public class GetDomainEnvironmentDto : BaseDetailsDto
{
[Column(Order = 1)]
public string Name { get; set; }
[Column(Order = 2)]
public string FQDN { get; set; }
[Column(Order = 3)]
public string NetBIOS { get; set; }
[Column(Order = 4)]
public ICollection<GetDomainEnvironmentDetailsDto> EnvironmentDomains { get; set; }
}
}

View File

@@ -0,0 +1,20 @@
using Microsoft.SelfService.Portal.Core.API.Dto.VirtualMachine.Get;
using Microsoft.SelfService.Portal.Core.API.Models;
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Dto.Domain.Get
{
public class GetDomainVirtualMachineDetailsDto : BaseDetailsDto
{
[Column(Order = 1)]
public string Name { get; set; }
[Column(Order = 2)]
public string FQDN { get; set; }
[Column(Order = 3)]
public string NetBIOS { get; set; }
[Column(Order = 4)]
public ICollection<GetVirtualMachineDto> VirtualMachines { get; set; }
}
}

View File

@@ -0,0 +1,10 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Dto.Environment.Add
{
public class AddEnvironmentDto
{
[Column(Order = 1)]
public string Name { get; set; }
}
}

View File

@@ -0,0 +1,10 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Dto.Environment.Edit
{
public class EditEnvironmentDto
{
[Column(Order = 1)]
public string Name { get; set; }
}
}

View File

@@ -0,0 +1,10 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Dto.Environment.Get
{
public class GetEnvironmentDetailsDto : BaseDetailsDto
{
[Column(Order = 1)]
public string Name { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Dto.Environment.Get
{
public class GetEnvironmentDomainDetailsDto : BaseDetailsDto
{
[Column(Order = 1)]
public ICollection<GetEnvironmentDetailsDto> Environment { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
using Microsoft.SelfService.Portal.Core.API.Dto.Domain.Get;
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Dto.Environment.Get
{
public class GetEnvironmentDomainDto : BaseDetailsDto
{
[Column(Order = 1)]
public string Name { get; set; }
[Column(Order = 2)]
public ICollection<GetEnvironmentDomainDetailsDto> EnvironmentDomains { get; set; }
}
}

View File

@@ -0,0 +1,10 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Dto.Environment.Get
{
public class GetEnvironmentDto : BaseDto
{
[Column(Order = 1)]
public string Name { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Dto.Runbook.Add
{
public class AddRunbookDto
{
[Column(Order = 1)]
public string Name { get; set; }
[Column(Order = 2)]
public string Description { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Dto.Runbook.Get
{
public class GetRunbookDetailsDto : BaseDetailsDto
{
[Column(Order = 1)]
public string Name { get; set; }
[Column(Order = 2)]
public string Decription { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Dto.Runbook.Get
{
public class GetRunbookDto : BaseDto
{
[Column(Order = 1)]
public string Name { get; set; }
[Column(Order = 2)]
public string Decription { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Dto.Service.Get
{
public class GetServiceDetailsDto : BaseDetailsDto
{
[Column(Order = 1)]
public string Name { get; set; }
[Column(Order = 2)]
public string Type { get; set; }
}
}

View File

@@ -0,0 +1,10 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Dto.Service.Get
{
public class GetServiceDto : BaseDto
{
[Column(Order = 1)]
public string Name { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
namespace Microsoft.SelfService.Portal.Core.API.Dto.Template.Get
{
public class GetTemplateDetailsDto : BaseDetailsDto
{
public string Name { get; set; }
public string CloudTemplate { get; set; }
public string Version { get; set; }
public string Description { get; set; }
public string JSONData { get; set; }
}
}

View File

@@ -0,0 +1,8 @@
namespace Microsoft.SelfService.Portal.Core.API.Dto.Template.Get
{
public class GetTemplateDto : BaseDto
{
public string Name { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
using Microsoft.SelfService.Portal.Core.API.Dto.Domain.Get;
using Microsoft.SelfService.Portal.Core.API.Models;
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Dto.VirtualMachine.Get
{
public class GetVirtualMachineDetailsDto : BaseDetailsDto
{
[Column(Order = 1)]
public string Name { get; set; }
public GetDomainDto Domain { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Dto.VirtualMachine.Get
{
public class GetVirtualMachineDto : BaseDto
{
[Column(Order = 1)]
public string Name { get; set; }
}
}

View File

@@ -0,0 +1,50 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.SelfService.Portal.Core.API.Context;
using Microsoft.SelfService.Portal.Core.API.Events.Interfaces;
using Microsoft.SelfService.Portal.Core.API.Helper;
using Microsoft.SelfService.Portal.Core.API.Models;
namespace Microsoft.SelfService.Portal.Core.API.Events
{
public class AbstractEventHandler : IEventHandlerInterface
{
private readonly DataContext _context;
public AbstractEventHandler(DataContext context)
{
_context = context;
new APIHelper();
}
public ICollection<EventModel> GetEvents(string Class, string Method)
{
return _context.Events
.Where(e => e.Class == Class && e.Method == Method)
.Include(r => r.Runbook)
.ToList();
}
public async void FireEvent(string Class, string Method, Guid parameters)
{
var events = GetEvents(Class, Method);
foreach (EventModel @event in events){
APIHelper.SetUrl(@event.RunbookId, @event.RestEndpointOperation);
APIHelper.SetRequestBody(parameters);
var response = await APIHelper.ApiClient.PostAsync(APIHelper.GetUrl(), APIHelper.SetRequestHeaders("application/json;odata=verbose;charset=utf-8"));
if (response.IsSuccessStatusCode)
{
var stringResponse = await response.Content.ReadAsStringAsync();
}
else
{
throw new HttpRequestException(response.ReasonPhrase);
}
}
}
}
}

View File

@@ -0,0 +1,10 @@
using Microsoft.SelfService.Portal.Core.API.Models;
namespace Microsoft.SelfService.Portal.Core.API.Events.Interfaces
{
public interface IEventHandlerInterface
{
ICollection<EventModel> GetEvents(string Class, string Method);
void FireEvent(string Class, string Method, Guid parameters);
}
}

View File

@@ -0,0 +1,13 @@
namespace Microsoft.SelfService.Portal.Core.API.Extensions.Dataannotations
{
[AttributeUsage(AttributeTargets.Property)]
public class DefaultValueSqlAttribute : Attribute
{
public string DefaultValueSql { get; private set; } = "";
public DefaultValueSqlAttribute(string defaultValueSql)
{
DefaultValueSql = defaultValueSql;
}
}
}

View File

@@ -0,0 +1,6 @@
namespace Microsoft.SelfService.Portal.Core.API.Handlers
{
public class DomainEditedHandler
{
}
}

70
Helper/APIHelper.cs Normal file
View File

@@ -0,0 +1,70 @@
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
namespace Microsoft.SelfService.Portal.Core.API.Helper
{
public class APIHelper
{
public static HttpClient ApiClient { get; set; } = new HttpClient();
public static String _Url;
public static String _Body;
public APIHelper()
{
ApiClient = new HttpClient();
ApiClient.BaseAddress = new Uri("http://rz1vcmsma001.cm.p01s01.ccis.svc.intranetbw.de:8080");
ApiClient.DefaultRequestHeaders.Accept.Clear();
ApiClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/xml"));
ApiClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(
Encoding.UTF8.GetBytes("CCIS-P01S01-CM\\ASA_Administrator:UQp7AurAkH4M")
));
}
public static void SetUrl(Guid RunbookId, String RestEndpointMethod)
{
_Url = string.Format("/00000000-0000-0000-0000-000000000000/Runbooks(guid'{0}')/{1}", RunbookId, RestEndpointMethod);
}
public static string GetUrl()
{
return _Url;
}
public static StringContent SetRequestHeaders(String ContentType)
{
MediaTypeHeaderValue JsonMediaType = null;
MediaTypeHeaderValue.TryParse(ContentType, out JsonMediaType);
return new StringContent(_Body, Encoding.UTF8, JsonMediaType); ;
}
public static void SetRequestBody(Guid parameters)
{
var obj = new
{
parameters = new[]
{
new
{
__metadata = new
{
type = "Orchestrator.ResourceModel.NameValuePair"
},
Name = "deploymentId",
Value = parameters
}
}
};
_Body = JsonSerializer.Serialize(obj);
}
public static String GetRequestBody()
{
return _Body;
}
}
}

View File

@@ -0,0 +1,102 @@
using AutoMapper;
using Microsoft.SelfService.Portal.Core.API.Models;
using Microsoft.SelfService.Portal.Core.API.Dto;
using Microsoft.SelfService.Portal.Core.API.Dto.Domain.Get;
using Microsoft.SelfService.Portal.Core.API.Dto.Domain.Add;
using Microsoft.SelfService.Portal.Core.API.Dto.Runbook.Get;
using Microsoft.SelfService.Portal.Core.API.Dto.Runbook.Add;
using Microsoft.SelfService.Portal.Core.API.Dto.Environment.Get;
using Microsoft.SelfService.Portal.Core.API.Dto.VirtualMachine.Get;
using Microsoft.SelfService.Portal.Core.API.Dto.Domain.Edit;
using Microsoft.SelfService.Portal.Core.API.Dto.Environment.Add;
using Microsoft.SelfService.Portal.Core.API.Dto.Environment.Edit;
using Microsoft.SelfService.Portal.Core.API.Dto.Deployment.Get;
using Microsoft.SelfService.Portal.Core.API.Dto.Deployment.Add;
using Microsoft.SelfService.Portal.Core.API.Dto.Deployment.Edit;
using Microsoft.SelfService.Portal.Core.API.Dto.DeploymentGroup.Get;
using Microsoft.SelfService.Portal.Core.API.Dto.DeploymentGroup.Add;
using Microsoft.SelfService.Portal.Core.API.Dto.Template.Get;
using Microsoft.SelfService.Portal.Core.API.Dto.Service.Get;
namespace Microsoft.SelfService.Portal.Core.API.Helper
{
public class MappingProfilesHelper : Profile
{
public MappingProfilesHelper()
{
/** Domain Model **/
CreateMap<DomainModel, GetDomainDto>();
CreateMap<GetDomainDto, DomainModel>();
CreateMap<DomainModel, GetDomainDetailsDto>();
CreateMap<GetDomainDetailsDto, DomainModel>();
CreateMap<DomainModel, GetDomainEnvironmentDto>();
CreateMap<GetDomainEnvironmentDto, DomainModel>();
CreateMap<DomainModel, GetDomainVirtualMachineDetailsDto>();
CreateMap<GetDomainVirtualMachineDetailsDto, DomainModel>();
CreateMap<DomainModel, AddDomainDto>();
CreateMap<AddDomainDto, DomainModel>();
CreateMap<DomainModel, EditDomainDto>();
CreateMap<EditDomainDto, DomainModel>();
/** Environment Model **/
CreateMap<EnvironmentModel, GetEnvironmentDto>();
CreateMap<GetEnvironmentDto, EnvironmentModel>();
CreateMap<EnvironmentModel, GetEnvironmentDetailsDto>();
CreateMap<GetEnvironmentDetailsDto, EnvironmentModel>();
CreateMap<EnvironmentModel, GetEnvironmentDomainDetailsDto>();
CreateMap<GetEnvironmentDomainDetailsDto, EnvironmentModel>();
CreateMap<EnvironmentModel, AddEnvironmentDto>();
CreateMap<AddEnvironmentDto, EnvironmentModel>();
CreateMap<EnvironmentModel, EditEnvironmentDto>();
CreateMap<EditEnvironmentDto, EnvironmentModel>();
/** Environment Domain Model **/
CreateMap<EnvironmentDomainsModel, GetDomainEnvironmentDetailsDto>();
CreateMap<GetDomainEnvironmentDetailsDto, EnvironmentDomainsModel>();
CreateMap<EnvironmentDomainsModel, AddEnvironmentDomainDto>();
CreateMap<AddEnvironmentDomainDto, EnvironmentDomainsModel>();
/** Virtual Machine Model **/
CreateMap<VirtualMachineModel, GetVirtualMachineDto>();
CreateMap<GetVirtualMachineDto, VirtualMachineModel>();
CreateMap<VirtualMachineModel, GetVirtualMachineDetailsDto>();
CreateMap<GetVirtualMachineDetailsDto, VirtualMachineModel>();
/** Runbook Model **/
CreateMap<RunbookModel, GetRunbookDto>();
CreateMap<GetRunbookDto, RunbookModel>();
CreateMap<RunbookModel, GetRunbookDetailsDto>();
CreateMap<GetRunbookDetailsDto, RunbookModel>();
CreateMap<RunbookModel, AddRunbookDto>();
CreateMap<AddRunbookDto, RunbookModel>();
/** Deployment Model **/
CreateMap<DeploymentModel, GetDeploymentDto>();
CreateMap<GetDeploymentDto, DeploymentModel>();
CreateMap<DeploymentModel, GetDeploymentDetailsDto>();
CreateMap<GetDeploymentDetailsDto, DeploymentModel>();
CreateMap<DeploymentModel, AddDeploymentDto>();
CreateMap<AddDeploymentDto, DeploymentModel>();
CreateMap<DeploymentModel, EditDeploymentDto>();
CreateMap<EditDeploymentDto, DeploymentModel>();
/** Deployment Group Model **/
CreateMap<DeploymentGroupModel, GetDeploymentGroupDto>();
CreateMap<GetDeploymentGroupDto, DeploymentGroupModel>();
CreateMap<DeploymentGroupModel, GetDeploymentGroupDetailsDto>();
CreateMap<GetDeploymentGroupDetailsDto, DeploymentGroupModel>();
CreateMap<DeploymentGroupModel, AddDeploymentGroupDto>();
CreateMap<AddDeploymentGroupDto, DeploymentGroupModel>();
/** Template Model **/
CreateMap<TemplateModel, GetTemplateDto>();
CreateMap<GetTemplateDto, TemplateModel>();
CreateMap<TemplateModel, GetTemplateDetailsDto>();
CreateMap<GetTemplateDetailsDto, TemplateModel>();
/** Service Model **/
CreateMap<ServiceModel, GetServiceDetailsDto>();
CreateMap<GetServiceDetailsDto, ServiceModel>();
}
}
}

View File

@@ -0,0 +1,7 @@
namespace Microsoft.SelfService.Portal.Core.API.Interfaces
{
public interface IAbstractInterface
{
bool SaveChanges();
}
}

View File

@@ -0,0 +1,18 @@
using Microsoft.SelfService.Portal.Core.API.Models;
namespace Microsoft.SelfService.Portal.Core.API.Interfaces
{
public interface IDeploymentGroupInterface
{
ICollection<DeploymentGroupModel> GetDeploymentGroups();
DeploymentGroupModel GetDeploymentGroupById(Guid Id);
bool AddDeploymentGroupById(DeploymentGroupModel deploymentgroup);
bool DeleteDeploymentGroupById(DeploymentGroupModel deploymentgroup);
bool EditDeploymentGroupById(DeploymentGroupModel deploymentgroup);
bool CheckDeploymentGroupById(Guid Id);
bool SaveChanges();
}
}

View File

@@ -0,0 +1,17 @@
using Microsoft.SelfService.Portal.Core.API.Models;
namespace Microsoft.SelfService.Portal.Core.API.Interfaces
{
public interface IDeploymentInterface
{
ICollection<DeploymentModel> GetDeployments();
DeploymentModel GetDeploymentById(Guid Id);
bool AddDeploymentById(DeploymentModel deployment);
bool DeleteDeploymentById(DeploymentModel deployment);
bool EditDeploymentById(DeploymentModel deployment);
bool CheckDeploymentById(Guid Id);
bool SaveChanges();
}
}

View File

@@ -0,0 +1,25 @@
using Microsoft.SelfService.Portal.Core.API.Models;
namespace Microsoft.SelfService.Portal.Core.API.Interfaces
{
public interface IDomainInterface
{
ICollection<DomainModel> GetDomains();
DomainModel GetDomainById(Guid Id);
bool AddDomainById(DomainModel domain);
bool DeleteDomainById(DomainModel domain);
bool EditDomainById(DomainModel domain);
DomainModel GetDomainByIdInEnvironments(Guid Id);
DomainModel GetVirtualMachinesByDomainId(Guid Id);
bool LinkDomainByIdToEnvironment(EnvironmentDomainsModel environmentDomain);
bool UnlinkDomainByIdFromEnvironment(EnvironmentDomainsModel environmentDomain);
bool CheckDomainById(Guid Id);
bool CheckDomainByName(string Name);
bool SaveChanges();
}
}

View File

@@ -0,0 +1,22 @@
using Microsoft.SelfService.Portal.Core.API.Models;
namespace Microsoft.SelfService.Portal.Core.API.Interfaces
{
public interface IEnvironmentInterface
{
ICollection<EnvironmentModel> GetEnvironments();
EnvironmentModel GetEnvironmentById(Guid Id);
bool AddEnvironmentById(EnvironmentModel environment);
bool DeleteEnvironmentById(EnvironmentModel environment);
bool EditEnvironmentById(EnvironmentModel environment);
EnvironmentModel GetLinkedDomainsByEnvironmentId(Guid Id);
ICollection<TemplateModel> GetAvailableTemplatesByEnvironmentId(Guid Id);
bool CheckEnvironmentById(Guid Id);
bool CheckEnvironmentByName(String Name);
bool SaveChanges();
}
}

View File

@@ -0,0 +1,16 @@
using Microsoft.SelfService.Portal.Core.API.Models;
namespace Microsoft.SelfService.Portal.Core.API.Interfaces
{
public interface IJobInterface : IAbstractInterface
{
ICollection<JobModel> GetJobs();
JobModel GetJobById(Guid Id);
bool CreateJobById(JobModel job);
bool UpdateJobById(JobModel job);
bool DeleteJobById(JobModel job);
bool CheckJobById(Guid Id);
}
}

View File

@@ -0,0 +1,18 @@
using Microsoft.SelfService.Portal.Core.API.Models;
namespace Microsoft.SelfService.Portal.Core.API.Interfaces
{
public interface IRunbookInterface
{
ICollection<RunbookModel> GetRunbooks();
RunbookModel GetRunbookById(Guid Id);
bool AddRunbookById(RunbookModel runbook);
bool EditRunbookById(RunbookModel runbook);
bool CheckRunbookById(Guid Id);
bool CheckRunbookByName(string Name);
bool SaveChanges();
}
}

View File

@@ -0,0 +1,16 @@
using Microsoft.SelfService.Portal.Core.API.Models;
namespace Microsoft.SelfService.Portal.Core.API.Interfaces
{
public interface IServiceInterface
{
ICollection<ServiceModel> GetServices();
ServiceModel GetServiceById(Guid Id);
bool CheckServiceById(Guid Id);
ServiceModel GetServiceByName(string Name);
bool CheckServiceByName(string Name);
}
}

View File

@@ -0,0 +1,13 @@
using Microsoft.SelfService.Portal.Core.API.Models;
namespace Microsoft.SelfService.Portal.Core.API.Interfaces
{
public interface ITemplateInterface
{
ICollection<TemplateModel> GetTemplates();
TemplateModel GetTemplateById(Guid Id);
bool CheckTemplateById(Guid Id);
}
}

View File

@@ -0,0 +1,15 @@
using Microsoft.SelfService.Portal.Core.API.Models;
using System.Diagnostics.Eventing.Reader;
namespace Microsoft.SelfService.Portal.Core.API.Interfaces
{
public interface IVirtualMachineInterface
{
ICollection<VirtualMachineModel> GetVirtualMachines();
VirtualMachineModel GetVirtualMachineById(Guid Id);
bool CheckVirtualMachineById(Guid Id);
bool CheckVirtualMachineByName(String Name);
}
}

View File

@@ -0,0 +1,33 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>9c90fee1-4576-4f20-be83-715728173b96</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="12.0.1" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Negotiate" Version="7.0.9" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.9" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.9">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="7.0.8" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
</ItemGroup>
<ItemGroup>
<Folder Include="Authentication\" />
<Folder Include="Dto\Deployment\Delete\" />
<Folder Include="logs\" />
<Folder Include="Migrations\" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ActiveDebugProfile>https</ActiveDebugProfile>
<Controller_SelectedScaffolderID>ApiControllerWithActionsScaffolder</Controller_SelectedScaffolderID>
<Controller_SelectedScaffolderCategoryPath>root/Common/Api</Controller_SelectedScaffolderCategoryPath>
<WebStackScaffolding_ControllerDialogWidth>650</WebStackScaffolding_ControllerDialogWidth>
<WebStackScaffolding_DbContextDialogWidth>650</WebStackScaffolding_DbContextDialogWidth>
<WebStackScaffolding_IsLayoutPageSelected>True</WebStackScaffolding_IsLayoutPageSelected>
<WebStackScaffolding_IsPartialViewSelected>False</WebStackScaffolding_IsPartialViewSelected>
<WebStackScaffolding_IsReferencingScriptLibrariesSelected>True</WebStackScaffolding_IsReferencingScriptLibrariesSelected>
<WebStackScaffolding_LayoutPageFile />
<WebStackScaffolding_DbContextTypeFullName>Microsoft.SelfService.Portal.Core.API.Data.Context</WebStackScaffolding_DbContextTypeFullName>
<WebStackScaffolding_IsAsyncSelected>False</WebStackScaffolding_IsAsyncSelected>
<NameOfLastUsedPublishProfile>C:\Users\ASA_Administrator.CCIS-P01S01-CM\source\repos\Microsoft.SelfService.Portal\Microsoft.SelfService.Portal.Core.API\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebuggerFlavor>ProjectDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,971 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Microsoft.SelfService.Portal.Core.API.Context;
#nullable disable
namespace Microsoft.SelfService.Portal.Core.API.Migrations
{
[DbContext(typeof(DataContext))]
[Migration("20231020093825_Initial")]
partial class Initial
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.9")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.DeploymentGroupModel", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasColumnOrder(0)
.HasDefaultValueSql("NEWID()");
b.Property<DateTime>("Created")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(52)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(53);
b.Property<DateTime>("Modified")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(50)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(51);
b.Property<string>("Status")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(4)
.HasDefaultValueSql("'New'");
b.Property<Guid>("TemplateId")
.HasColumnType("uniqueidentifier")
.HasColumnOrder(2);
b.HasKey("Id");
b.HasIndex("TemplateId");
b.ToTable("DeploymentGroups");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.DeploymentModel", b =>
{
b.Property<Guid>("VirtualMachineId")
.HasColumnType("uniqueidentifier")
.HasColumnOrder(3);
b.Property<Guid>("DeploymentGroupId")
.HasColumnType("uniqueidentifier")
.HasColumnOrder(2);
b.Property<DateTime>("Created")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(52)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(53);
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasColumnOrder(0)
.HasDefaultValueSql("NEWID()");
b.Property<string>("JSONData")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(5);
b.Property<DateTime>("Modified")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(50)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(51);
b.Property<string>("Status")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(4);
b.HasKey("VirtualMachineId", "DeploymentGroupId");
b.HasIndex("DeploymentGroupId");
b.ToTable("Deployments");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.DomainModel", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasColumnOrder(0)
.HasDefaultValueSql("NEWID()");
b.Property<DateTime>("Created")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(52)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(53);
b.Property<string>("FQDN")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(2);
b.Property<DateTime>("Modified")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(50)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(51);
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(1);
b.Property<string>("NetBIOS")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(3);
b.HasKey("Id");
b.ToTable("Domains");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.EnvironmentDomainsModel", b =>
{
b.Property<Guid>("EnvironmentId")
.HasColumnType("uniqueidentifier")
.HasColumnOrder(0);
b.Property<Guid>("DomainId")
.HasColumnType("uniqueidentifier")
.HasColumnOrder(1);
b.Property<DateTime>("Created")
.HasColumnType("datetime2")
.HasColumnOrder(52);
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(53);
b.Property<DateTime>("Modified")
.HasColumnType("datetime2")
.HasColumnOrder(50);
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(51);
b.HasKey("EnvironmentId", "DomainId");
b.HasIndex("DomainId");
b.ToTable("EnvironmentDomains");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.EnvironmentModel", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasColumnOrder(0)
.HasDefaultValueSql("NEWID()");
b.Property<bool>("CloudEnabled")
.HasColumnType("bit")
.HasColumnOrder(2);
b.Property<DateTime>("Created")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(52)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(53);
b.Property<DateTime>("Modified")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(50)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(51);
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(1);
b.HasKey("Id");
b.ToTable("Environments");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.EventModel", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasColumnOrder(0)
.HasDefaultValueSql("NEWID()");
b.Property<string>("Class")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(2);
b.Property<DateTime>("Created")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(52)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(53);
b.Property<string>("Method")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(3);
b.Property<DateTime>("Modified")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(50)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(51);
b.Property<string>("RestEndpointMethod")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(4);
b.Property<string>("RestEndpointOperation")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(5);
b.Property<Guid>("RunbookId")
.HasColumnType("uniqueidentifier")
.HasColumnOrder(1);
b.HasKey("Id");
b.HasIndex("RunbookId");
b.ToTable("Events");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.JobModel", b =>
{
b.Property<Guid>("RunbookId")
.HasColumnType("uniqueidentifier")
.HasColumnOrder(2);
b.Property<Guid>("DeploymentId")
.HasColumnType("uniqueidentifier")
.HasColumnOrder(1);
b.Property<DateTime>("Created")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(52)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(53);
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasColumnOrder(0)
.HasDefaultValueSql("NEWID()");
b.Property<DateTime>("Modified")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(50)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(51);
b.HasKey("RunbookId", "DeploymentId");
b.HasIndex("DeploymentId");
b.ToTable("Jobs");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.OptionCategoryModel", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasColumnOrder(0)
.HasDefaultValueSql("NEWID()");
b.Property<DateTime>("Created")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(52)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(53);
b.Property<DateTime>("Modified")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(50)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(51);
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(1);
b.Property<string>("ParentCategoryName")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(2);
b.Property<int>("showOrder")
.HasColumnType("int")
.HasColumnOrder(3);
b.HasKey("Id");
b.ToTable("OptionCategories");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.OptionModel", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasColumnOrder(0)
.HasDefaultValueSql("NEWID()");
b.Property<DateTime>("Created")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(52)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(53);
b.Property<DateTime>("Modified")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(50)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(51);
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(1);
b.Property<Guid>("OptionCategoryId")
.HasColumnType("uniqueidentifier");
b.Property<string>("OptionType")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(2);
b.Property<string>("OptionValue")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(3);
b.HasKey("Id");
b.HasIndex("OptionCategoryId");
b.ToTable("Options");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.RunbookModel", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasColumnOrder(0)
.HasDefaultValueSql("NEWID()");
b.Property<DateTime>("Created")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(52)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(53);
b.Property<string>("Description")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(2);
b.Property<DateTime>("Modified")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(50)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(51);
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(1);
b.HasKey("Id");
b.ToTable("Runbooks");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.ServiceModel", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasColumnOrder(0)
.HasDefaultValueSql("NEWID()");
b.Property<DateTime>("Created")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(52)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(53);
b.Property<string>("Description")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(2);
b.Property<DateTime>("Modified")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(50)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(51);
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(1);
b.HasKey("Id");
b.ToTable("Services");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.TemplateCategoryModel", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasColumnOrder(0)
.HasDefaultValueSql("NEWID()");
b.Property<DateTime>("Created")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(52)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(53);
b.Property<DateTime>("Modified")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(50)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(51);
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(2);
b.Property<string>("ParentCategoryName")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(3);
b.Property<Guid>("ServiceId")
.HasColumnType("uniqueidentifier")
.HasColumnOrder(1);
b.Property<int>("showOrder")
.HasColumnType("int")
.HasColumnOrder(4);
b.HasKey("Id");
b.HasIndex("ServiceId");
b.ToTable("TemplateCategories");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.TemplateModel", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasColumnOrder(0)
.HasDefaultValueSql("NEWID()");
b.Property<bool>("CloudTemplate")
.HasColumnType("bit")
.HasColumnOrder(2);
b.Property<DateTime>("Created")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(52)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(53);
b.Property<string>("Description")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(4);
b.Property<string>("JSONData")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(5);
b.Property<DateTime>("Modified")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(50)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(51);
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(1);
b.Property<Guid>("TemplateCategoryId")
.HasColumnType("uniqueidentifier");
b.Property<string>("Version")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(3);
b.HasKey("Id");
b.HasIndex("TemplateCategoryId");
b.ToTable("Templates");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.TemplateOptionModel", b =>
{
b.Property<Guid>("OptionId")
.HasColumnType("uniqueidentifier")
.HasColumnOrder(1);
b.Property<Guid>("TemplateId")
.HasColumnType("uniqueidentifier")
.HasColumnOrder(0);
b.Property<DateTime>("Created")
.HasColumnType("datetime2")
.HasColumnOrder(52);
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(53);
b.Property<DateTime>("Modified")
.HasColumnType("datetime2")
.HasColumnOrder(50);
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(51);
b.Property<string>("Value")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(2);
b.HasKey("OptionId", "TemplateId");
b.HasIndex("TemplateId");
b.ToTable("TemplateOptions");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.VirtualMachineModel", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasColumnOrder(0)
.HasDefaultValueSql("NEWID()");
b.Property<DateTime>("Created")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(52)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(53);
b.Property<Guid>("DomainID")
.HasColumnType("uniqueidentifier")
.HasColumnOrder(1);
b.Property<DateTime>("Modified")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(50)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(51);
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(2);
b.HasKey("Id");
b.HasIndex("DomainID");
b.ToTable("VirtualMachines");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.DeploymentGroupModel", b =>
{
b.HasOne("Microsoft.SelfService.Portal.Core.API.Models.TemplateModel", "Template")
.WithMany("DeploymentGroups")
.HasForeignKey("TemplateId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Template");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.DeploymentModel", b =>
{
b.HasOne("Microsoft.SelfService.Portal.Core.API.Models.DeploymentGroupModel", "DeploymentGroup")
.WithMany("Deployments")
.HasForeignKey("DeploymentGroupId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Microsoft.SelfService.Portal.Core.API.Models.VirtualMachineModel", "VirtualMachine")
.WithMany("Deployments")
.HasForeignKey("VirtualMachineId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("DeploymentGroup");
b.Navigation("VirtualMachine");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.EnvironmentDomainsModel", b =>
{
b.HasOne("Microsoft.SelfService.Portal.Core.API.Models.DomainModel", "Domain")
.WithMany("EnvironmentDomains")
.HasForeignKey("DomainId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Microsoft.SelfService.Portal.Core.API.Models.EnvironmentModel", "Environment")
.WithMany("EnvironmentDomains")
.HasForeignKey("EnvironmentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Domain");
b.Navigation("Environment");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.EventModel", b =>
{
b.HasOne("Microsoft.SelfService.Portal.Core.API.Models.RunbookModel", "Runbook")
.WithMany("Events")
.HasForeignKey("RunbookId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Runbook");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.JobModel", b =>
{
b.HasOne("Microsoft.SelfService.Portal.Core.API.Models.DeploymentModel", "Deployment")
.WithMany("Jobs")
.HasForeignKey("DeploymentId")
.HasPrincipalKey("Id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Microsoft.SelfService.Portal.Core.API.Models.RunbookModel", "Runbook")
.WithMany("Jobs")
.HasForeignKey("RunbookId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Deployment");
b.Navigation("Runbook");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.OptionModel", b =>
{
b.HasOne("Microsoft.SelfService.Portal.Core.API.Models.OptionCategoryModel", "OptionCategory")
.WithMany("Options")
.HasForeignKey("OptionCategoryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("OptionCategory");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.TemplateCategoryModel", b =>
{
b.HasOne("Microsoft.SelfService.Portal.Core.API.Models.ServiceModel", "Service")
.WithMany("TemplateCategories")
.HasForeignKey("ServiceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Service");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.TemplateModel", b =>
{
b.HasOne("Microsoft.SelfService.Portal.Core.API.Models.TemplateCategoryModel", "TemplateCategory")
.WithMany("Templates")
.HasForeignKey("TemplateCategoryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("TemplateCategory");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.TemplateOptionModel", b =>
{
b.HasOne("Microsoft.SelfService.Portal.Core.API.Models.OptionModel", "Option")
.WithMany("TemplateOptions")
.HasForeignKey("OptionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Microsoft.SelfService.Portal.Core.API.Models.TemplateModel", "Template")
.WithMany("TemplateOptions")
.HasForeignKey("TemplateId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Option");
b.Navigation("Template");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.VirtualMachineModel", b =>
{
b.HasOne("Microsoft.SelfService.Portal.Core.API.Models.DomainModel", "Domain")
.WithMany("VirtualMachines")
.HasForeignKey("DomainID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Domain");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.DeploymentGroupModel", b =>
{
b.Navigation("Deployments");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.DeploymentModel", b =>
{
b.Navigation("Jobs");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.DomainModel", b =>
{
b.Navigation("EnvironmentDomains");
b.Navigation("VirtualMachines");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.EnvironmentModel", b =>
{
b.Navigation("EnvironmentDomains");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.OptionCategoryModel", b =>
{
b.Navigation("Options");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.OptionModel", b =>
{
b.Navigation("TemplateOptions");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.RunbookModel", b =>
{
b.Navigation("Events");
b.Navigation("Jobs");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.ServiceModel", b =>
{
b.Navigation("TemplateCategories");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.TemplateCategoryModel", b =>
{
b.Navigation("Templates");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.TemplateModel", b =>
{
b.Navigation("DeploymentGroups");
b.Navigation("TemplateOptions");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.VirtualMachineModel", b =>
{
b.Navigation("Deployments");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,468 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Microsoft.SelfService.Portal.Core.API.Migrations
{
/// <inheritdoc />
public partial class Initial : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Domains",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false, defaultValueSql: "NEWID()"),
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
FQDN = table.Column<string>(type: "nvarchar(max)", nullable: false),
NetBIOS = table.Column<string>(type: "nvarchar(max)", nullable: false),
Modified = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
ModifiedBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
Created = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Domains", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Environments",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false, defaultValueSql: "NEWID()"),
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
CloudEnabled = table.Column<bool>(type: "bit", nullable: false),
Modified = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
ModifiedBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
Created = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Environments", x => x.Id);
});
migrationBuilder.CreateTable(
name: "OptionCategories",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false, defaultValueSql: "NEWID()"),
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
ParentCategoryName = table.Column<string>(type: "nvarchar(max)", nullable: false),
showOrder = table.Column<int>(type: "int", nullable: false),
Modified = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
ModifiedBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
Created = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_OptionCategories", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Runbooks",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false, defaultValueSql: "NEWID()"),
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
Description = table.Column<string>(type: "nvarchar(max)", nullable: false),
Modified = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
ModifiedBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
Created = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Runbooks", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Services",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false, defaultValueSql: "NEWID()"),
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
Description = table.Column<string>(type: "nvarchar(max)", nullable: false),
Modified = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
ModifiedBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
Created = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Services", x => x.Id);
});
migrationBuilder.CreateTable(
name: "VirtualMachines",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false, defaultValueSql: "NEWID()"),
DomainID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
Modified = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
ModifiedBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
Created = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_VirtualMachines", x => x.Id);
table.ForeignKey(
name: "FK_VirtualMachines_Domains_DomainID",
column: x => x.DomainID,
principalTable: "Domains",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "EnvironmentDomains",
columns: table => new
{
EnvironmentId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
DomainId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Modified = table.Column<DateTime>(type: "datetime2", nullable: false),
ModifiedBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
Created = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_EnvironmentDomains", x => new { x.EnvironmentId, x.DomainId });
table.ForeignKey(
name: "FK_EnvironmentDomains_Domains_DomainId",
column: x => x.DomainId,
principalTable: "Domains",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_EnvironmentDomains_Environments_EnvironmentId",
column: x => x.EnvironmentId,
principalTable: "Environments",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Options",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false, defaultValueSql: "NEWID()"),
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
OptionType = table.Column<string>(type: "nvarchar(max)", nullable: false),
OptionValue = table.Column<string>(type: "nvarchar(max)", nullable: false),
Modified = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
ModifiedBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
Created = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
OptionCategoryId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Options", x => x.Id);
table.ForeignKey(
name: "FK_Options_OptionCategories_OptionCategoryId",
column: x => x.OptionCategoryId,
principalTable: "OptionCategories",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Events",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false, defaultValueSql: "NEWID()"),
RunbookId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Class = table.Column<string>(type: "nvarchar(max)", nullable: false),
Method = table.Column<string>(type: "nvarchar(max)", nullable: false),
RestEndpointMethod = table.Column<string>(type: "nvarchar(max)", nullable: false),
RestEndpointOperation = table.Column<string>(type: "nvarchar(max)", nullable: false),
Modified = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
ModifiedBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
Created = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Events", x => x.Id);
table.ForeignKey(
name: "FK_Events_Runbooks_RunbookId",
column: x => x.RunbookId,
principalTable: "Runbooks",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "TemplateCategories",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false, defaultValueSql: "NEWID()"),
ServiceId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
ParentCategoryName = table.Column<string>(type: "nvarchar(max)", nullable: false),
showOrder = table.Column<int>(type: "int", nullable: false),
Modified = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
ModifiedBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
Created = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_TemplateCategories", x => x.Id);
table.ForeignKey(
name: "FK_TemplateCategories_Services_ServiceId",
column: x => x.ServiceId,
principalTable: "Services",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Templates",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false, defaultValueSql: "NEWID()"),
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
CloudTemplate = table.Column<bool>(type: "bit", nullable: false),
Version = table.Column<string>(type: "nvarchar(max)", nullable: false),
Description = table.Column<string>(type: "nvarchar(max)", nullable: false),
JSONData = table.Column<string>(type: "nvarchar(max)", nullable: false),
Modified = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
ModifiedBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
Created = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
TemplateCategoryId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Templates", x => x.Id);
table.ForeignKey(
name: "FK_Templates_TemplateCategories_TemplateCategoryId",
column: x => x.TemplateCategoryId,
principalTable: "TemplateCategories",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "DeploymentGroups",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false, defaultValueSql: "NEWID()"),
TemplateId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Status = table.Column<string>(type: "nvarchar(max)", nullable: false, defaultValueSql: "'New'"),
Modified = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
ModifiedBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
Created = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DeploymentGroups", x => x.Id);
table.ForeignKey(
name: "FK_DeploymentGroups_Templates_TemplateId",
column: x => x.TemplateId,
principalTable: "Templates",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "TemplateOptions",
columns: table => new
{
TemplateId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
OptionId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Value = table.Column<string>(type: "nvarchar(max)", nullable: false),
Modified = table.Column<DateTime>(type: "datetime2", nullable: false),
ModifiedBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
Created = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_TemplateOptions", x => new { x.OptionId, x.TemplateId });
table.ForeignKey(
name: "FK_TemplateOptions_Options_OptionId",
column: x => x.OptionId,
principalTable: "Options",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_TemplateOptions_Templates_TemplateId",
column: x => x.TemplateId,
principalTable: "Templates",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Deployments",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false, defaultValueSql: "NEWID()"),
DeploymentGroupId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
VirtualMachineId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Status = table.Column<string>(type: "nvarchar(max)", nullable: false),
JSONData = table.Column<string>(type: "nvarchar(max)", nullable: false),
Modified = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
ModifiedBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
Created = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Deployments", x => new { x.VirtualMachineId, x.DeploymentGroupId });
table.UniqueConstraint("AK_Deployments_Id", x => x.Id);
table.ForeignKey(
name: "FK_Deployments_DeploymentGroups_DeploymentGroupId",
column: x => x.DeploymentGroupId,
principalTable: "DeploymentGroups",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Deployments_VirtualMachines_VirtualMachineId",
column: x => x.VirtualMachineId,
principalTable: "VirtualMachines",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Jobs",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false, defaultValueSql: "NEWID()"),
DeploymentId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
RunbookId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Modified = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
ModifiedBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
Created = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETDATE()"),
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Jobs", x => new { x.RunbookId, x.DeploymentId });
table.ForeignKey(
name: "FK_Jobs_Deployments_DeploymentId",
column: x => x.DeploymentId,
principalTable: "Deployments",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Jobs_Runbooks_RunbookId",
column: x => x.RunbookId,
principalTable: "Runbooks",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_DeploymentGroups_TemplateId",
table: "DeploymentGroups",
column: "TemplateId");
migrationBuilder.CreateIndex(
name: "IX_Deployments_DeploymentGroupId",
table: "Deployments",
column: "DeploymentGroupId");
migrationBuilder.CreateIndex(
name: "IX_EnvironmentDomains_DomainId",
table: "EnvironmentDomains",
column: "DomainId");
migrationBuilder.CreateIndex(
name: "IX_Events_RunbookId",
table: "Events",
column: "RunbookId");
migrationBuilder.CreateIndex(
name: "IX_Jobs_DeploymentId",
table: "Jobs",
column: "DeploymentId");
migrationBuilder.CreateIndex(
name: "IX_Options_OptionCategoryId",
table: "Options",
column: "OptionCategoryId");
migrationBuilder.CreateIndex(
name: "IX_TemplateCategories_ServiceId",
table: "TemplateCategories",
column: "ServiceId");
migrationBuilder.CreateIndex(
name: "IX_TemplateOptions_TemplateId",
table: "TemplateOptions",
column: "TemplateId");
migrationBuilder.CreateIndex(
name: "IX_Templates_TemplateCategoryId",
table: "Templates",
column: "TemplateCategoryId");
migrationBuilder.CreateIndex(
name: "IX_VirtualMachines_DomainID",
table: "VirtualMachines",
column: "DomainID");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "EnvironmentDomains");
migrationBuilder.DropTable(
name: "Events");
migrationBuilder.DropTable(
name: "Jobs");
migrationBuilder.DropTable(
name: "TemplateOptions");
migrationBuilder.DropTable(
name: "Environments");
migrationBuilder.DropTable(
name: "Deployments");
migrationBuilder.DropTable(
name: "Runbooks");
migrationBuilder.DropTable(
name: "Options");
migrationBuilder.DropTable(
name: "DeploymentGroups");
migrationBuilder.DropTable(
name: "VirtualMachines");
migrationBuilder.DropTable(
name: "OptionCategories");
migrationBuilder.DropTable(
name: "Templates");
migrationBuilder.DropTable(
name: "Domains");
migrationBuilder.DropTable(
name: "TemplateCategories");
migrationBuilder.DropTable(
name: "Services");
}
}
}

View File

@@ -0,0 +1,968 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Microsoft.SelfService.Portal.Core.API.Context;
#nullable disable
namespace Microsoft.SelfService.Portal.Core.API.Migrations
{
[DbContext(typeof(DataContext))]
partial class DataContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.9")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.DeploymentGroupModel", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasColumnOrder(0)
.HasDefaultValueSql("NEWID()");
b.Property<DateTime>("Created")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(52)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(53);
b.Property<DateTime>("Modified")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(50)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(51);
b.Property<string>("Status")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(4)
.HasDefaultValueSql("'New'");
b.Property<Guid>("TemplateId")
.HasColumnType("uniqueidentifier")
.HasColumnOrder(2);
b.HasKey("Id");
b.HasIndex("TemplateId");
b.ToTable("DeploymentGroups");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.DeploymentModel", b =>
{
b.Property<Guid>("VirtualMachineId")
.HasColumnType("uniqueidentifier")
.HasColumnOrder(3);
b.Property<Guid>("DeploymentGroupId")
.HasColumnType("uniqueidentifier")
.HasColumnOrder(2);
b.Property<DateTime>("Created")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(52)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(53);
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasColumnOrder(0)
.HasDefaultValueSql("NEWID()");
b.Property<string>("JSONData")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(5);
b.Property<DateTime>("Modified")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(50)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(51);
b.Property<string>("Status")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(4);
b.HasKey("VirtualMachineId", "DeploymentGroupId");
b.HasIndex("DeploymentGroupId");
b.ToTable("Deployments");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.DomainModel", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasColumnOrder(0)
.HasDefaultValueSql("NEWID()");
b.Property<DateTime>("Created")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(52)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(53);
b.Property<string>("FQDN")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(2);
b.Property<DateTime>("Modified")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(50)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(51);
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(1);
b.Property<string>("NetBIOS")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(3);
b.HasKey("Id");
b.ToTable("Domains");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.EnvironmentDomainsModel", b =>
{
b.Property<Guid>("EnvironmentId")
.HasColumnType("uniqueidentifier")
.HasColumnOrder(0);
b.Property<Guid>("DomainId")
.HasColumnType("uniqueidentifier")
.HasColumnOrder(1);
b.Property<DateTime>("Created")
.HasColumnType("datetime2")
.HasColumnOrder(52);
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(53);
b.Property<DateTime>("Modified")
.HasColumnType("datetime2")
.HasColumnOrder(50);
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(51);
b.HasKey("EnvironmentId", "DomainId");
b.HasIndex("DomainId");
b.ToTable("EnvironmentDomains");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.EnvironmentModel", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasColumnOrder(0)
.HasDefaultValueSql("NEWID()");
b.Property<bool>("CloudEnabled")
.HasColumnType("bit")
.HasColumnOrder(2);
b.Property<DateTime>("Created")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(52)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(53);
b.Property<DateTime>("Modified")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(50)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(51);
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(1);
b.HasKey("Id");
b.ToTable("Environments");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.EventModel", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasColumnOrder(0)
.HasDefaultValueSql("NEWID()");
b.Property<string>("Class")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(2);
b.Property<DateTime>("Created")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(52)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(53);
b.Property<string>("Method")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(3);
b.Property<DateTime>("Modified")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(50)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(51);
b.Property<string>("RestEndpointMethod")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(4);
b.Property<string>("RestEndpointOperation")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(5);
b.Property<Guid>("RunbookId")
.HasColumnType("uniqueidentifier")
.HasColumnOrder(1);
b.HasKey("Id");
b.HasIndex("RunbookId");
b.ToTable("Events");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.JobModel", b =>
{
b.Property<Guid>("RunbookId")
.HasColumnType("uniqueidentifier")
.HasColumnOrder(2);
b.Property<Guid>("DeploymentId")
.HasColumnType("uniqueidentifier")
.HasColumnOrder(1);
b.Property<DateTime>("Created")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(52)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(53);
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasColumnOrder(0)
.HasDefaultValueSql("NEWID()");
b.Property<DateTime>("Modified")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(50)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(51);
b.HasKey("RunbookId", "DeploymentId");
b.HasIndex("DeploymentId");
b.ToTable("Jobs");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.OptionCategoryModel", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasColumnOrder(0)
.HasDefaultValueSql("NEWID()");
b.Property<DateTime>("Created")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(52)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(53);
b.Property<DateTime>("Modified")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(50)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(51);
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(1);
b.Property<string>("ParentCategoryName")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(2);
b.Property<int>("showOrder")
.HasColumnType("int")
.HasColumnOrder(3);
b.HasKey("Id");
b.ToTable("OptionCategories");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.OptionModel", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasColumnOrder(0)
.HasDefaultValueSql("NEWID()");
b.Property<DateTime>("Created")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(52)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(53);
b.Property<DateTime>("Modified")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(50)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(51);
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(1);
b.Property<Guid>("OptionCategoryId")
.HasColumnType("uniqueidentifier");
b.Property<string>("OptionType")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(2);
b.Property<string>("OptionValue")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(3);
b.HasKey("Id");
b.HasIndex("OptionCategoryId");
b.ToTable("Options");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.RunbookModel", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasColumnOrder(0)
.HasDefaultValueSql("NEWID()");
b.Property<DateTime>("Created")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(52)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(53);
b.Property<string>("Description")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(2);
b.Property<DateTime>("Modified")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(50)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(51);
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(1);
b.HasKey("Id");
b.ToTable("Runbooks");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.ServiceModel", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasColumnOrder(0)
.HasDefaultValueSql("NEWID()");
b.Property<DateTime>("Created")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(52)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(53);
b.Property<string>("Description")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(2);
b.Property<DateTime>("Modified")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(50)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(51);
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(1);
b.HasKey("Id");
b.ToTable("Services");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.TemplateCategoryModel", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasColumnOrder(0)
.HasDefaultValueSql("NEWID()");
b.Property<DateTime>("Created")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(52)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(53);
b.Property<DateTime>("Modified")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(50)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(51);
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(2);
b.Property<string>("ParentCategoryName")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(3);
b.Property<Guid>("ServiceId")
.HasColumnType("uniqueidentifier")
.HasColumnOrder(1);
b.Property<int>("showOrder")
.HasColumnType("int")
.HasColumnOrder(4);
b.HasKey("Id");
b.HasIndex("ServiceId");
b.ToTable("TemplateCategories");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.TemplateModel", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasColumnOrder(0)
.HasDefaultValueSql("NEWID()");
b.Property<bool>("CloudTemplate")
.HasColumnType("bit")
.HasColumnOrder(2);
b.Property<DateTime>("Created")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(52)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(53);
b.Property<string>("Description")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(4);
b.Property<string>("JSONData")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(5);
b.Property<DateTime>("Modified")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(50)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(51);
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(1);
b.Property<Guid>("TemplateCategoryId")
.HasColumnType("uniqueidentifier");
b.Property<string>("Version")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(3);
b.HasKey("Id");
b.HasIndex("TemplateCategoryId");
b.ToTable("Templates");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.TemplateOptionModel", b =>
{
b.Property<Guid>("OptionId")
.HasColumnType("uniqueidentifier")
.HasColumnOrder(1);
b.Property<Guid>("TemplateId")
.HasColumnType("uniqueidentifier")
.HasColumnOrder(0);
b.Property<DateTime>("Created")
.HasColumnType("datetime2")
.HasColumnOrder(52);
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(53);
b.Property<DateTime>("Modified")
.HasColumnType("datetime2")
.HasColumnOrder(50);
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(51);
b.Property<string>("Value")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(2);
b.HasKey("OptionId", "TemplateId");
b.HasIndex("TemplateId");
b.ToTable("TemplateOptions");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.VirtualMachineModel", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasColumnOrder(0)
.HasDefaultValueSql("NEWID()");
b.Property<DateTime>("Created")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(52)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(53);
b.Property<Guid>("DomainID")
.HasColumnType("uniqueidentifier")
.HasColumnOrder(1);
b.Property<DateTime>("Modified")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasColumnOrder(50)
.HasDefaultValueSql("GETDATE()");
b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(51);
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasColumnOrder(2);
b.HasKey("Id");
b.HasIndex("DomainID");
b.ToTable("VirtualMachines");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.DeploymentGroupModel", b =>
{
b.HasOne("Microsoft.SelfService.Portal.Core.API.Models.TemplateModel", "Template")
.WithMany("DeploymentGroups")
.HasForeignKey("TemplateId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Template");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.DeploymentModel", b =>
{
b.HasOne("Microsoft.SelfService.Portal.Core.API.Models.DeploymentGroupModel", "DeploymentGroup")
.WithMany("Deployments")
.HasForeignKey("DeploymentGroupId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Microsoft.SelfService.Portal.Core.API.Models.VirtualMachineModel", "VirtualMachine")
.WithMany("Deployments")
.HasForeignKey("VirtualMachineId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("DeploymentGroup");
b.Navigation("VirtualMachine");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.EnvironmentDomainsModel", b =>
{
b.HasOne("Microsoft.SelfService.Portal.Core.API.Models.DomainModel", "Domain")
.WithMany("EnvironmentDomains")
.HasForeignKey("DomainId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Microsoft.SelfService.Portal.Core.API.Models.EnvironmentModel", "Environment")
.WithMany("EnvironmentDomains")
.HasForeignKey("EnvironmentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Domain");
b.Navigation("Environment");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.EventModel", b =>
{
b.HasOne("Microsoft.SelfService.Portal.Core.API.Models.RunbookModel", "Runbook")
.WithMany("Events")
.HasForeignKey("RunbookId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Runbook");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.JobModel", b =>
{
b.HasOne("Microsoft.SelfService.Portal.Core.API.Models.DeploymentModel", "Deployment")
.WithMany("Jobs")
.HasForeignKey("DeploymentId")
.HasPrincipalKey("Id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Microsoft.SelfService.Portal.Core.API.Models.RunbookModel", "Runbook")
.WithMany("Jobs")
.HasForeignKey("RunbookId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Deployment");
b.Navigation("Runbook");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.OptionModel", b =>
{
b.HasOne("Microsoft.SelfService.Portal.Core.API.Models.OptionCategoryModel", "OptionCategory")
.WithMany("Options")
.HasForeignKey("OptionCategoryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("OptionCategory");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.TemplateCategoryModel", b =>
{
b.HasOne("Microsoft.SelfService.Portal.Core.API.Models.ServiceModel", "Service")
.WithMany("TemplateCategories")
.HasForeignKey("ServiceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Service");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.TemplateModel", b =>
{
b.HasOne("Microsoft.SelfService.Portal.Core.API.Models.TemplateCategoryModel", "TemplateCategory")
.WithMany("Templates")
.HasForeignKey("TemplateCategoryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("TemplateCategory");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.TemplateOptionModel", b =>
{
b.HasOne("Microsoft.SelfService.Portal.Core.API.Models.OptionModel", "Option")
.WithMany("TemplateOptions")
.HasForeignKey("OptionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Microsoft.SelfService.Portal.Core.API.Models.TemplateModel", "Template")
.WithMany("TemplateOptions")
.HasForeignKey("TemplateId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Option");
b.Navigation("Template");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.VirtualMachineModel", b =>
{
b.HasOne("Microsoft.SelfService.Portal.Core.API.Models.DomainModel", "Domain")
.WithMany("VirtualMachines")
.HasForeignKey("DomainID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Domain");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.DeploymentGroupModel", b =>
{
b.Navigation("Deployments");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.DeploymentModel", b =>
{
b.Navigation("Jobs");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.DomainModel", b =>
{
b.Navigation("EnvironmentDomains");
b.Navigation("VirtualMachines");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.EnvironmentModel", b =>
{
b.Navigation("EnvironmentDomains");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.OptionCategoryModel", b =>
{
b.Navigation("Options");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.OptionModel", b =>
{
b.Navigation("TemplateOptions");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.RunbookModel", b =>
{
b.Navigation("Events");
b.Navigation("Jobs");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.ServiceModel", b =>
{
b.Navigation("TemplateCategories");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.TemplateCategoryModel", b =>
{
b.Navigation("Templates");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.TemplateModel", b =>
{
b.Navigation("DeploymentGroups");
b.Navigation("TemplateOptions");
});
modelBuilder.Entity("Microsoft.SelfService.Portal.Core.API.Models.VirtualMachineModel", b =>
{
b.Navigation("Deployments");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,21 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Models
{
public class BaseJunctionModel
{
[Column(Order = 50)]
//[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
public DateTime Modified { get; set; } = DateTime.Now;
[Column(Order = 51)]
//[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
public string ModifiedBy { get; set; } = new HttpContextAccessor().HttpContext.User.Identity.Name;
[Column(Order = 52)]
//[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public DateTime Created { get; set; } = DateTime.Now;
[Column(Order = 53)]
//[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public string CreatedBy { get; set; } = new HttpContextAccessor().HttpContext.User.Identity.Name;
}
}

38
Models/BaseModel.cs Normal file
View File

@@ -0,0 +1,38 @@
using Azure;
using Azure.Core;
using Microsoft.AspNetCore.Identity;
using Microsoft.SelfService.Portal.Core.API.Extensions.Dataannotations;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Models
{
public class BaseModel
{
[Column(Order = 0)]
[DefaultValueSql("NEWID()")]
//[DatabaseGenerated(DatabaseGeneratedOption.None)]
public Guid Id { get; set; }
[Column(Order = 50)]
[DefaultValueSql("GETDATE()")]
//[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
public DateTime Modified { get; set; } = DateTime.Now;
[Column(Order = 51)]
[DefaultValue("System")]
//[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
public string ModifiedBy { get; set; } = new HttpContextAccessor().HttpContext.User.Identity.Name;
[Column(Order = 52)]
[DefaultValueSql("GETDATE()")]
//[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public DateTime Created { get; set; } = DateTime.Now;
[Column(Order = 53)]
[DefaultValue("System")]
//[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
//public string CreatedBy { get; set; } = "CCIS-P01S01-CM\\ASA_SSP_Admin";
public string CreatedBy { get; set; } = new HttpContextAccessor().HttpContext.User.Identity.Name;
}
}

View File

@@ -0,0 +1,19 @@
using Microsoft.SelfService.Portal.Core.API.Extensions.Dataannotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Models
{
public class DeploymentGroupModel : BaseModel
{
[Column(Order = 2)]
public Guid TemplateId { get; set; }
[Column(Order = 4)]
[DefaultValueSql("'New'")]
public string Status { get; set; }
public TemplateModel Template { get; set; }
public ICollection<DeploymentModel> Deployments { get; set; }
}
}

22
Models/DeploymentModel.cs Normal file
View File

@@ -0,0 +1,22 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Models
{
public class DeploymentModel : BaseModel
{
[Column(Order = 2)]
public Guid DeploymentGroupId { get; set; }
[Column(Order = 3)]
public Guid VirtualMachineId { get; set; }
[Column(Order = 4)]
public string Status { get; set; }
[Column(Order = 5)]
public string JSONData { get; set; }
public DeploymentGroupModel DeploymentGroup { get; set; }
public VirtualMachineModel VirtualMachine { get; set; }
public ICollection<JobModel> Jobs { get; set; }
}
}

20
Models/DomainModel.cs Normal file
View File

@@ -0,0 +1,20 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
namespace Microsoft.SelfService.Portal.Core.API.Models
{
public class DomainModel : BaseModel
{
[Column(Order = 1)]
public string Name { get; set; }
[Column(Order = 2)]
public string FQDN { get; set; }
[Column(Order = 3)]
public string NetBIOS { get; set; }
public ICollection<EnvironmentDomainsModel> EnvironmentDomains { get; set; }
public ICollection<VirtualMachineModel> VirtualMachines { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Models
{
public class EnvironmentDomainsModel : BaseJunctionModel
{
[Column(Order = 0)]
public Guid EnvironmentId { get; set; }
public EnvironmentModel Environment { get; set; }
[Column(Order = 1)]
public Guid DomainId { get; set; }
public DomainModel Domain { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Models
{
public class EnvironmentModel : BaseModel
{
[Column(Order = 1)]
public string Name { get; set; }
[Column(Order = 2)]
public bool CloudEnabled { get; set; }
public ICollection<EnvironmentDomainsModel> EnvironmentDomains { get; set; }
}
}

21
Models/EventModel.cs Normal file
View File

@@ -0,0 +1,21 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Models
{
public class EventModel : BaseModel
{
[Column(Order = 1)]
public Guid RunbookId { get; set; }
[Column(Order = 2)]
public string Class { get; set; }
[Column(Order = 3)]
public string Method { get; set; }
[Column(Order = 4)]
public string RestEndpointMethod { get; set; }
[Column(Order = 5)]
public string RestEndpointOperation { get; set; }
public RunbookModel Runbook { get; set; }
}
}

15
Models/JobModel.cs Normal file
View File

@@ -0,0 +1,15 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Models
{
public class JobModel : BaseModel
{
[Column(Order = 1)]
public Guid DeploymentId { get; set; }
[Column(Order = 2)]
public Guid RunbookId { get; set; }
public DeploymentModel Deployment { get; set; }
public RunbookModel Runbook { get; set; }
}
}

View File

@@ -0,0 +1,16 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Models
{
public class OptionCategoryModel : BaseModel
{
[Column(Order = 1)]
public string Name { get; set; }
[Column(Order = 2)]
public string ParentCategoryName { get; set; }
[Column(Order = 3)]
public int showOrder { get; set; }
public ICollection<OptionModel> Options { get; set; }
}
}

19
Models/OptionModel.cs Normal file
View File

@@ -0,0 +1,19 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
namespace Microsoft.SelfService.Portal.Core.API.Models
{
public class OptionModel : BaseModel
{
[Column(Order = 1)]
public string Name { get; set; }
[Column(Order = 2)]
public string OptionType { get; set; }
[Column(Order = 3)]
public string OptionValue { get; set; }
public OptionCategoryModel OptionCategory { get; set; }
public ICollection<TemplateOptionModel> TemplateOptions { get; set; }
}
}

16
Models/RunbookModel.cs Normal file
View File

@@ -0,0 +1,16 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Models
{
public class RunbookModel : BaseModel
{
[Column(Order = 1)]
public string Name { get; set; }
[Column(Order = 2)]
public string Description { get; set; }
public ICollection<JobModel> Jobs { get; set; }
public ICollection<EventModel> Events { get; set; }
}
}

14
Models/ServiceModel.cs Normal file
View File

@@ -0,0 +1,14 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Models
{
public class ServiceModel : BaseModel
{
[Column(Order = 1)]
public string Name { get; set; }
[Column(Order = 2)]
public string Description { get; set; }
public ICollection<TemplateCategoryModel> TemplateCategories { get; set; }
}
}

View File

@@ -0,0 +1,20 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Models
{
public class TemplateCategoryModel : BaseModel
{
[Column(Order = 1)]
public Guid ServiceId { get; set; }
[Column(Order = 2)]
public string Name { get; set; }
[Column(Order = 3)]
public string ParentCategoryName { get; set; }
[Column(Order = 4)]
public int showOrder { get; set; }
public ServiceModel Service { get; set; }
public ICollection<TemplateModel> Templates { get; set; }
}
}

28
Models/TemplateModel.cs Normal file
View File

@@ -0,0 +1,28 @@
using Microsoft.Identity.Client;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
namespace Microsoft.SelfService.Portal.Core.API.Models
{
public class TemplateModel : BaseModel
{
[Column(Order = 1)]
public string Name { get; set; }
[Column(Order = 2)]
[RegularExpression("On Premise|Hybrid|Cloud")]
public bool CloudTemplate { get; set; }
[Column(Order = 3)]
public string Version { get; set; }
[Column(Order = 4)]
public string Description { get; set; }
[Column(Order = 5)]
public string JSONData { get; set; }
public TemplateCategoryModel TemplateCategory { get; set; }
public ICollection<DeploymentGroupModel> DeploymentGroups { get; set; }
public ICollection<TemplateOptionModel> TemplateOptions { get; set; }
}
}

View File

@@ -0,0 +1,19 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Microsoft.SelfService.Portal.Core.API.Models
{
public class TemplateOptionModel: BaseJunctionModel
{
[Column(Order = 0)]
public Guid TemplateId { get; set; }
public TemplateModel Template { get; set; }
[Column(Order = 1)]
public Guid OptionId { get; set; }
public OptionModel Option { get; set; }
[Column(Order = 2)]
public string Value { get; set; }
}
}

View File

@@ -0,0 +1,19 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
namespace Microsoft.SelfService.Portal.Core.API.Models
{
public class VirtualMachineModel : BaseModel
{
[Column(Order = 1)]
public Guid DomainID { get; set; }
[Column(Order = 2)]
public string Name { get; set; }
public DomainModel Domain { get; set; }
public ICollection<DeploymentModel> Deployments { get; set; }
}
}

66
Program.cs Normal file
View File

@@ -0,0 +1,66 @@
using Microsoft.AspNetCore.Authentication.Negotiate;
using Microsoft.EntityFrameworkCore;
using Microsoft.SelfService.Portal.Core.API.Context;
using Microsoft.SelfService.Portal.Core.API.Events;
using Microsoft.SelfService.Portal.Core.API.Events.Interfaces;
using Microsoft.SelfService.Portal.Core.API.Interfaces;
using Microsoft.SelfService.Portal.Core.API.Repository;
using System.Text.Json.Serialization;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllers().AddJsonOptions(options =>
{
options.JsonSerializerOptions.ReferenceHandler = ReferenceHandler.IgnoreCycles;
});
builder.Services.AddScoped<IEventHandlerInterface, AbstractEventHandler>();
builder.Services.AddScoped<IDomainInterface,DomainRepository>();
builder.Services.AddScoped<IEnvironmentInterface, EnvironmentRepository>();
builder.Services.AddScoped<IVirtualMachineInterface, VirtualMachineRepository>();
builder.Services.AddScoped<IServiceInterface, ServiceRepository>();
builder.Services.AddScoped<IRunbookInterface, RunbookRepository>();
builder.Services.AddScoped<IDeploymentGroupInterface, DeploymentGroupRepository>();
builder.Services.AddScoped<IDeploymentInterface, DeploymentRepository>();
builder.Services.AddScoped<ITemplateInterface, TemplateRepository>();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
builder.Services.AddDbContext<DataContext>(options =>
options.UseSqlServer(builder.Configuration.GetConnectionString("Context") ?? throw new InvalidOperationException("Connection string 'Context' not found.")));
builder.Services.AddAuthentication(NegotiateDefaults.AuthenticationScheme)
.AddNegotiate();
builder.Services.AddHttpContextAccessor();
builder.Services.AddAuthorization(options =>
{
// By default, all incoming requests will be authorized according to the default policy.
options.FallbackPolicy = options.DefaultPolicy;
});
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
//{
app.UseSwagger();
app.UseSwaggerUI();
//}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<DeleteExistingFiles>true</DeleteExistingFiles>
<ExcludeApp_Data>false</ExcludeApp_Data>
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>C:\inetpub\Microsoft Self Service Portal API</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
<_TargetId>Folder</_TargetId>
<SiteUrlToLaunchAfterPublish />
<TargetFramework>net7.0</TargetFramework>
<ProjectGuid>ee9e4955-5ce7-472b-b3fe-a4550dfbdc53</ProjectGuid>
<SelfContained>false</SelfContained>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<TimeStampOfAssociatedLegacyPublishXmlFile />
<_PublishTargetUrl>C:\inetpub\Microsoft Self Service Portal API</_PublishTargetUrl>
<History>True|2023-10-30T23:03:57.4691598Z;False|2023-10-30T23:03:28.4263732+00:00;False|2023-10-30T23:03:10.4244753+00:00;True|2023-10-19T18:17:22.9971247+00:00;True|2023-10-12T21:15:40.6582775+00:00;False|2023-10-12T21:15:05.3432699+00:00;False|2023-10-12T21:14:48.7474713+00:00;True|2023-10-11T12:21:56.3357705+00:00;True|2023-10-10T21:34:48.6836324+00:00;False|2023-10-10T21:34:09.6089597+00:00;True|2023-10-03T17:11:56.8903089+00:00;False|2023-10-03T17:11:43.4811712+00:00;True|2023-10-01T17:52:53.3019925+00:00;False|2023-10-01T17:36:47.3305738+00:00;False|2023-10-01T17:36:03.5468872+00:00;False|2023-10-01T17:35:54.0675100+00:00;True|2023-10-01T16:50:17.2387977+00:00;False|2023-10-01T16:50:03.4293655+00:00;True|2023-10-01T16:27:59.9734754+00:00;True|2023-08-02T13:16:46.4800835+00:00;True|2023-07-24T13:32:21.4039801+00:00;True|2023-07-24T13:18:12.5812925+00:00;True|2023-07-24T12:46:57.3702928+00:00;True|2023-07-24T12:43:33.5644585+00:00;False|2023-07-24T12:42:38.3615066+00:00;True|2023-07-24T12:32:59.9668490+00:00;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,41 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": true,
"anonymousAuthentication": false,
"iisExpress": {
"applicationUrl": "http://localhost:54924",
"sslPort": 44309
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:5286",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:7260;http://localhost:5286",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

View File

@@ -0,0 +1,13 @@
{
"dependencies": {
"secrets1": {
"type": "secrets",
"dynamicId": null
},
"mssql1": {
"type": "mssql",
"connectionId": "ConnectionStrings:Context",
"dynamicId": null
}
}
}

View File

@@ -0,0 +1,15 @@
{
"dependencies": {
"secrets1": {
"type": "secrets.user",
"dynamicId": null
},
"mssql1": {
"serviceConnectorResourceId": "",
"secretStore": "LocalSecretsFile",
"type": "mssql.onprem",
"connectionId": "ConnectionStrings:Context",
"dynamicId": null
}
}
}

View File

@@ -0,0 +1,13 @@
{
"dependencies": {
"mssql1": {
"restored": true,
"restoreTime": "2023-07-21T18:25:39.5407544Z"
},
"secrets1": {
"restored": true,
"restoreTime": "2023-07-21T09:27:23.557904Z"
}
},
"parameters": {}
}

View File

@@ -0,0 +1,63 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.SelfService.Portal.Core.API.Context;
using Microsoft.SelfService.Portal.Core.API.Interfaces;
using Microsoft.SelfService.Portal.Core.API.Models;
namespace Microsoft.SelfService.Portal.Core.API.Repository
{
public class DeploymentGroupRepository : IDeploymentGroupInterface
{
private readonly DataContext _context;
public DeploymentGroupRepository(DataContext context)
{
_context = context;
}
public ICollection<DeploymentGroupModel> GetDeploymentGroups()
{
return _context.DeploymentGroups.ToList();
}
public DeploymentGroupModel GetDeploymentGroupById(Guid Id)
{
return _context.DeploymentGroups
.Include(t => t.Template)
.ThenInclude(tc => tc.TemplateCategory)
.ThenInclude(s => s.Service)
.Include(d => d.Deployments)
.ThenInclude(vm => vm.VirtualMachine)
.Where(dg => dg.Id == Id).FirstOrDefault();
}
public bool AddDeploymentGroupById(DeploymentGroupModel deploymentgroup)
{
_context.Add(deploymentgroup);
return SaveChanges();
}
public bool DeleteDeploymentGroupById(DeploymentGroupModel deploymentgroup)
{
_context.Remove(deploymentgroup);
return SaveChanges();
}
public bool EditDeploymentGroupById(DeploymentGroupModel deploymentgroup)
{
_context.Update(deploymentgroup);
return SaveChanges();
}
public bool CheckDeploymentGroupById(Guid Id)
{
return _context.DeploymentGroups
.Any(d => d.Id == Id);
}
public bool SaveChanges()
{
var saved = _context.SaveChanges();
return saved > 0 ? true : false;
}
}
}

View File

@@ -0,0 +1,61 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.SelfService.Portal.Core.API.Context;
using Microsoft.SelfService.Portal.Core.API.Interfaces;
using Microsoft.SelfService.Portal.Core.API.Models;
namespace Microsoft.SelfService.Portal.Core.API.Repository
{
public class DeploymentRepository : IDeploymentInterface
{
private readonly DataContext _context;
public DeploymentRepository(DataContext context)
{
_context = context;
}
public ICollection<DeploymentModel> GetDeployments()
{
return _context.Deployments.ToList();
}
public DeploymentModel GetDeploymentById(Guid Id)
{
return _context.Deployments
.Include(vm => vm.VirtualMachine)
.Include(dg => dg.DeploymentGroup)
.ThenInclude(t => t.Template)
.Where(d => d.Id == Id).FirstOrDefault();
}
public bool AddDeploymentById(DeploymentModel deployment)
{
_context.Add(deployment);
return SaveChanges();
}
public bool DeleteDeploymentById(DeploymentModel deployment)
{
_context.Remove(deployment);
return SaveChanges();
}
public bool EditDeploymentById(DeploymentModel deployment)
{
_context.Update(deployment);
return SaveChanges();
}
public bool CheckDeploymentById(Guid Id)
{
return _context.Deployments
.Any(d => d.Id == Id);
}
public bool SaveChanges()
{
var saved = _context.SaveChanges();
return saved > 0 ? true : false;
}
}
}

View File

@@ -0,0 +1,88 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.SelfService.Portal.Core.API.Context;
using Microsoft.SelfService.Portal.Core.API.Interfaces;
using Microsoft.SelfService.Portal.Core.API.Models;
namespace Microsoft.SelfService.Portal.Core.API.Repository
{
public class DomainRepository : IDomainInterface
{
private readonly DataContext _context;
public DomainRepository(DataContext context)
{
_context = context;
}
public ICollection<DomainModel> GetDomains()
{
return _context.Domains
.ToList();
}
public DomainModel GetDomainById(Guid Id)
{
return _context.Domains
.Where(d => d.Id == Id)
.FirstOrDefault();
}
public bool AddDomainById(DomainModel domain)
{
_context.Add(domain);
return SaveChanges();
}
public bool DeleteDomainById(DomainModel domain)
{
_context.Remove(domain);
return SaveChanges();
}
public bool EditDomainById(DomainModel domain)
{
_context.Update(domain);
return SaveChanges();
}
public DomainModel GetDomainByIdInEnvironments(Guid Id)
{
return _context.Domains
.Include(ed => ed.EnvironmentDomains)
.ThenInclude(e => e.Environment)
.Where(d => d.Id == Id)
.FirstOrDefault();
}
public DomainModel GetVirtualMachinesByDomainId(Guid Id)
{
return _context.Domains
.Where(d => d.Id == Id)
.Include(vm => vm.VirtualMachines)
.FirstOrDefault();
}
public bool LinkDomainByIdToEnvironment(EnvironmentDomainsModel environmentDomain)
{
_context.Add(environmentDomain);
return SaveChanges();
}
public bool UnlinkDomainByIdFromEnvironment(EnvironmentDomainsModel environmentDomain)
{
_context.Remove(environmentDomain);
return SaveChanges();
}
public bool CheckDomainById(Guid Id)
{
return _context.Domains
.Any(d => d.Id == Id);
}
public bool CheckDomainByName(string Name)
{
return _context.Domains
.Any(p => p.Name == Name);
}
public bool SaveChanges()
{
var saved = _context.SaveChanges();
return saved > 0 ? true : false;
}
}
}

View File

@@ -0,0 +1,75 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.SelfService.Portal.Core.API.Context;
using Microsoft.SelfService.Portal.Core.API.Interfaces;
using Microsoft.SelfService.Portal.Core.API.Models;
namespace Microsoft.SelfService.Portal.Core.API.Repository
{
public class EnvironmentRepository : IEnvironmentInterface
{
private readonly DataContext _context;
public EnvironmentRepository(DataContext context)
{
_context = context;
}
public ICollection<EnvironmentModel> GetEnvironments()
{
return _context.Environments.ToList();
}
public EnvironmentModel GetEnvironmentById(Guid Id)
{
return _context.Environments
.Where(e => e.Id == Id).FirstOrDefault();
}
public bool AddEnvironmentById(EnvironmentModel environment)
{
_context.Add(environment);
return SaveChanges();
}
public bool DeleteEnvironmentById(EnvironmentModel environment)
{
_context.Remove(environment);
return SaveChanges();
}
public bool EditEnvironmentById(EnvironmentModel environment)
{
_context.Update(environment);
return SaveChanges();
}
public EnvironmentModel GetLinkedDomainsByEnvironmentId(Guid Id)
{
return _context.Environments
.Include(ed => ed.EnvironmentDomains)
.ThenInclude(d => d.Domain)
.Where(e => e.Id == Id).FirstOrDefault();
}
public ICollection<TemplateModel> GetAvailableTemplatesByEnvironmentId(Guid Id)
{
var environment = _context.Environments.Where(e => e.Id == Id).FirstOrDefault();
return _context.Templates.Where(t => t.CloudTemplate == environment.CloudEnabled).ToList();
}
public bool CheckEnvironmentById(Guid Id)
{
return _context.Environments
.Any(e => e.Id == Id);
}
public bool CheckEnvironmentByName(String Name)
{
return _context.Environments
.Any(e => e.Name == Name);
}
public bool SaveChanges()
{
var saved = _context.SaveChanges();
return saved > 0 ? true : false;
}
}
}

View File

@@ -0,0 +1,56 @@
using Microsoft.SelfService.Portal.Core.API.Context;
using Microsoft.SelfService.Portal.Core.API.Interfaces;
using Microsoft.SelfService.Portal.Core.API.Models;
namespace Microsoft.SelfService.Portal.Core.API.Repository
{
public class JobRepository : IJobInterface
{
private readonly DataContext _context;
public JobRepository(DataContext context)
{
_context = context;
}
public ICollection<JobModel> GetJobs()
{
return _context.Jobs.ToList();
}
bool IJobInterface.CheckJobById(Guid Id)
{
throw new NotImplementedException();
}
bool IJobInterface.CreateJobById(JobModel job)
{
throw new NotImplementedException();
}
bool IJobInterface.DeleteJobById(JobModel job)
{
throw new NotImplementedException();
}
JobModel IJobInterface.GetJobById(Guid Id)
{
throw new NotImplementedException();
}
ICollection<JobModel> IJobInterface.GetJobs()
{
throw new NotImplementedException();
}
bool IAbstractInterface.SaveChanges()
{
throw new NotImplementedException();
}
bool IJobInterface.UpdateJobById(JobModel job)
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,59 @@
using Microsoft.SelfService.Portal.Core.API.Context;
using Microsoft.SelfService.Portal.Core.API.Interfaces;
using Microsoft.SelfService.Portal.Core.API.Models;
namespace Microsoft.SelfService.Portal.Core.API.Repository
{
public class RunbookRepository : IRunbookInterface
{
private readonly DataContext _context;
public RunbookRepository(DataContext context)
{
_context = context;
}
public ICollection<RunbookModel> GetRunbooks()
{
return _context.Runbooks
.ToList();
}
public RunbookModel GetRunbookById(Guid Id)
{
return _context.Runbooks
.Where(r => r.Id == Id)
.FirstOrDefault();
}
public bool AddRunbookById(RunbookModel runbook)
{
_context.Add(runbook);
return SaveChanges();
}
public bool EditRunbookById(RunbookModel runbook)
{
_context.Update(runbook);
return SaveChanges();
}
public bool CheckRunbookById(Guid Id)
{
return _context.Runbooks
.Any(r => r.Id == Id);
}
public bool CheckRunbookByName(string Name)
{
return _context.Runbooks
.Any(r => r.Name == Name);
}
public bool SaveChanges()
{
var saved = _context.SaveChanges();
return saved > 0 ? true : false;
}
}
}

View File

@@ -0,0 +1,48 @@
using Microsoft.SelfService.Portal.Core.API.Context;
using Microsoft.SelfService.Portal.Core.API.Interfaces;
using Microsoft.SelfService.Portal.Core.API.Models;
namespace Microsoft.SelfService.Portal.Core.API.Repository
{
public class ServiceRepository : IServiceInterface
{
private readonly DataContext _context;
public ServiceRepository(DataContext context)
{
_context = context;
}
public ICollection<ServiceModel> GetServices()
{
return _context.Services
.ToList();
}
public ServiceModel GetServiceById(Guid Id)
{
return _context.Services
.Where(s=>s.Id == Id)
.FirstOrDefault();
}
public bool CheckServiceById(Guid Id)
{
return _context.Services
.Any(s =>s.Id == Id);
}
public ServiceModel GetServiceByName(string Name)
{
return _context.Services
.Where(s => s.Name == Name)
.FirstOrDefault();
}
public bool CheckServiceByName(string Name)
{
return _context.Services
.Any(s => s.Name == Name);
}
}
}

View File

@@ -0,0 +1,35 @@
using Microsoft.SelfService.Portal.Core.API.Context;
using Microsoft.SelfService.Portal.Core.API.Interfaces;
using Microsoft.SelfService.Portal.Core.API.Models;
namespace Microsoft.SelfService.Portal.Core.API.Repository
{
public class TemplateRepository : ITemplateInterface
{
private readonly DataContext _context;
public TemplateRepository(DataContext context)
{
_context = context;
}
public ICollection<TemplateModel> GetTemplates()
{
return _context.Templates
.ToList();
}
public TemplateModel GetTemplateById(Guid Id)
{
return _context.Templates
.Where(t => t.Id == Id)
.FirstOrDefault();
}
public bool CheckTemplateById(Guid Id)
{
return _context.Templates
.Any(t => t.Id == Id);
}
}
}

View File

@@ -0,0 +1,44 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.SelfService.Portal.Core.API.Context;
using Microsoft.SelfService.Portal.Core.API.Interfaces;
using Microsoft.SelfService.Portal.Core.API.Models;
namespace Microsoft.SelfService.Portal.Core.API.Repository
{
public class VirtualMachineRepository : IVirtualMachineInterface
{
private readonly DataContext _context;
public VirtualMachineRepository(DataContext context)
{
_context = context;
}
public ICollection<VirtualMachineModel> GetVirtualMachines()
{
return _context.VirtualMachines
.ToList();
}
public VirtualMachineModel GetVirtualMachineById(Guid Id)
{
return _context.VirtualMachines
.Where(v => v.Id == Id)
.Include(d => d.Domain)
.ThenInclude(e => e.EnvironmentDomains)
.FirstOrDefault();
}
public bool CheckVirtualMachineById(Guid Id)
{
return _context.VirtualMachines
.Any(v => v.Id == Id);
}
public bool CheckVirtualMachineByName(string Name)
{
return _context.VirtualMachines
.Any(v => v.Name == Name);
}
}
}

141
SSP.drawio Normal file
View File

@@ -0,0 +1,141 @@
<mxfile host="app.diagrams.net" modified="2023-10-01T11:11:10.077Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36 Edg/117.0.2045.47" etag="xEiGifmBOxHhWaK3R7to" version="22.0.0" type="device">
<diagram name="Page-1" id="efa7a0a1-bf9b-a30e-e6df-94a7791c09e9">
<mxGraphModel dx="328" dy="1000" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1169" pageHeight="827" background="none" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="vVpijJ3-k6NLGtBfsyng-127" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="25" target="vVpijJ3-k6NLGtBfsyng-124" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="vVpijJ3-k6NLGtBfsyng-149" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="25" target="vVpijJ3-k6NLGtBfsyng-147" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="25" value="&lt;p style=&quot;margin: 0px; margin-top: 4px; text-align: center; text-decoration: underline;&quot;&gt;&lt;strong&gt;Template&lt;/strong&gt;&lt;/p&gt;&lt;hr&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;Id&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;TemplateCategoryId&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;Name&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;Version&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;Description&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;JSONData&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;Modified&lt;br&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;ModifiedBy&lt;br&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;Created&lt;br&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;CreatedBy&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;&lt;br&gt;&lt;/p&gt;" style="verticalAlign=top;align=left;overflow=fill;fontSize=12;fontFamily=Helvetica;html=1;strokeColor=#003366;shadow=1;fillColor=#D4E1F5;fontColor=#003366" parent="1" vertex="1">
<mxGeometry x="810" y="-446.82" width="160" height="200" as="geometry" />
</mxCell>
<mxCell id="vVpijJ3-k6NLGtBfsyng-123" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="vVpijJ3-k6NLGtBfsyng-118" target="vVpijJ3-k6NLGtBfsyng-119" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="7EyGxWHfXc92ukVeR6wE-39" value="1" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="vVpijJ3-k6NLGtBfsyng-123">
<mxGeometry x="0.4639" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="7EyGxWHfXc92ukVeR6wE-41" value="m" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="vVpijJ3-k6NLGtBfsyng-123">
<mxGeometry x="-0.4389" y="2" relative="1" as="geometry">
<mxPoint y="1" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="vVpijJ3-k6NLGtBfsyng-118" value="&lt;p style=&quot;margin: 0px; margin-top: 4px; text-align: center; text-decoration: underline;&quot;&gt;&lt;strong&gt;VirtualMachine&lt;/strong&gt;&lt;/p&gt;&lt;hr&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;Id&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;DomainId&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;Name&lt;/p&gt;&lt;p style=&quot;border-color: var(--border-color); margin: 0px 0px 0px 8px;&quot;&gt;Modified&lt;br style=&quot;border-color: var(--border-color);&quot;&gt;&lt;/p&gt;&lt;p style=&quot;border-color: var(--border-color); margin: 0px 0px 0px 8px;&quot;&gt;ModifiedBy&lt;br style=&quot;border-color: var(--border-color);&quot;&gt;&lt;/p&gt;&lt;p style=&quot;border-color: var(--border-color); margin: 0px 0px 0px 8px;&quot;&gt;Created&lt;br style=&quot;border-color: var(--border-color);&quot;&gt;&lt;/p&gt;&lt;p style=&quot;border-color: var(--border-color); margin: 0px 0px 0px 8px;&quot;&gt;CreatedBy&lt;/p&gt;&lt;p style=&quot;border-color: var(--border-color); margin: 0px 0px 0px 8px;&quot;&gt;&lt;br style=&quot;border-color: var(--border-color);&quot;&gt;&lt;/p&gt;" style="verticalAlign=top;align=left;overflow=fill;fontSize=12;fontFamily=Helvetica;html=1;strokeColor=#003366;shadow=1;fillColor=#D4E1F5;fontColor=#003366" parent="1" vertex="1">
<mxGeometry x="410" y="-210" width="160" height="168.36" as="geometry" />
</mxCell>
<mxCell id="vVpijJ3-k6NLGtBfsyng-119" value="&lt;p style=&quot;margin: 0px; margin-top: 4px; text-align: center; text-decoration: underline;&quot;&gt;&lt;strong&gt;Deployment&lt;/strong&gt;&lt;/p&gt;&lt;hr&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;Id&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;DeploymentGroupId&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;VirtualMachineId&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;Status&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;JSONData&lt;/p&gt;&lt;p style=&quot;border-color: var(--border-color); margin: 0px 0px 0px 8px;&quot;&gt;Modified&lt;br style=&quot;border-color: var(--border-color);&quot;&gt;&lt;/p&gt;&lt;p style=&quot;border-color: var(--border-color); margin: 0px 0px 0px 8px;&quot;&gt;ModifiedBy&lt;br style=&quot;border-color: var(--border-color);&quot;&gt;&lt;/p&gt;&lt;p style=&quot;border-color: var(--border-color); margin: 0px 0px 0px 8px;&quot;&gt;Created&lt;br style=&quot;border-color: var(--border-color);&quot;&gt;&lt;/p&gt;&lt;p style=&quot;border-color: var(--border-color); margin: 0px 0px 0px 8px;&quot;&gt;CreatedBy&lt;/p&gt;&lt;p style=&quot;border-color: var(--border-color); margin: 0px 0px 0px 8px;&quot;&gt;&lt;br style=&quot;border-color: var(--border-color);&quot;&gt;&lt;/p&gt;" style="verticalAlign=top;align=left;overflow=fill;fontSize=12;fontFamily=Helvetica;html=1;strokeColor=#003366;shadow=1;fillColor=#D4E1F5;fontColor=#003366" parent="1" vertex="1">
<mxGeometry x="610" y="-210" width="160" height="168.36" as="geometry" />
</mxCell>
<mxCell id="vVpijJ3-k6NLGtBfsyng-128" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="vVpijJ3-k6NLGtBfsyng-120" target="vVpijJ3-k6NLGtBfsyng-119" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="7EyGxWHfXc92ukVeR6wE-45" value="1" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="vVpijJ3-k6NLGtBfsyng-128">
<mxGeometry x="0.5002" y="1" relative="1" as="geometry">
<mxPoint y="4" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="7EyGxWHfXc92ukVeR6wE-46" value="m" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="vVpijJ3-k6NLGtBfsyng-128">
<mxGeometry x="-0.5148" y="1" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="vVpijJ3-k6NLGtBfsyng-120" value="&lt;p style=&quot;margin: 0px; margin-top: 4px; text-align: center; text-decoration: underline;&quot;&gt;&lt;strong&gt;Job&lt;/strong&gt;&lt;/p&gt;&lt;hr&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;Id&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;DeploymentId&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;RunbookId&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;&lt;span style=&quot;background-color: initial;&quot;&gt;Modified&lt;/span&gt;&lt;br&gt;&lt;/p&gt;&lt;p style=&quot;border-color: var(--border-color); margin: 0px 0px 0px 8px;&quot;&gt;ModifiedBy&lt;br style=&quot;border-color: var(--border-color);&quot;&gt;&lt;/p&gt;&lt;p style=&quot;border-color: var(--border-color); margin: 0px 0px 0px 8px;&quot;&gt;Created&lt;br style=&quot;border-color: var(--border-color);&quot;&gt;&lt;/p&gt;&lt;p style=&quot;border-color: var(--border-color); margin: 0px 0px 0px 8px;&quot;&gt;CreatedBy&lt;/p&gt;" style="verticalAlign=top;align=left;overflow=fill;fontSize=12;fontFamily=Helvetica;html=1;strokeColor=#003366;shadow=1;fillColor=#D4E1F5;fontColor=#003366" parent="1" vertex="1">
<mxGeometry x="610" y="10" width="160" height="168.36" as="geometry" />
</mxCell>
<mxCell id="vVpijJ3-k6NLGtBfsyng-126" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="vVpijJ3-k6NLGtBfsyng-124" target="vVpijJ3-k6NLGtBfsyng-119" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="vVpijJ3-k6NLGtBfsyng-124" value="&lt;p style=&quot;margin: 0px; margin-top: 4px; text-align: center; text-decoration: underline;&quot;&gt;&lt;strong&gt;DeploymentGroup&lt;/strong&gt;&lt;/p&gt;&lt;hr&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;Id&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;TemplateId&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;&lt;span style=&quot;background-color: initial;&quot;&gt;Modified&lt;/span&gt;&lt;br&gt;&lt;/p&gt;&lt;p style=&quot;border-color: var(--border-color); margin: 0px 0px 0px 8px;&quot;&gt;ModifiedBy&lt;br style=&quot;border-color: var(--border-color);&quot;&gt;&lt;/p&gt;&lt;p style=&quot;border-color: var(--border-color); margin: 0px 0px 0px 8px;&quot;&gt;Created&lt;br style=&quot;border-color: var(--border-color);&quot;&gt;&lt;/p&gt;&lt;p style=&quot;border-color: var(--border-color); margin: 0px 0px 0px 8px;&quot;&gt;CreatedBy&lt;/p&gt;&lt;p style=&quot;border-color: var(--border-color); margin: 0px 0px 0px 8px;&quot;&gt;&lt;br style=&quot;border-color: var(--border-color);&quot;&gt;&lt;/p&gt;" style="verticalAlign=top;align=left;overflow=fill;fontSize=12;fontFamily=Helvetica;html=1;strokeColor=#003366;shadow=1;fillColor=#D4E1F5;fontColor=#003366" parent="1" vertex="1">
<mxGeometry x="810" y="-210" width="160" height="168.36" as="geometry" />
</mxCell>
<mxCell id="vVpijJ3-k6NLGtBfsyng-133" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="vVpijJ3-k6NLGtBfsyng-129" target="vVpijJ3-k6NLGtBfsyng-130" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="7EyGxWHfXc92ukVeR6wE-27" value="1" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="vVpijJ3-k6NLGtBfsyng-133">
<mxGeometry x="-0.4806" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="7EyGxWHfXc92ukVeR6wE-29" value="m" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="vVpijJ3-k6NLGtBfsyng-133">
<mxGeometry x="0.4819" relative="1" as="geometry">
<mxPoint x="-5" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="vVpijJ3-k6NLGtBfsyng-129" value="&lt;p style=&quot;margin: 0px; margin-top: 4px; text-align: center; text-decoration: underline;&quot;&gt;&lt;strong&gt;Environment&lt;/strong&gt;&lt;/p&gt;&lt;hr&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;Id&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;&lt;span style=&quot;background-color: initial;&quot;&gt;Name&lt;/span&gt;&lt;br&gt;&lt;/p&gt;&lt;p style=&quot;border-color: var(--border-color); margin: 0px 0px 0px 8px;&quot;&gt;Modified&lt;br style=&quot;border-color: var(--border-color);&quot;&gt;&lt;/p&gt;&lt;p style=&quot;border-color: var(--border-color); margin: 0px 0px 0px 8px;&quot;&gt;ModifiedBy&lt;br style=&quot;border-color: var(--border-color);&quot;&gt;&lt;/p&gt;&lt;p style=&quot;border-color: var(--border-color); margin: 0px 0px 0px 8px;&quot;&gt;Created&lt;br style=&quot;border-color: var(--border-color);&quot;&gt;&lt;/p&gt;&lt;p style=&quot;border-color: var(--border-color); margin: 0px 0px 0px 8px;&quot;&gt;CreatedBy&lt;/p&gt;&lt;p style=&quot;border-color: var(--border-color); margin: 0px 0px 0px 8px;&quot;&gt;&lt;br style=&quot;border-color: var(--border-color);&quot;&gt;&lt;/p&gt;" style="verticalAlign=top;align=left;overflow=fill;fontSize=12;fontFamily=Helvetica;html=1;strokeColor=#003366;shadow=1;fillColor=#D4E1F5;fontColor=#003366" parent="1" vertex="1">
<mxGeometry x="10" y="-431" width="160" height="168.36" as="geometry" />
</mxCell>
<mxCell id="vVpijJ3-k6NLGtBfsyng-130" value="&lt;p style=&quot;margin: 0px; margin-top: 4px; text-align: center; text-decoration: underline;&quot;&gt;&lt;strong&gt;EnvironmentDomains&lt;/strong&gt;&lt;/p&gt;&lt;hr&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;Id&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;&lt;span style=&quot;background-color: initial;&quot;&gt;Name&lt;/span&gt;&lt;br&gt;&lt;/p&gt;&lt;p style=&quot;border-color: var(--border-color); margin: 0px 0px 0px 8px;&quot;&gt;Modified&lt;br style=&quot;border-color: var(--border-color);&quot;&gt;&lt;/p&gt;&lt;p style=&quot;border-color: var(--border-color); margin: 0px 0px 0px 8px;&quot;&gt;ModifiedBy&lt;br style=&quot;border-color: var(--border-color);&quot;&gt;&lt;/p&gt;&lt;p style=&quot;border-color: var(--border-color); margin: 0px 0px 0px 8px;&quot;&gt;Created&lt;br style=&quot;border-color: var(--border-color);&quot;&gt;&lt;/p&gt;&lt;p style=&quot;border-color: var(--border-color); margin: 0px 0px 0px 8px;&quot;&gt;CreatedBy&lt;/p&gt;&lt;p style=&quot;border-color: var(--border-color); margin: 0px 0px 0px 8px;&quot;&gt;&lt;br style=&quot;border-color: var(--border-color);&quot;&gt;&lt;/p&gt;" style="verticalAlign=top;align=left;overflow=fill;fontSize=12;fontFamily=Helvetica;html=1;strokeColor=#003366;shadow=1;fillColor=#D4E1F5;fontColor=#003366" parent="1" vertex="1">
<mxGeometry x="210" y="-431" width="160" height="168.36" as="geometry" />
</mxCell>
<mxCell id="vVpijJ3-k6NLGtBfsyng-132" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="vVpijJ3-k6NLGtBfsyng-131" target="vVpijJ3-k6NLGtBfsyng-130" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="7EyGxWHfXc92ukVeR6wE-30" value="m" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="vVpijJ3-k6NLGtBfsyng-132">
<mxGeometry x="0.4489" relative="1" as="geometry">
<mxPoint x="5" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="7EyGxWHfXc92ukVeR6wE-31" value="1" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="vVpijJ3-k6NLGtBfsyng-132">
<mxGeometry x="-0.62" y="1" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="vVpijJ3-k6NLGtBfsyng-134" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="vVpijJ3-k6NLGtBfsyng-131" target="vVpijJ3-k6NLGtBfsyng-118" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="7EyGxWHfXc92ukVeR6wE-34" value="1" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="vVpijJ3-k6NLGtBfsyng-134">
<mxGeometry x="-0.5054" relative="1" as="geometry">
<mxPoint x="-1" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="7EyGxWHfXc92ukVeR6wE-35" value="m" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="vVpijJ3-k6NLGtBfsyng-134">
<mxGeometry x="0.4765" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="vVpijJ3-k6NLGtBfsyng-131" value="&lt;p style=&quot;margin: 0px; margin-top: 4px; text-align: center; text-decoration: underline;&quot;&gt;&lt;strong&gt;Domain&lt;/strong&gt;&lt;/p&gt;&lt;hr&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;Id&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;&lt;span style=&quot;background-color: initial;&quot;&gt;Name&lt;/span&gt;&lt;br&gt;&lt;/p&gt;&lt;p style=&quot;border-color: var(--border-color); margin: 0px 0px 0px 8px;&quot;&gt;Modified&lt;br style=&quot;border-color: var(--border-color);&quot;&gt;&lt;/p&gt;&lt;p style=&quot;border-color: var(--border-color); margin: 0px 0px 0px 8px;&quot;&gt;ModifiedBy&lt;br style=&quot;border-color: var(--border-color);&quot;&gt;&lt;/p&gt;&lt;p style=&quot;border-color: var(--border-color); margin: 0px 0px 0px 8px;&quot;&gt;Created&lt;br style=&quot;border-color: var(--border-color);&quot;&gt;&lt;/p&gt;&lt;p style=&quot;border-color: var(--border-color); margin: 0px 0px 0px 8px;&quot;&gt;CreatedBy&lt;/p&gt;&lt;p style=&quot;border-color: var(--border-color); margin: 0px 0px 0px 8px;&quot;&gt;&lt;br style=&quot;border-color: var(--border-color);&quot;&gt;&lt;/p&gt;" style="verticalAlign=top;align=left;overflow=fill;fontSize=12;fontFamily=Helvetica;html=1;strokeColor=#003366;shadow=1;fillColor=#D4E1F5;fontColor=#003366" parent="1" vertex="1">
<mxGeometry x="410" y="-431" width="160" height="168.36" as="geometry" />
</mxCell>
<mxCell id="vVpijJ3-k6NLGtBfsyng-143" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="vVpijJ3-k6NLGtBfsyng-135" target="vVpijJ3-k6NLGtBfsyng-141" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="vVpijJ3-k6NLGtBfsyng-135" value="&lt;p style=&quot;margin: 0px; margin-top: 4px; text-align: center; text-decoration: underline;&quot;&gt;&lt;strong&gt;Service&lt;/strong&gt;&lt;/p&gt;&lt;hr&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;Id&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;Name&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;Version&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;Description&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;&lt;span style=&quot;background-color: initial;&quot;&gt;Modified&lt;/span&gt;&lt;br&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;ModifiedBy&lt;br&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;Created&lt;br&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;CreatedBy&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;&lt;br&gt;&lt;/p&gt;" style="verticalAlign=top;align=left;overflow=fill;fontSize=12;fontFamily=Helvetica;html=1;strokeColor=#003366;shadow=1;fillColor=#D4E1F5;fontColor=#003366" parent="1" vertex="1">
<mxGeometry x="1000" y="-660" width="160" height="168.36" as="geometry" />
</mxCell>
<mxCell id="vVpijJ3-k6NLGtBfsyng-140" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="vVpijJ3-k6NLGtBfsyng-139" target="vVpijJ3-k6NLGtBfsyng-120" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="vVpijJ3-k6NLGtBfsyng-139" value="&lt;p style=&quot;margin: 0px; margin-top: 4px; text-align: center; text-decoration: underline;&quot;&gt;&lt;strong&gt;Runbook&lt;/strong&gt;&lt;/p&gt;&lt;hr&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;Id&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;&lt;span style=&quot;background-color: initial;&quot;&gt;Modified&lt;/span&gt;&lt;br&gt;&lt;/p&gt;&lt;p style=&quot;border-color: var(--border-color); margin: 0px 0px 0px 8px;&quot;&gt;ModifiedBy&lt;br style=&quot;border-color: var(--border-color);&quot;&gt;&lt;/p&gt;&lt;p style=&quot;border-color: var(--border-color); margin: 0px 0px 0px 8px;&quot;&gt;Created&lt;br style=&quot;border-color: var(--border-color);&quot;&gt;&lt;/p&gt;&lt;p style=&quot;border-color: var(--border-color); margin: 0px 0px 0px 8px;&quot;&gt;CreatedBy&lt;/p&gt;" style="verticalAlign=top;align=left;overflow=fill;fontSize=12;fontFamily=Helvetica;html=1;strokeColor=#003366;shadow=1;fillColor=#D4E1F5;fontColor=#003366" parent="1" vertex="1">
<mxGeometry x="610" y="220" width="160" height="168.36" as="geometry" />
</mxCell>
<mxCell id="vVpijJ3-k6NLGtBfsyng-142" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="vVpijJ3-k6NLGtBfsyng-141" target="25" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="vVpijJ3-k6NLGtBfsyng-141" value="&lt;p style=&quot;margin: 0px; margin-top: 4px; text-align: center; text-decoration: underline;&quot;&gt;&lt;strong&gt;TemplateCategory&lt;/strong&gt;&lt;/p&gt;&lt;hr&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;Id&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;ServiceId&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;Name&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;&lt;span style=&quot;background-color: initial;&quot;&gt;Modified&lt;/span&gt;&lt;br&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;ModifiedBy&lt;br&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;Created&lt;br&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;CreatedBy&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;&lt;br&gt;&lt;/p&gt;" style="verticalAlign=top;align=left;overflow=fill;fontSize=12;fontFamily=Helvetica;html=1;strokeColor=#003366;shadow=1;fillColor=#D4E1F5;fontColor=#003366" parent="1" vertex="1">
<mxGeometry x="1000" y="-446.82" width="160" height="200" as="geometry" />
</mxCell>
<mxCell id="vVpijJ3-k6NLGtBfsyng-148" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="vVpijJ3-k6NLGtBfsyng-144" target="vVpijJ3-k6NLGtBfsyng-147" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="vVpijJ3-k6NLGtBfsyng-144" value="&lt;p style=&quot;margin: 0px; margin-top: 4px; text-align: center; text-decoration: underline;&quot;&gt;&lt;strong&gt;Option&lt;/strong&gt;&lt;/p&gt;&lt;hr&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;Id&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;OptionCategoryId&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;Name&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;&lt;span style=&quot;background-color: initial;&quot;&gt;Modified&lt;/span&gt;&lt;br&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;ModifiedBy&lt;br&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;Created&lt;br&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;CreatedBy&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;&lt;br&gt;&lt;/p&gt;" style="verticalAlign=top;align=left;overflow=fill;fontSize=12;fontFamily=Helvetica;html=1;strokeColor=#003366;shadow=1;fillColor=#D4E1F5;fontColor=#003366" parent="1" vertex="1">
<mxGeometry x="610" y="-660" width="160" height="168.36" as="geometry" />
</mxCell>
<mxCell id="vVpijJ3-k6NLGtBfsyng-146" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="vVpijJ3-k6NLGtBfsyng-145" target="vVpijJ3-k6NLGtBfsyng-144" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="vVpijJ3-k6NLGtBfsyng-145" value="&lt;p style=&quot;margin: 0px; margin-top: 4px; text-align: center; text-decoration: underline;&quot;&gt;&lt;strong&gt;OptionCategory&lt;/strong&gt;&lt;/p&gt;&lt;hr&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;Id&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;&lt;span style=&quot;background-color: initial;&quot;&gt;Name&lt;/span&gt;&lt;br&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;&lt;span style=&quot;background-color: initial;&quot;&gt;Modified&lt;/span&gt;&lt;br&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;ModifiedBy&lt;br&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;Created&lt;br&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;CreatedBy&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;&lt;br&gt;&lt;/p&gt;" style="verticalAlign=top;align=left;overflow=fill;fontSize=12;fontFamily=Helvetica;html=1;strokeColor=#003366;shadow=1;fillColor=#D4E1F5;fontColor=#003366" parent="1" vertex="1">
<mxGeometry x="610" y="-820" width="160" height="130" as="geometry" />
</mxCell>
<mxCell id="vVpijJ3-k6NLGtBfsyng-147" value="&lt;p style=&quot;margin: 0px; margin-top: 4px; text-align: center; text-decoration: underline;&quot;&gt;&lt;strong&gt;TemplateOption&lt;/strong&gt;&lt;/p&gt;&lt;hr&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;Id&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;OptionId&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;TemplateId&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;Name&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;&lt;span style=&quot;background-color: initial;&quot;&gt;Modified&lt;/span&gt;&lt;br&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;ModifiedBy&lt;br&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;Created&lt;br&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;CreatedBy&lt;/p&gt;&lt;p style=&quot;margin: 0px; margin-left: 8px;&quot;&gt;&lt;br&gt;&lt;/p&gt;" style="verticalAlign=top;align=left;overflow=fill;fontSize=12;fontFamily=Helvetica;html=1;strokeColor=#003366;shadow=1;fillColor=#D4E1F5;fontColor=#003366" parent="1" vertex="1">
<mxGeometry x="810" y="-660" width="160" height="168.36" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>

9
ToDo.txt Normal file
View File

@@ -0,0 +1,9 @@
- CRUD Implementation in Controller
- Authorization
-- Add Bearertoken Authorization Method
-- https://learn.microsoft.com/en-us/aspnet/web-api/overview/security/authentication-and-authorization-in-aspnet-web-api
- Call SMA API with Message Queuing / Event Trigger
- https://masstransit.io/documentation/transports/in-memory
---- https://app.diagrams.net/

Some files were not shown because too many files have changed in this diff Show More