Skip to content

Commit a5ad23a

Browse files
committed
Add support for _license related API's
- License.LoadFromDisk(path) - Backported elasticsearch node improvements from master branch - Added bat file generations for the various clusters, allows you to manually start one of our test clusters with the right settings - Make sure tests that inherit ApiTestBase directly do not use a "real" client in `mixed` testing mode - Validate license information on startup, if this fails all tests fails. From the commandline we always start a fresh cluster so the trial license'll stay valid. If you manually start a node with no license but you have ES_LICENSE_FILE pointing to a license file we will try and register that.
1 parent 7e84274 commit a5ad23a

File tree

8 files changed

+417
-0
lines changed

8 files changed

+417
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"license.delete": {
3+
"documentation": "https://www.elastic.co/guide/en/shield/current/license-management.html",
4+
"methods": ["DELETE"],
5+
"url": {
6+
"path": "/_license",
7+
"paths": ["/_license"],
8+
"parts" : { },
9+
"params": { }
10+
},
11+
"body": null
12+
}
13+
}

src/Elasticsearch.Net/Domain/RequestParameters/RequestParameters.Generated.cs

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5111,4 +5111,66 @@ public class GraphExploreRequestParameters : FluentRequestParameters<GraphExplor
51115111
public GraphExploreRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path);
51125112

51135113
}
5114+
5115+
///<summary>Request parameters descriptor for LicenseDelete
5116+
///<pre>
5117+
///https://www.elastic.co/guide/en/shield/current/license-management.html
5118+
///</pre>
5119+
///</summary>
5120+
public class DeleteLicenseRequestParameters : FluentRequestParameters<DeleteLicenseRequestParameters>
5121+
{
5122+
public override HttpMethod DefaultHttpMethod => HttpMethod.DELETE;
5123+
5124+
///<summary>The URL-encoded request definition</summary>
5125+
public DeleteLicenseRequestParameters Source(string source) => this.AddQueryString("source", source);
5126+
5127+
5128+
///<summary>Comma separated list of filters used to reduce the response returned by Elasticsearch</summary>
5129+
public DeleteLicenseRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path);
5130+
5131+
}
5132+
5133+
///<summary>Request parameters descriptor for LicenseGet
5134+
///<pre>
5135+
///https://www.elastic.co/guide/en/shield/current/license-management.html
5136+
///</pre>
5137+
///</summary>
5138+
public class GetLicenseRequestParameters : FluentRequestParameters<GetLicenseRequestParameters>
5139+
{
5140+
public override HttpMethod DefaultHttpMethod => HttpMethod.GET;
5141+
5142+
///<summary>Return local information, do not retrieve the state from master node (default: false)</summary>
5143+
public GetLicenseRequestParameters Local(bool local) => this.AddQueryString("local", local);
5144+
5145+
5146+
///<summary>The URL-encoded request definition</summary>
5147+
public GetLicenseRequestParameters Source(string source) => this.AddQueryString("source", source);
5148+
5149+
5150+
///<summary>Comma separated list of filters used to reduce the response returned by Elasticsearch</summary>
5151+
public GetLicenseRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path);
5152+
5153+
}
5154+
5155+
///<summary>Request parameters descriptor for LicensePost
5156+
///<pre>
5157+
///https://www.elastic.co/guide/en/shield/current/license-management.html
5158+
///</pre>
5159+
///</summary>
5160+
public class PostLicenseRequestParameters : FluentRequestParameters<PostLicenseRequestParameters>
5161+
{
5162+
public override HttpMethod DefaultHttpMethod => HttpMethod.PUT;
5163+
5164+
///<summary>whether the user has acknowledged acknowledge messages (default: false)</summary>
5165+
public PostLicenseRequestParameters Acknowledge(bool acknowledge) => this.AddQueryString("acknowledge", acknowledge);
5166+
5167+
5168+
///<summary>The URL-encoded request definition</summary>
5169+
public PostLicenseRequestParameters Source(string source) => this.AddQueryString("source", source);
5170+
5171+
5172+
///<summary>Comma separated list of filters used to reduce the response returned by Elasticsearch</summary>
5173+
public PostLicenseRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path);
5174+
5175+
}
51145176
}

