Skip to content

Commit

Permalink
Move snapshot API requests into the .Specification.SnapshotApi name…
Browse files Browse the repository at this point in the history
…space

Signed-off-by: Thomas Farr <[email protected]>
  • Loading branch information
Xtansia committed May 11, 2023
1 parent 8e789d4 commit 889685d
Show file tree
Hide file tree
Showing 67 changed files with 76 additions and 49 deletions.
2 changes: 1 addition & 1 deletion src/OpenSearch.Client/Descriptors.Snapshot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
// ReSharper disable UnusedTypeParameter
// ReSharper disable PartialMethodWithSinglePart
// ReSharper disable RedundantNameQualifier
namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
///<summary>Descriptor for CleanupRepository <para></para></summary>
public partial class CleanupRepositoryDescriptor : RequestDescriptorBase<CleanupRepositoryDescriptor, CleanupRepositoryRequestParameters, ICleanupRepositoryRequest>, ICleanupRepositoryRequest
Expand Down
2 changes: 1 addition & 1 deletion src/OpenSearch.Client/Requests.Snapshot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
// ReSharper disable UnusedTypeParameter
// ReSharper disable PartialMethodWithSinglePart
// ReSharper disable RedundantNameQualifier
namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
[InterfaceDataContract]
public partial interface ICleanupRepositoryRequest : IRequest<CleanupRepositoryRequestParameters>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
using System.Runtime.Serialization;
using OpenSearch.Net.Utf8Json;

namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
/// <summary>
/// A snapshot repository that stores snapshots in an Azure storage account
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* under the License.
*/

namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
[MapsApi("snapshot.cleanup_repository.json")]
public partial interface ICleanupRepositoryRequest { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

using System.Runtime.Serialization;

namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
[DataContract]
public class CleanupRepositoryResponse : ResponseBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
using System;
using OpenSearch.Net.Utf8Json;

namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
internal class CreateRepositoryFormatter : IJsonFormatter<ICreateRepositoryRequest>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
using System;
using OpenSearch.Net.Utf8Json;

namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
/// <summary>
/// Creates a snapshot repository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* under the License.
*/

namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
public class CreateRepositoryResponse : AcknowledgedResponseBase { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* under the License.
*/

namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
[MapsApi("snapshot.delete_repository.json")]
public partial interface IDeleteRepositoryRequest { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* under the License.
*/

namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
public class DeleteRepositoryResponse : AcknowledgedResponseBase { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
using System.Runtime.Serialization;
using OpenSearch.Net.Utf8Json;

namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
/// <summary>
/// A snapshot repository that uses a shared file system to store snapshot data.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* under the License.
*/

namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
[MapsApi("snapshot.get_repository.json")]
public partial interface IGetRepositoryRequest { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
using OpenSearch.Net;
using OpenSearch.Net.Utf8Json;

namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
[DataContract]
[JsonFormatter(typeof(GetRepositoryResponseFormatter))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
using OpenSearch.Net.Utf8Json;
using OpenSearch.Net.Utf8Json.Resolvers;

namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
internal class GetRepositoryResponseFormatter : IJsonFormatter<GetRepositoryResponse>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
using System.Runtime.Serialization;
using OpenSearch.Net.Utf8Json;

namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
/// <summary>
/// A snapshot repository that stores snapshot data within a Hadoop HDFS filesystem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

using System.Runtime.Serialization;

namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
/// <summary>
/// A snapshot repository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
using System.Runtime.Serialization;
using OpenSearch.Net.Utf8Json;

namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
/// <summary>
/// A snapshot repository that can be used as an alternative read-only way to access data created by the <see cref="IFileSystemRepository"/>.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
using System.Runtime.Serialization;
using OpenSearch.Net.Utf8Json;

namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
/// <summary>
/// A snapshot repository that stores snapshots in an Amazon S3 bucket
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
using OpenSearch.Net.Utf8Json;
using OpenSearch.Net.Utf8Json.Internal;

namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
/// <summary>
/// A source repository enables you to create minimal, source-only snapshots that take up to 50% less space on disk.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

using System.Runtime.Serialization;

namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
[DataContract]
public class CompactNodeInfo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* under the License.
*/

namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
[MapsApi("snapshot.verify_repository.json")]
public partial interface IVerifyRepositoryRequest { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
using OpenSearch.Net;
using OpenSearch.Net.Utf8Json;

namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
[DataContract]
public class VerifyRepositoryResponse : ResponseBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
using System.Threading;
using OpenSearch.Net;

namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
public class RestoreErrorEventArgs : EventArgs
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
using System.Runtime.Serialization;
using OpenSearch.Client.Specification.IndicesApi;

namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
/// <summary>
/// Restores a snapshot
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

using System.Runtime.Serialization;

namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
[DataContract]
public class RestoreResponse : ResponseBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
using System.Runtime.Serialization;
using OpenSearch.Net;

namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
public class SnapshotRestore
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

using System.Runtime.Serialization;

namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
[MapsApi("snapshot.clone.json")]
[ReadAs(typeof(CloneSnapshotRequest))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* under the License.
*/

namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
public class CloneSnapshotResponse : AcknowledgedResponseBase { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* under the License.
*/

namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
[MapsApi("snapshot.delete.json")]
public partial interface IDeleteSnapshotRequest { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* under the License.
*/

namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
public class DeleteSnapshotResponse : AcknowledgedResponseBase { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* under the License.
*/

namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
[MapsApi("snapshot.get.json")]
public partial interface IGetSnapshotRequest { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
using System.Runtime.Serialization;
using OpenSearch.Net;

namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
[DataContract]
public class GetSnapshotResponse : ResponseBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
using System.Runtime.Serialization;
using OpenSearch.Net;

namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
public class Snapshot
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
using System.Runtime.Serialization;
using OpenSearch.Net.Utf8Json;

namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
[MapsApi("snapshot.create.json")]
public partial interface ISnapshotRequest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

using System.Runtime.Serialization;

namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
[DataContract]
public class SnapshotResponse : ResponseBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
using System.Threading;
using OpenSearch.Net;

namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
public class SnapshotObservable : IDisposable, IObservable<SnapshotStatusResponse>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

using System;

namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
public class SnapshotObserver : CoordinatedRequestObserverBase<SnapshotStatusResponse>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
using System.Runtime.Serialization;
using OpenSearch.Net.Utf8Json;

namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
[DataContract]
public class SnapshotShardFailure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* under the License.
*/

namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
[MapsApi("snapshot.status.json")]
public partial interface ISnapshotStatusRequest { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
using System.Runtime.Serialization;
using OpenSearch.Net;

namespace OpenSearch.Client
namespace OpenSearch.Client.Specification.SnapshotApi
{
[DataContract]
public class SnapshotStatusResponse : ResponseBase
Expand Down
3 changes: 2 additions & 1 deletion tests/Tests.Reproduce/GitHubIssue4537.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
using OpenSearch.OpenSearch.Xunit.XunitPlumbing;
using FluentAssertions;
using OpenSearch.Client;
using OpenSearch.Client.Specification.SnapshotApi;
using Tests.Core.Client;

namespace Tests.Reproduce
Expand Down Expand Up @@ -91,7 +92,7 @@ public void CanDeserializeSnapshotShardFailure()

var client = TestClient.FixedInMemoryClient(Encoding.UTF8.GetBytes(json));

Func<GetSnapshotResponse> action = () => client.Snapshot.Get("repo", "snapshot_2020-03-31t00:02:18z");
var action = () => client.Snapshot.Get("repo", "snapshot_2020-03-31t00:02:18z");

action.Should().NotThrow();

Expand Down
3 changes: 2 additions & 1 deletion tests/Tests.Reproduce/GithubIssue4467.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
using OpenSearch.Net;
using FluentAssertions;
using OpenSearch.Client;
using OpenSearch.Client.Specification.SnapshotApi;

namespace Tests.Reproduce
{
Expand Down Expand Up @@ -66,7 +67,7 @@ public void CanDeserializeRepositories()
var connectionSettings = new ConnectionSettings(pool, new InMemoryConnection(bytes));
var client = new OpenSearchClient(connectionSettings);

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

var response = responseAction();
Expand Down
Loading

0 comments on commit 889685d

Please sign in to comment.