Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Runtime.Serialization;
using Elasticsearch.Net.Utf8Json;

namespace Nest
{
Expand Down Expand Up @@ -46,6 +47,7 @@ public interface IAzureRepositorySettings : IRepositorySettings
/// affect index files that are already compressed by default. Defaults to <c>false</c>.
/// </summary>
[DataMember(Name ="compress")]
[JsonFormatter(typeof(NullableStringBooleanFormatter))]
bool? Compress { get; set; }

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Elasticsearch.Net.Utf8Json;

namespace Nest
{
Expand Down Expand Up @@ -39,12 +40,14 @@ public interface IHdfsRepositorySettings : IRepositorySettings
/// affect index files that are already compressed by default. Defaults to <c>false</c>.
/// </summary>
[DataMember(Name ="compress")]
[JsonFormatter(typeof(NullableStringBooleanFormatter))]
bool? Compress { get; set; }

/// <summary>
/// Throttles the number of streams (per node) preforming snapshot operation. Defaults to 5
/// </summary>
[DataMember(Name ="concurrent_streams")]
[JsonFormatter(typeof(NullableStringIntFormatter))]
int? ConcurrentStreams { get; set; }

/// <summary>
Expand All @@ -63,6 +66,7 @@ public interface IHdfsRepositorySettings : IRepositorySettings
/// Whether to load the default Hadoop configuration (default) or not
/// </summary>
[DataMember(Name ="load_defaults")]
[JsonFormatter(typeof(NullableStringBooleanFormatter))]
bool? LoadDefaults { get; set; }

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Runtime.Serialization;
using Elasticsearch.Net.Utf8Json;

namespace Nest
{
Expand Down Expand Up @@ -28,6 +29,7 @@ public interface IReadOnlyUrlRepositorySettings : IRepositorySettings
/// Throttles the number of streams (per node) preforming snapshot operation. Defaults to 5
/// </summary>
[DataMember(Name ="concurrent_streams")]
[JsonFormatter(typeof(NullableStringIntFormatter))]
int? ConcurrentStreams { get; set; }

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Runtime.Serialization;
using Elasticsearch.Net.Utf8Json;

namespace Nest
{
Expand Down Expand Up @@ -77,13 +78,15 @@ public interface IS3RepositorySettings : IRepositorySettings
/// Defaults to false.
/// </summary>
[DataMember(Name ="compress")]
[JsonFormatter(typeof(NullableStringBooleanFormatter))]
bool? Compress { get; set; }

/// <summary>
/// When set to true files are encrypted on server side using AES256 algorithm.
/// Defaults to false.
/// </summary>
[DataMember(Name ="server_side_encryption")]
[JsonFormatter(typeof(NullableStringBooleanFormatter))]
bool? ServerSideEncryption { get; set; }

/// <summary>
Expand All @@ -99,6 +102,7 @@ public interface IS3RepositorySettings : IRepositorySettings
// be automatically determined by the AWS Java SDK used internally by Elasticsearch
/// </summary>
[DataMember(Name = "path_style_access")]
[JsonFormatter(typeof(NullableStringBooleanFormatter))]
bool? PathStyleAccess { get; set; }

/// <summary>
Expand All @@ -108,6 +112,7 @@ public interface IS3RepositorySettings : IRepositorySettings
/// encoding. Defaults to false.
/// </summary>
[DataMember(Name = "disable_chunked_encoding")]
[JsonFormatter(typeof(NullableStringBooleanFormatter))]
bool? DisableChunkedEncoding { get; set; }
}

Expand Down
52 changes: 52 additions & 0 deletions tests/Tests.Reproduce/GithubIssue4467.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using System;
using System.Text;
using Elastic.Xunit.XunitPlumbing;
using Elasticsearch.Net;
using FluentAssertions;
using Nest;

namespace Tests.Reproduce
{
public class GithubIssue4467
{
[U]
public void CanDeserializeRepositories()
{
var json = @"{
""test_repository"": {
""type"": ""azure"",
""settings"": {
""container"": ""test-backup-container"",
""client"": ""default"",
""base_path"": ""test-backups"",
""chunk_size"": ""64mb""
}
},
""repo_aligncare_v7"": {
""type"": ""azure"",
""settings"": {
""container"": ""aligncare-backup-container-02292020"",
""base_path"": ""aligncare-backups"",
""chunk_size"": ""64m"",
""compress"": ""true""
}
}
}";

var bytes = Encoding.UTF8.GetBytes(json);
var pool = new SingleNodeConnectionPool(new Uri("http://localhost:9200"));
var connectionSettings = new ConnectionSettings(pool, new InMemoryConnection(bytes));
var client = new ElasticClient(connectionSettings);

Func<GetRepositoryResponse> responseAction = () => client.Snapshot.GetRepository();
responseAction.Should().NotThrow();

var response = responseAction();
response.Repositories.Should().HaveCount(2);

var azureRepository = response.Azure("repo_aligncare_v7");
azureRepository.Should().NotBeNull();
azureRepository.Settings.Compress.Should().BeTrue();
}
}
}