Exemple #1
0
#pragma warning disable SA1202 // Elements must be ordered by access
        public async Task <CredHubCredential <T> > WriteAsync <T>(CredentialSetRequest credentialRequest)
        {
            _logger?.LogTrace($"About to PUT {_baseCredHubUrl}/v1/data");
            var response = await _httpClient.PutAsJsonAsync($"{_baseCredHubUrl}/v1/data", credentialRequest, _serializerSettings);

            var dataAsString = await response.Content.ReadAsStringAsync();

            var s = JsonConvert.DeserializeObject <CredHubCredential <T> >(dataAsString, _serializerSettings);

            return(await HandleErrorParseResponse <CredHubCredential <T> >(response, $"Write  {typeof(T).Name}"));
        }
#pragma warning disable SA1202 // Elements must be ordered by access
        public async Task <CredHubCredential <T> > WriteAsync <T>(CredentialSetRequest credentialRequest)
        {
            HttpClientHelper.ConfigureCertificateValidation(_validateCertificates, out var protocolType, out var prevValidator);
            try
            {
                _logger?.LogTrace($"About to PUT {_baseCredHubUrl}/v1/data");
                var response = await _httpClient.PutAsJsonAsync($"{_baseCredHubUrl}/v1/data", credentialRequest, SerializerOptions).ConfigureAwait(false);

                return(await HandleErrorParseResponse <CredHubCredential <T> >(response, $"Write  {typeof(T).Name}").ConfigureAwait(false));
            }
            finally
            {
                HttpClientHelper.RestoreCertificateValidation(_validateCertificates, protocolType, prevValidator);
            }
        }
Exemple #3
0
#pragma warning disable SA1202 // Elements must be ordered by access
        public async Task <CredHubCredential <T> > WriteAsync <T>(CredentialSetRequest credentialRequest)
        {
            HttpClientHelper.ConfigureCertificateValidatation(_validateCertificates, out SecurityProtocolType protocolType, out RemoteCertificateValidationCallback prevValidator);
            try
            {
                _logger?.LogTrace($"About to PUT {_baseCredHubUrl}/v1/data");
                var response = await _httpClient.PutAsJsonAsync($"{_baseCredHubUrl}/v1/data", credentialRequest, _serializerSettings);

                var dataAsString = await response.Content.ReadAsStringAsync();

                var s = JsonConvert.DeserializeObject <CredHubCredential <T> >(dataAsString, _serializerSettings);

                return(await HandleErrorParseResponse <CredHubCredential <T> >(response, $"Write  {typeof(T).Name}"));
            }
            finally
            {
                HttpClientHelper.RestoreCertificateValidation(_validateCertificates, protocolType, prevValidator);
            }
        }