public async Task Post([FromBody] MicroServiceEntity entity)
        {
            await _microServicesRepo.Create(entity);

            #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
            Task.Run(() => _serviceManager.GenerateService(entity));
            #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
        }
示例#2
0
        public async Task <UpdateResult> Update(MicroServiceEntity microService)
        {
            var update = new UpdateDefinitionBuilder <MicroServiceEntity>()
                         .Set(x => x.Description, microService.Description)
                         .Set(x => x.Name, microService.Name)
                         .Set(x => x.UpdatedBy, microService.UpdatedBy)
                         .Set(x => x.LastUpdated, DateTime.Now);

            return(await _microServicesCollection.UpdateOneAsync(x => x.Id == microService.Id, update));
        }
示例#3
0
 public async Task Create(MicroServiceEntity microService)
 {
     microService.Created = DateTime.Now;
     microService.Deleted = false;
     await _microServicesCollection.InsertOneAsync(microService);
 }
 public async Task Put([FromBody] MicroServiceEntity entity)
 {
     await _microServicesRepo.Update(entity);
 }
示例#5
0
 public async Task DeleteService(MicroServiceEntity entity)
 {
     await GoProjectDeletion.RemoveProject(companyName, entity);
 }
示例#6
0
        /// <summary>
        /// Generates micro-service go application and puts it in the user's
        /// go application directory under dark orbit space for their company.
        /// </summary>
        /// <param name="entity">The micro-service entity to generate the project.</param>
        public async Task GenerateService(MicroServiceEntity entity)
        {
            await GoServiceGenerator.Generate(companyName, entity);

            await ApplicationsRunner.Start(companyName, entity);
        }