Exemplo n.º 1
0
        public async Task <IActionResult> SetSecret(string key, string value)
        {
            try
            {
                await adapter.SetSecretAsync(key, value);

                return(StatusCode(200));
            }
            catch
            {
                return(StatusCode(500));
            }
        }
Exemplo n.º 2
0
        public async Task <IActionResult> SetSecret(string key, string value)
        {
            try
            {
                _ = key ?? throw new ArgumentNullException(nameof(key));
                _ = value ?? throw new ArgumentNullException(nameof(value));

                await adapter.SetSecretAsync(key, value);

                logger?.LogInformation("Set PSK secret.");
                return(StatusCode(200));
            }
            catch (Exception ex)
            {
                logger?.LogError(ex, "Error setting PSK secret.");
                return(StatusCode(500));
            }
        }
Exemplo n.º 3
0
        public async Task <IActionResult> SetSecret(string key, string value)
        {
            try
            {
                if (string.IsNullOrEmpty("key"))
                {
                    throw new ArgumentNullException("key");
                }

                if (string.IsNullOrEmpty("value"))
                {
                    throw new ArgumentNullException("value");
                }
                await adapter.SetSecretAsync(key, value);

                logger?.LogInformation("Set PSK secret.");
                return(StatusCode(200));
            }
            catch (Exception ex)
            {
                logger?.LogError(ex, "Error setting PSK secret.");
                return(StatusCode(500));
            }
        }