Skip to content

Commit 4e499c3

Browse files
committed
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 f6f73f2 commit 4e499c3

39 files changed

+2586
-135
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
@@ -4603,4 +4603,170 @@ public class PostLicenseRequestParameters : FluentRequestParameters<PostLicenseR
46034603
public PostLicenseRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path);
46044604

46054605
}
4606+
4607+
///<summary>Request parameters descriptor for ShieldAuthenticate
4608+
///<pre>
4609+
///Retrieve details about the currently authenticated user
4610+
///</pre>
4611+
///</summary>
4612+
public class AuthenticateRequestParameters : FluentRequestParameters<AuthenticateRequestParameters>
4613+
{
4614+
public override HttpMethod DefaultHttpMethod => HttpMethod.GET;
4615+
4616+
///<summary>The URL-encoded request definition</summary>
4617+
public AuthenticateRequestParameters Source(string source) => this.AddQueryString("source", source);
4618+
4619+
4620+
///<summary>Comma separated list of filters used to reduce the response returned by Elasticsearch</summary>
4621+
public AuthenticateRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path);
4622+
4623+
}
4624+
4625+
///<summary>Request parameters descriptor for ShieldClearCachedRealms
4626+
///<pre>
4627+
///Clears the internal user caches for specified realms
4628+
///</pre>
4629+
///</summary>
4630+
public class ClearCachedRealmsRequestParameters : FluentRequestParameters<ClearCachedRealmsRequestParameters>
4631+
{
4632+
public override HttpMethod DefaultHttpMethod => HttpMethod.POST;
4633+
4634+
///<summary>Comma-separated list of usernames to clear from the cache</summary>
4635+
public ClearCachedRealmsRequestParameters Usernames(params string[] usernames) => this.AddQueryString("usernames", usernames);
4636+
4637+
4638+
///<summary>The URL-encoded request definition</summary>
4639+
public ClearCachedRealmsRequestParameters Source(string source) => this.AddQueryString("source", source);
4640+
4641+
4642+
///<summary>Comma separated list of filters used to reduce the response returned by Elasticsearch</summary>
4643+
public ClearCachedRealmsRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path);
4644+
4645+
}
4646+
4647+
///<summary>Request parameters descriptor for ShieldClearCachedRoles
4648+
///<pre>
4649+
///Clears the internal caches for specified roles
4650+
///</pre>
4651+
///</summary>
4652+
public class ClearCachedRolesRequestParameters : FluentRequestParameters<ClearCachedRolesRequestParameters>
4653+
{
4654+
public override HttpMethod DefaultHttpMethod => HttpMethod.POST;
4655+
4656+
///<summary>The URL-encoded request definition</summary>
4657+
public ClearCachedRolesRequestParameters Source(string source) => this.AddQueryString("source", source);
4658+
4659+
4660+
///<summary>Comma separated list of filters used to reduce the response returned by Elasticsearch</summary>
4661+
public ClearCachedRolesRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path);
4662+
4663+
}
4664+
4665+
///<summary>Request parameters descriptor for ShieldDeleteRole
4666+
///<pre>
4667+
///Remove a role from the native shield realm
4668+
///</pre>
4669+
///</summary>
4670+
public class DeleteRoleRequestParameters : FluentRequestParameters<DeleteRoleRequestParameters>
4671+
{
4672+
public override HttpMethod DefaultHttpMethod => HttpMethod.DELETE;
4673+
4674+
///<summary>The URL-encoded request definition</summary>
4675+
public DeleteRoleRequestParameters Source(string source) => this.AddQueryString("source", source);
4676+
4677+
4678+
///<summary>Comma separated list of filters used to reduce the response returned by Elasticsearch</summary>
4679+
public DeleteRoleRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path);
4680+
4681+
}
4682+
4683+
///<summary>Request parameters descriptor for ShieldDeleteUser
4684+
///<pre>
4685+
///Remove a user from the native shield realm
4686+
///</pre>
4687+
///</summary>
4688+
public class DeleteUserRequestParameters : FluentRequestParameters<DeleteUserRequestParameters>
4689+
{
4690+
public override HttpMethod DefaultHttpMethod => HttpMethod.DELETE;
4691+
4692+
///<summary>The URL-encoded request definition</summary>
4693+
public DeleteUserRequestParameters Source(string source) => this.AddQueryString("source", source);
4694+
4695+
4696+
///<summary>Comma separated list of filters used to reduce the response returned by Elasticsearch</summary>
4697+
public DeleteUserRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path);
4698+
4699+
}
4700+
4701+
///<summary>Request parameters descriptor for ShieldGetRole
4702+
///<pre>
4703+
///Retrieve one or more roles from the native shield realm
4704+
///</pre>
4705+
///</summary>
4706+
public class GetRoleRequestParameters : FluentRequestParameters<GetRoleRequestParameters>
4707+
{
4708+
public override HttpMethod DefaultHttpMethod => HttpMethod.GET;
4709+
4710+
///<summary>The URL-encoded request definition</summary>
4711+
public GetRoleRequestParameters Source(string source) => this.AddQueryString("source", source);
4712+
4713+
4714+
///<summary>Comma separated list of filters used to reduce the response returned by Elasticsearch</summary>
4715+
public GetRoleRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path);
4716+
4717+
}
4718+
4719+
///<summary>Request parameters descriptor for ShieldGetUser
4720+
///<pre>
4721+
///Retrieve one or more users from the native shield realm
4722+
///</pre>
4723+
///</summary>
4724+
public class GetUserRequestParameters : FluentRequestParameters<GetUserRequestParameters>
4725+
{
4726+
public override HttpMethod DefaultHttpMethod => HttpMethod.GET;
4727+
4728+
///<summary>The URL-encoded request definition</summary>
4729+
public GetUserRequestParameters Source(string source) => this.AddQueryString("source", source);
4730+
4731+
4732+
///<summary>Comma separated list of filters used to reduce the response returned by Elasticsearch</summary>
4733+
public GetUserRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path);
4734+
4735+
}
4736+
4737+
///<summary>Request parameters descriptor for ShieldPutRole
4738+
///<pre>
4739+
///Update or create a role for the native shield realm
4740+
///</pre>
4741+
///</summary>
4742+
public class PutRoleRequestParameters : FluentRequestParameters<PutRoleRequestParameters>
4743+
{
4744+
public override HttpMethod DefaultHttpMethod => HttpMethod.PUT;
4745+
4746+
///<summary>The URL-encoded request definition</summary>
4747+
public PutRoleRequestParameters Source(string source) => this.AddQueryString("source", source);
4748+
4749+
4750+
///<summary>Comma separated list of filters used to reduce the response returned by Elasticsearch</summary>
4751+
public PutRoleRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path);
4752+
4753+
}
4754+
4755+
///<summary>Request parameters descriptor for ShieldPutUser
4756+
///<pre>
4757+
///Update or create a user for the native shield realm
4758+
///</pre>
4759+
///</summary>
4760+
public class PutUserRequestParameters : FluentRequestParameters<PutUserRequestParameters>
4761+
{
4762+
public override HttpMethod DefaultHttpMethod => HttpMethod.PUT;
4763+
4764+
///<summary>The URL-encoded request definition</summary>
4765+
public PutUserRequestParameters Source(string source) => this.AddQueryString("source", source);
4766+
4767+
4768+
///<summary>Comma separated list of filters used to reduce the response returned by Elasticsearch</summary>
4769+
public PutUserRequestParameters FilterPath(string filter_path) => this.AddQueryString("filter_path", filter_path);
4770+
4771+
}
46064772
}

0 commit comments

Comments
 (0)