Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Farr <[email protected]>
  • Loading branch information
Xtansia committed Oct 30, 2023
1 parent 0a61bd8 commit d9b561c
Show file tree
Hide file tree
Showing 13 changed files with 15 additions and 205 deletions.
21 changes: 0 additions & 21 deletions src/OpenSearch.Client/Search/PointInTime/CreatePitRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,6 @@
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/
/*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

namespace OpenSearch.Client;

Expand Down
21 changes: 0 additions & 21 deletions src/OpenSearch.Client/Search/PointInTime/CreatePitResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,6 @@
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/
/*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

using System.Runtime.Serialization;

Expand Down
21 changes: 0 additions & 21 deletions src/OpenSearch.Client/Search/PointInTime/DeleteAllPitsRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,6 @@
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/
/*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

namespace OpenSearch.Client;

Expand Down
21 changes: 0 additions & 21 deletions src/OpenSearch.Client/Search/PointInTime/DeleteAllPitsResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,6 @@
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/
/*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

using System.Collections.Generic;
using System.Runtime.Serialization;
Expand Down
39 changes: 9 additions & 30 deletions src/OpenSearch.Client/Search/PointInTime/DeletePitRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,6 @@
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/
/*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

using System.Collections.Generic;
using System.Linq;
Expand All @@ -37,25 +16,25 @@ namespace OpenSearch.Client;
public partial interface IDeletePitRequest
{
[DataMember(Name = "pit_id")]
IEnumerable<string> PitIds { get; set; }
IEnumerable<string> PitId { get; set; }
}

public partial class DeletePitRequest
{
public DeletePitRequest(IEnumerable<string> pitIds) : this(pitIds?.ToArray()) { }
public DeletePitRequest(IEnumerable<string> pitId) : this(pitId?.ToArray()) { }

public DeletePitRequest(params string[] pitIds) => PitIds = pitIds;
public DeletePitRequest(params string[] pitId) => PitId = pitId;

public IEnumerable<string> PitIds { get; set; }
public IEnumerable<string> PitId { get; set; }
}

public partial class DeletePitDescriptor
{
IEnumerable<string> IDeletePitRequest.PitIds { get; set; }
IEnumerable<string> IDeletePitRequest.PitId { get; set; }

public DeletePitDescriptor PitIds(IEnumerable<string> pitIds) =>
Assign(pitIds?.ToArray(), (r, v) => r.PitIds = v);
public DeletePitDescriptor PitId(IEnumerable<string> pitId) =>
Assign(pitId?.ToArray(), (r, v) => r.PitId = v);

public DeletePitDescriptor PitIds(params string[] pitIds) =>
Assign(pitIds, (r, v) => r.PitIds = v);
public DeletePitDescriptor PitId(params string[] pitId) =>
Assign(pitId, (r, v) => r.PitId = v);
}
21 changes: 0 additions & 21 deletions src/OpenSearch.Client/Search/PointInTime/DeletePitResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,6 @@
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/
/*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

using System.Collections.Generic;
using System.Runtime.Serialization;
Expand Down
21 changes: 0 additions & 21 deletions src/OpenSearch.Client/Search/PointInTime/GetAllPitsRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,6 @@
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/
/*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

namespace OpenSearch.Client;

Expand Down
21 changes: 0 additions & 21 deletions src/OpenSearch.Client/Search/PointInTime/GetAllPitsResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,6 @@
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/
/*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

using System.Collections.Generic;
using System.Runtime.Serialization;
Expand Down
22 changes: 0 additions & 22 deletions src/OpenSearch.Client/Search/Search/PointInTime/PointInTime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,6 @@
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/
/*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/


using System.Runtime.Serialization;

Expand Down
2 changes: 1 addition & 1 deletion tests/Tests/Search/PointInTime/CreatePitApiTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protected override void ExpectResponse(CreatePitResponse response)
protected override void OnAfterCall(IOpenSearchClient client)
{
if (string.IsNullOrEmpty(_pitId)) return;
client.DeletePit(d => d.PitIds(_pitId));
client.DeletePit(d => d.PitId(_pitId));
_pitId = null;
}
}
4 changes: 2 additions & 2 deletions tests/Tests/Search/PointInTime/DeletePitApiTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ public DeletePitApiTests(ReadOnlyCluster cluster, EndpointUsage usage) : base(cl

protected override object ExpectJson => new
{
pit_ids = new[]
pit_id = new[]
{
_pitId
}
};

protected override int ExpectStatusCode => 200;

protected override Func<DeletePitDescriptor, IDeletePitRequest> Fluent => d => d.PitIds(_pitId);
protected override Func<DeletePitDescriptor, IDeletePitRequest> Fluent => d => d.PitId(_pitId);
protected override HttpMethod HttpMethod => HttpMethod.DELETE;

protected override DeletePitRequest Initializer => new(_pitId);
Expand Down
4 changes: 2 additions & 2 deletions tests/Tests/Search/PointInTime/DeletePitUrlTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ [U] public async Task Urls()
var pitIds = new[] { "pitid1", "pitid2" };

await DELETE("/_search/point_in_time")
.Fluent(c => c.DeletePit(d => d.PitIds(pitIds)))
.Fluent(c => c.DeletePit(d => d.PitId(pitIds)))
.Request(c => c.DeletePit(new DeletePitRequest(pitIds)))
.FluentAsync(c => c.DeletePitAsync(d => d.PitIds(pitIds)))
.FluentAsync(c => c.DeletePitAsync(d => d.PitId(pitIds)))
.RequestAsync(c => c.DeletePitAsync(new DeletePitRequest(pitIds)));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ [I] public async Task PointInTimeQuery()
pitSearch.Total.Should().Be(10);
pitSearch.Documents.Should().AllSatisfy(d => d.Id.Should().BeLessThan(10));

var deleteResp = await client.DeletePitAsync(d => d.PitIds(pitResp.PitId));
var deleteResp = await client.DeletePitAsync(d => d.PitId(pitResp.PitId));
deleteResp.ShouldBeValid();
deleteResp.Pits.Should().BeEquivalentTo(new[]
{
Expand Down

0 comments on commit d9b561c

Please sign in to comment.