예제 #1
0
        public async Task <IActionResult> AuthenticateUserOpenStackAsync(AuthenticateUserOpenIdModel model)
        {
            try
            {
                _logger.LogDebug($"Endpoint: \"UserAndLimitationManagement\" Method: \"AuthenticateUserOpenStack\" Parameters: \"{model}\"");
                ValidationResult validationResult = new UserAndLimitationManagementValidator(model).Validate();
                if (!validationResult.IsValid)
                {
                    ExceptionHandler.ThrowProperExternalException(new InputValidationException(validationResult.Message));
                }

                return(Ok(await _service.AuthenticateUserToOpenStackAsync(model.Credentials)));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
예제 #2
0
        public IActionResult GetCurrentUsageAndLimitationsForCurrentUser(GetCurrentUsageAndLimitationsForCurrentUserModel model)
        {
            try
            {
                _logger.LogDebug($"Endpoint: \"UserAndLimitationManagement\" Method: \"GetCurrentUsageAndLimitationsForCurrentUser\" Parameters: \"{model}\"");
                ValidationResult validationResult = new UserAndLimitationManagementValidator(model).Validate();
                if (!validationResult.IsValid)
                {
                    ExceptionHandler.ThrowProperExternalException(new InputValidationException(validationResult.Message));
                }

                return(Ok(_service.GetCurrentUsageAndLimitationsForCurrentUser(model.SessionCode)));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }