Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move snapshot API requests into the .Specification.SnapshotApi namespace #208

Merged
merged 2 commits into from
May 11, 2023
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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## [Unreleased]
### ⚠️ Breaking Changes ⚠️
- Moved `OpenSearch.Client` request classes into their respective namespaces to match those in `OpenSearch.Net` ([#200](https://github.com/opensearch-project/opensearch-net/pull/200), [#202](https://github.com/opensearch-project/opensearch-net/pull/202), [#203](https://github.com/opensearch-project/opensearch-net/pull/203), [#205](https://github.com/opensearch-project/opensearch-net/pull/205), [#206](https://github.com/opensearch-project/opensearch-net/pull/206), [#207](https://github.com/opensearch-project/opensearch-net/pull/207))
- Moved `OpenSearch.Client` request classes into their respective namespaces to match those in `OpenSearch.Net` ([#200](https://github.com/opensearch-project/opensearch-net/pull/200), [#202](https://github.com/opensearch-project/opensearch-net/pull/202), [#203](https://github.com/opensearch-project/opensearch-net/pull/203), [#205](https://github.com/opensearch-project/opensearch-net/pull/205), [#206](https://github.com/opensearch-project/opensearch-net/pull/206), [#207](https://github.com/opensearch-project/opensearch-net/pull/207), [#208](https://github.com/opensearch-project/opensearch-net/pull/208))

### Dependencies
- Bumps `System.Reflection.Emit` from 4.3.0 to 4.7.0
Expand Down
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
Loading
Loading