src/Elasticsearch.Net/ElasticLowLevelClient.Generated.cs

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8868,6 +8868,86 @@ public ElasticsearchResponse<T> XpackSecurityPutUserPost<T>(string username, Pos
88688868
public Task<ElasticsearchResponse<T>> XpackSecurityPutUserPostAsync<T>(string username, PostData<object> body, Func<PutUserRequestParameters, PutUserRequestParameters> requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
88698869
where T : class => this.DoRequestAsync<T>(POST, Url($"_xpack/security/user/{username.NotNull("username")}"), cancellationToken, body, _params(requestParameters));
88708870

8871+
///<summary>Represents a DELETE on /_license
8872+
///<para></para>Returns: ElasticsearchResponse&lt;T&gt; where the behavior depends on the type of T:
8873+
///<para> - T, an object you own that the elasticsearch response will be deserialized to </para>
8874+
///<para> - byte[], no deserialization, but the response stream will be closed </para>
8875+
///<para> - Stream, no deserialization, response stream is your responsibility </para>
8876+
///<para> - VoidResponse, no deserialization, response stream never read and closed </para>
8877+
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth </para>
8878+
///<para>See also: https://www.elastic.co/guide/en/shield/current/license-management.html </para>
8879+
///</summary>
8880+
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
8881+
public ElasticsearchResponse<T> LicenseDelete<T>(Func<DeleteLicenseRequestParameters, DeleteLicenseRequestParameters> requestParameters = null)
8882+
where T : class => this.DoRequest<T>(DELETE, Url($"_license"), null, _params(requestParameters));
8883+
8884+
///<summary>Represents a DELETE on /_license
8885+
///<para></para>Returns: A task of ElasticsearchResponse&lt;T&gt; where the behaviour depends on the type of T:
8886+
///<para> - T, an object you own that the elasticsearch response will be deserialized to </para>
8887+
///<para> - byte[], no deserialization, but the response stream will be closed </para>
8888+
///<para> - Stream, no deserialization, response stream is your responsibility </para>
8889+
///<para> - VoidResponse, no deserialization, response stream never read and closed </para>
8890+
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth </para>
8891+
///<para>See also: https://www.elastic.co/guide/en/shield/current/license-management.html </para>
8892+
///</summary>
8893+
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
8894+
public Task<ElasticsearchResponse<T>> LicenseDeleteAsync<T>(Func<DeleteLicenseRequestParameters, DeleteLicenseRequestParameters> requestParameters = null)
8895+
where T : class => this.DoRequestAsync<T>(DELETE, Url($"_license"), null, _params(requestParameters));
8896+
8897+
///<summary>Represents a GET on /_license
8898+
///<para></para>Returns: ElasticsearchResponse&lt;T&gt; where the behavior depends on the type of T:
8899+
///<para> - T, an object you own that the elasticsearch response will be deserialized to </para>
8900+
///<para> - byte[], no deserialization, but the response stream will be closed </para>
8901+
///<para> - Stream, no deserialization, response stream is your responsibility </para>
8902+
///<para> - VoidResponse, no deserialization, response stream never read and closed </para>
8903+
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth </para>
8904+
///<para>See also: https://www.elastic.co/guide/en/shield/current/license-management.html </para>
8905+
///</summary>
8906+
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
8907+
public ElasticsearchResponse<T> LicenseGet<T>(Func<GetLicenseRequestParameters, GetLicenseRequestParameters> requestParameters = null)
8908+
where T : class => this.DoRequest<T>(GET, Url($"_license"), null, _params(requestParameters));
8909+
8910+
///<summary>Represents a GET on /_license
8911+
///<para></para>Returns: A task of ElasticsearchResponse&lt;T&gt; where the behaviour depends on the type of T:
8912+
///<para> - T, an object you own that the elasticsearch response will be deserialized to </para>
8913+
///<para> - byte[], no deserialization, but the response stream will be closed </para>
8914+
///<para> - Stream, no deserialization, response stream is your responsibility </para>
8915+
///<para> - VoidResponse, no deserialization, response stream never read and closed </para>
8916+
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth </para>
8917+
///<para>See also: https://www.elastic.co/guide/en/shield/current/license-management.html </para>
8918+
///</summary>
8919+
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
8920+
public Task<ElasticsearchResponse<T>> LicenseGetAsync<T>(Func<GetLicenseRequestParameters, GetLicenseRequestParameters> requestParameters = null)
8921+
where T : class => this.DoRequestAsync<T>(GET, Url($"_license"), null, _params(requestParameters));
8922+
8923+
///<summary>Represents a PUT on /_license
8924+
///<para></para>Returns: ElasticsearchResponse&lt;T&gt; where the behavior depends on the type of T:
8925+
///<para> - T, an object you own that the elasticsearch response will be deserialized to </para>
8926+
///<para> - byte[], no deserialization, but the response stream will be closed </para>
8927+
///<para> - Stream, no deserialization, response stream is your responsibility </para>
8928+
///<para> - VoidResponse, no deserialization, response stream never read and closed </para>
8929+
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth </para>
8930+
///<para>See also: https://www.elastic.co/guide/en/shield/current/license-management.html </para>
8931+
///</summary>
8932+
///<param name="body">licenses to be installed</param>
8933+
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
8934+
public ElasticsearchResponse<T> LicensePost<T>(PostData<object> body, Func<PostLicenseRequestParameters, PostLicenseRequestParameters> requestParameters = null)
8935+
where T : class => this.DoRequest<T>(PUT, Url($"_license"), body, _params(requestParameters));
8936+
8937+
///<summary>Represents a PUT on /_license
8938+
///<para></para>Returns: A task of ElasticsearchResponse&lt;T&gt; where the behaviour depends on the type of T:
8939+
///<para> - T, an object you own that the elasticsearch response will be deserialized to </para>
8940+
///<para> - byte[], no deserialization, but the response stream will be closed </para>
8941+
///<para> - Stream, no deserialization, response stream is your responsibility </para>
8942+
///<para> - VoidResponse, no deserialization, response stream never read and closed </para>
8943+
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth </para>
8944+
///<para>See also: https://www.elastic.co/guide/en/shield/current/license-management.html </para>
8945+
///</summary>
8946+
///<param name="body">licenses to be installed</param>
8947+
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
8948+
public Task<ElasticsearchResponse<T>> LicensePostAsync<T>(PostData<object> body, Func<PostLicenseRequestParameters, PostLicenseRequestParameters> requestParameters = null)
8949+
where T : class => this.DoRequestAsync<T>(PUT, Url($"_license"), body, _params(requestParameters));
8950+
88718951

88728952
}
88738953
}

