コード例 #1
0
 public async Task Handle(InstanceSettingsPushedEvent notification, CancellationToken cancellationToken)
 {
     foreach (var machine in notification.Account.Machines)
     {
         await AddUserOperation(UserOperationTypes.PushInstanceSettings, machine.Id, notification.Actor, cancellationToken);
     }
 }
コード例 #2
0
        public async Task Handle(InstanceSettingsPushedEvent notification, CancellationToken cancellationToken)
        {
            try
            {
                var desiredStates = notification.Account.Machines.Select(x => x.States.First(y => y.Desired));

                foreach (var desiredState in desiredStates)
                {
                    _context.Set <HistoricalDesiredState>().Add(Mapper.Map <HistoricalDesiredState>(desiredState));
                }

                await _context.SaveChangesAsync(cancellationToken);
            }
            catch (Exception e)
            {
                _logger.LogError(e.Message);
            }
        }
コード例 #3
0
 public async Task Handle(InstanceSettingsPushedEvent notification, CancellationToken cancellationToken)
 {
     await AddAuditLogAsync("PushInstanceSettings", notification.Actor, DateTime.Now, new[] { Mapper.Map <AccountRef>(notification.Account) }, null, new { Params = notification.Command, Changes = notification.Changes });
 }