Skip to content

Commit 846c84e

Browse files
Mpdreamzrusscam
authored andcommitted
Add support for _shield related API's (#2053)
* authenticate * clear cached realms * roles * clear cached roles * delete role(s) * put role * get role(s) * user * delete user(s) * put user * get user(s) This also adds support for any request to be able to specify the `es-shield-runas-user` http header though the `RunAs` property on `RequestConfiguration` The OIS version of requests now directly exposes `RequestConfiguration` Conflicts: src/Tests/Mapping/Types/Core/String/StringMappingTests.cs
1 parent ceb5375 commit 846c84e

37 files changed

+2014
-4
lines changed

src/CodeGeneration/CodeGeneration.LowLevelClient/RestSpecification/XPack/Shield/shield.clear_cached_realms.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
"paths": [ "/_shield/realm/{realms}/_clear_cache" ],
88
"parts": {
99
"realms": {
10-
"type" : "string",
10+
"type" : "list",
1111
"description" : "Comma-separated list of realms to clear",
1212
"required" : true
1313
}
1414
},
1515
"params": {
1616
"usernames": {
17-
"type" : "string",
17+
"type" : "list",
1818
"description" : "Comma-separated list of usernames to clear from the cache",
1919
"required" : false
2020
}

src/CodeGeneration/CodeGeneration.LowLevelClient/RestSpecification/XPack/Shield/shield.clear_cached_roles.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"shield.clear_cached_roles": {
33
"documentation": "Clears the internal caches for specified roles",
4-
"methods": [ "PUT", "POST" ],
4+
"methods": [ "POST" ],
55
"url": {
66
"path": "/_shield/role/{name}/_clear_cache",
77
"paths": [ "/_shield/role/{name}/_clear_cache" ],
88
"parts": {
99
"name": {
10-
"type" : "string",
10+
"type" : "list",
1111
"description" : "Role name",
1212
"required" : true
1313
}

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

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5173,4 +5173,170 @@ public class PostLicenseRequestParameters : FluentRequestParameters<PostLicenseR
51735173
public PostLicenseRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path);
51745174

51755175
}
5176+
5177+
///<summary>Request parameters descriptor for ShieldAuthenticate
5178+
///<pre>
5179+
///Retrieve details about the currently authenticated user
5180+
///</pre>
5181+
///</summary>
5182+
public class AuthenticateRequestParameters : FluentRequestParameters<AuthenticateRequestParameters>
5183+
{
5184+
public override HttpMethod DefaultHttpMethod => HttpMethod.GET;
5185+
5186+
///<summary>The URL-encoded request definition</summary>
5187+
public AuthenticateRequestParameters Source(string source) => this.AddQueryString("source", source);
5188+
5189+
5190+
///<summary>Comma separated list of filters used to reduce the response returned by Elasticsearch</summary>
5191+
public AuthenticateRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path);
5192+
5193+
}
5194+
5195+
///<summary>Request parameters descriptor for ShieldClearCachedRealms
5196+
///<pre>
5197+
///Clears the internal user caches for specified realms
5198+
///</pre>
5199+
///</summary>
5200+
public class ClearCachedRealmsRequestParameters : FluentRequestParameters<ClearCachedRealmsRequestParameters>
5201+
{
5202+
public override HttpMethod DefaultHttpMethod => HttpMethod.POST;
5203+
5204+
///<summary>Comma-separated list of usernames to clear from the cache</summary>
5205+
public ClearCachedRealmsRequestParameters Usernames(params string[] usernames) => this.AddQueryString("usernames", usernames);
5206+
5207+
5208+
///<summary>The URL-encoded request definition</summary>
5209+
public ClearCachedRealmsRequestParameters Source(string source) => this.AddQueryString("source", source);
5210+
5211+
5212+
///<summary>Comma separated list of filters used to reduce the response returned by Elasticsearch</summary>
5213+
public ClearCachedRealmsRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path);
5214+
5215+
}
5216+
5217+
///<summary>Request parameters descriptor for ShieldClearCachedRoles
5218+
///<pre>
5219+
///Clears the internal caches for specified roles
5220+
///</pre>
5221+
///</summary>
5222+
public class ClearCachedRolesRequestParameters : FluentRequestParameters<ClearCachedRolesRequestParameters>
5223+
{
5224+
public override HttpMethod DefaultHttpMethod => HttpMethod.POST;
5225+
5226+
///<summary>The URL-encoded request definition</summary>
5227+
public ClearCachedRolesRequestParameters Source(string source) => this.AddQueryString("source", source);
5228+
5229+
5230+
///<summary>Comma separated list of filters used to reduce the response returned by Elasticsearch</summary>
5231+
public ClearCachedRolesRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path);
5232+
5233+
}
5234+
5235+
///<summary>Request parameters descriptor for ShieldDeleteRole
5236+
///<pre>
5237+
///Remove a role from the native shield realm
5238+
///</pre>
5239+
///</summary>
5240+
public class DeleteRoleRequestParameters : FluentRequestParameters<DeleteRoleRequestParameters>
5241+
{
5242+
public override HttpMethod DefaultHttpMethod => HttpMethod.DELETE;
5243+
5244+
///<summary>The URL-encoded request definition</summary>
5245+
public DeleteRoleRequestParameters Source(string source) => this.AddQueryString("source", source);
5246+
5247+
5248+
///<summary>Comma separated list of filters used to reduce the response returned by Elasticsearch</summary>
5249+
public DeleteRoleRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path);
5250+
5251+
}
5252+
5253+
///<summary>Request parameters descriptor for ShieldDeleteUser
5254+
///<pre>
5255+
///Remove a user from the native shield realm
5256+
///</pre>
5257+
///</summary>
5258+
public class DeleteUserRequestParameters : FluentRequestParameters<DeleteUserRequestParameters>
5259+
{
5260+
public override HttpMethod DefaultHttpMethod => HttpMethod.DELETE;
5261+
5262+
///<summary>The URL-encoded request definition</summary>
5263+
public DeleteUserRequestParameters Source(string source) => this.AddQueryString("source", source);
5264+
5265+
5266+
///<summary>Comma separated list of filters used to reduce the response returned by Elasticsearch</summary>
5267+
public DeleteUserRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path);
5268+
5269+
}
5270+
5271+
///<summary>Request parameters descriptor for ShieldGetRole
5272+
///<pre>
5273+
///Retrieve one or more roles from the native shield realm
5274+
///</pre>
5275+
///</summary>
5276+
public class GetRoleRequestParameters : FluentRequestParameters<GetRoleRequestParameters>
5277+
{
5278+
public override HttpMethod DefaultHttpMethod => HttpMethod.GET;
5279+
5280+
///<summary>The URL-encoded request definition</summary>
5281+
public GetRoleRequestParameters Source(string source) => this.AddQueryString("source", source);
5282+
5283+
5284+
///<summary>Comma separated list of filters used to reduce the response returned by Elasticsearch</summary>
5285+
public GetRoleRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path);
5286+
5287+
}
5288+
5289+
///<summary>Request parameters descriptor for ShieldGetUser
5290+
///<pre>
5291+
///Retrieve one or more users from the native shield realm
5292+
///</pre>
5293+
///</summary>
5294+
public class GetUserRequestParameters : FluentRequestParameters<GetUserRequestParameters>
5295+
{
5296+
public override HttpMethod DefaultHttpMethod => HttpMethod.GET;
5297+
5298+
///<summary>The URL-encoded request definition</summary>
5299+
public GetUserRequestParameters Source(string source) => this.AddQueryString("source", source);
5300+
5301+
5302+
///<summary>Comma separated list of filters used to reduce the response returned by Elasticsearch</summary>
5303+
public GetUserRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path);
5304+
5305+
}
5306+
5307+
///<summary>Request parameters descriptor for ShieldPutRole
5308+
///<pre>
5309+
///Update or create a role for the native shield realm
5310+
///</pre>
5311+
///</summary>
5312+
public class PutRoleRequestParameters : FluentRequestParameters<PutRoleRequestParameters>
5313+
{
5314+
public override HttpMethod DefaultHttpMethod => HttpMethod.PUT;
5315+
5316+
///<summary>The URL-encoded request definition</summary>
5317+
public PutRoleRequestParameters Source(string source) => this.AddQueryString("source", source);
5318+
5319+
5320+
///<summary>Comma separated list of filters used to reduce the response returned by Elasticsearch</summary>
5321+
public PutRoleRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path);
5322+
5323+
}
5324+
5325+
///<summary>Request parameters descriptor for ShieldPutUser
5326+
///<pre>
5327+
///Update or create a user for the native shield realm
5328+
///</pre>
5329+
///</summary>
5330+
public class PutUserRequestParameters : FluentRequestParameters<PutUserRequestParameters>
5331+
{
5332+
public override HttpMethod DefaultHttpMethod => HttpMethod.PUT;
5333+
5334+
///<summary>The URL-encoded request definition</summary>
5335+
public PutUserRequestParameters Source(string source) => this.AddQueryString("source", source);
5336+
5337+
5338+
///<summary>Comma separated list of filters used to reduce the response returned by Elasticsearch</summary>
5339+
public PutUserRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path);
5340+
5341+
}
51765342
}

0 commit comments

Comments
 (0)