src/Elasticsearch.Net/IElasticLowLevelClient.Generated.cs

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8369,5 +8369,79 @@ public partial interface IElasticLowLevelClient
83698369
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
83708370
Task<ElasticsearchResponse<T>> GraphExploreAsync<T>(string index, string type, PostData<object> body, Func<GraphExploreRequestParameters, GraphExploreRequestParameters> requestParameters = null) where T : class;
83718371

8372+
///<summary>Represents a DELETE on /_license
8373+
///<para></para>Returns: ElasticsearchResponse&lt;T&gt; where the behavior depends on the type of T:
8374+
///<para> - T, an object you own that the elasticsearch response will be deserialized to </para>
8375+
///<para> - byte[], no deserialization, but the response stream will be closed </para>
8376+
///<para> - Stream, no deserialization, response stream is your responsibility </para>
8377+
///<para> - VoidResponse, no deserialization, response stream never read and closed </para>
8378+
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth </para>
8379+
///<para>See also: https://www.elastic.co/guide/en/shield/current/license-management.html </para>
8380+
///</summary>
8381+
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
8382+
ElasticsearchResponse<T> LicenseDelete<T>(Func<DeleteLicenseRequestParameters, DeleteLicenseRequestParameters> requestParameters = null) where T : class;
8383+
8384+
///<summary>Represents a DELETE on /_license
8385+
///<para></para>Returns: A task of ElasticsearchResponse&lt;T&gt; where the behaviour depends on the type of T:
8386+
///<para> - T, an object you own that the elasticsearch response will be deserialized to </para>
8387+
///<para> - byte[], no deserialization, but the response stream will be closed </para>
8388+
///<para> - Stream, no deserialization, response stream is your responsibility </para>
8389+
///<para> - VoidResponse, no deserialization, response stream never read and closed </para>
8390+
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth </para>
8391+
///<para>See also: https://www.elastic.co/guide/en/shield/current/license-management.html </para>
8392+
///</summary>
8393+
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
8394+
Task<ElasticsearchResponse<T>> LicenseDeleteAsync<T>(Func<DeleteLicenseRequestParameters, DeleteLicenseRequestParameters> requestParameters = null) where T : class;
8395+
8396+
///<summary>Represents a GET on /_license
8397+
///<para></para>Returns: ElasticsearchResponse&lt;T&gt; where the behavior depends on the type of T:
8398+
///<para> - T, an object you own that the elasticsearch response will be deserialized to </para>
8399+
///<para> - byte[], no deserialization, but the response stream will be closed </para>
8400+
///<para> - Stream, no deserialization, response stream is your responsibility </para>
8401+
///<para> - VoidResponse, no deserialization, response stream never read and closed </para>
8402+
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth </para>
8403+
///<para>See also: https://www.elastic.co/guide/en/shield/current/license-management.html </para>
8404+
///</summary>
8405+
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
8406+
ElasticsearchResponse<T> LicenseGet<T>(Func<GetLicenseRequestParameters, GetLicenseRequestParameters> requestParameters = null) where T : class;
8407+
8408+
///<summary>Represents a GET on /_license
8409+
///<para></para>Returns: A task of ElasticsearchResponse&lt;T&gt; where the behaviour depends on the type of T:
8410+
///<para> - T, an object you own that the elasticsearch response will be deserialized to </para>
8411+
///<para> - byte[], no deserialization, but the response stream will be closed </para>
8412+
///<para> - Stream, no deserialization, response stream is your responsibility </para>
8413+
///<para> - VoidResponse, no deserialization, response stream never read and closed </para>
8414+
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth </para>
8415+
///<para>See also: https://www.elastic.co/guide/en/shield/current/license-management.html </para>
8416+
///</summary>
8417+
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
8418+
Task<ElasticsearchResponse<T>> LicenseGetAsync<T>(Func<GetLicenseRequestParameters, GetLicenseRequestParameters> requestParameters = null) where T : class;
8419+
8420+
///<summary>Represents a PUT on /_license
8421+
///<para></para>Returns: ElasticsearchResponse&lt;T&gt; where the behavior depends on the type of T:
8422+
///<para> - T, an object you own that the elasticsearch response will be deserialized to </para>
8423+
///<para> - byte[], no deserialization, but the response stream will be closed </para>
8424+
///<para> - Stream, no deserialization, response stream is your responsibility </para>
8425+
///<para> - VoidResponse, no deserialization, response stream never read and closed </para>
8426+
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth </para>
8427+
///<para>See also: https://www.elastic.co/guide/en/shield/current/license-management.html </para>
8428+
///</summary>
8429+
///<param name="body">licenses to be installed</param>
8430+
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
8431+
ElasticsearchResponse<T> LicensePost<T>(PostData<object> body, Func<PostLicenseRequestParameters, PostLicenseRequestParameters> requestParameters = null) where T : class;
8432+
8433+
///<summary>Represents a PUT on /_license
8434+
///<para></para>Returns: A task of ElasticsearchResponse&lt;T&gt; where the behaviour depends on the type of T:
8435+
///<para> - T, an object you own that the elasticsearch response will be deserialized to </para>
8436+
///<para> - byte[], no deserialization, but the response stream will be closed </para>
8437+
///<para> - Stream, no deserialization, response stream is your responsibility </para>
8438+
///<para> - VoidResponse, no deserialization, response stream never read and closed </para>
8439+
///<para> - DynamicDictionary, a dynamic aware dictionary that can be safely traversed to any depth </para>
8440+
///<para>See also: https://www.elastic.co/guide/en/shield/current/license-management.html </para>
8441+
///</summary>
8442+
///<param name="body">licenses to be installed</param>
8443+
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
8444+
Task<ElasticsearchResponse<T>> LicensePostAsync<T>(PostData<object> body, Func<PostLicenseRequestParameters, PostLicenseRequestParameters> requestParameters = null) where T : class;
8445+
83728446
}
83738447
}

0 commit comments

Comments
 (0)