|
| 1 | +// Licensed to Elasticsearch B.V under one or more agreements. |
| 2 | +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. |
| 3 | +// See the LICENSE file in the project root for more information |
| 4 | + |
| 5 | +using System; |
| 6 | +using Elastic.Elasticsearch.Xunit.XunitPlumbing; |
| 7 | +using Elastic.Transport; |
| 8 | +using Nest; |
| 9 | +using Tests.Core.ManagedElasticsearch.Clusters; |
| 10 | +using Tests.Framework.EndpointTests; |
| 11 | +using Tests.Framework.EndpointTests.TestState; |
| 12 | + |
| 13 | +namespace Tests.XPack.Ilm.MigrateToDataTiers |
| 14 | +{ |
| 15 | + [SkipVersion("<7.14.0", "Migrate to data tiers added in 7.14.0")] |
| 16 | + public class MigrateToDataTiersApiTests |
| 17 | + : ApiTestBase<XPackCluster, MigrateToDataTiersResponse, IMigrateToDataTiersRequest, MigrateToDataTiersDescriptor, MigrateToDataTiersRequest> |
| 18 | + { |
| 19 | + public MigrateToDataTiersApiTests(XPackCluster cluster, EndpointUsage usage) : base(cluster, usage) { } |
| 20 | + |
| 21 | + protected override object ExpectJson => |
| 22 | + new { legacy_template_to_delete = "template-name", node_attribute = "test-attribute" }; |
| 23 | + |
| 24 | + protected override Func<MigrateToDataTiersDescriptor, IMigrateToDataTiersRequest> Fluent => d => d |
| 25 | + .DryRun() |
| 26 | + .LegacyTemplateToDelete("template-name") |
| 27 | + .NodeAttribute("test-attribute"); |
| 28 | + |
| 29 | + protected override HttpMethod HttpMethod => HttpMethod.POST; |
| 30 | + |
| 31 | + protected override MigrateToDataTiersRequest Initializer => new() |
| 32 | + { |
| 33 | + DryRun = true, LegacyTemplateToDelete = "template-name", NodeAttribute = "test-attribute" |
| 34 | + }; |
| 35 | + |
| 36 | + protected override string UrlPath => "/_ilm/migrate_to_data_tiers?dry_run=true"; |
| 37 | + |
| 38 | + protected override LazyResponses ClientUsage() => Calls( |
| 39 | + (client, f) => client.IndexLifecycleManagement.MigrateToDataTiers(f), |
| 40 | + (client, f) => client.IndexLifecycleManagement.MigrateToDataTiersAsync(f), |
| 41 | + (client, r) => client.IndexLifecycleManagement.MigrateToDataTiers(r), |
| 42 | + (client, r) => client.IndexLifecycleManagement.MigrateToDataTiersAsync(r) |
| 43 | + ); |
| 44 | + |
| 45 | + protected override MigrateToDataTiersDescriptor NewDescriptor() => new(); |
| 46 | + } |
| 47 | +} |
0 commit comments