Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add security APIs #3584

Merged
merged 20 commits into from
Mar 19, 2019
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
d1ed416
Update spec files to 6.5 and add Ccr API's
Mpdreamz Dec 18, 2018
9fa3764
update last_downloaded_version.txt
Mpdreamz Dec 18, 2018
8019468
Code formatting moved static initializers in an order that did not ev…
Mpdreamz Dec 18, 2018
a855504
base code generation for all the following PR's as we start to implem…
Mpdreamz Dec 18, 2018
05ade62
update tests dependencies to latest
Mpdreamz Dec 18, 2018
fd55bca
Improved json diff generation, we do not move into arrays to sort obj…
Mpdreamz Dec 19, 2018
c7f462c
<langversion>latest</langversion> on all projects
Mpdreamz Jan 2, 2019
c11b4d2
Started on generating security privileges API's
Mpdreamz Jan 14, 2019
cf0ce22
Started on mapping Privileges API's
Mpdreamz Jan 14, 2019
f366f5c
staging progress
Mpdreamz Jan 24, 2019
28c9eb4
Has Privileges API endpoint.
codebrain Feb 27, 2019
89bcfea
Remove VoidResponse call
codebrain Feb 28, 2019
ddd4b35
Additional integration tests and fix response body formats
codebrain Mar 1, 2019
7e5bfce
Add documentation
codebrain Mar 7, 2019
768e1c6
Address PR comments, changing response type for Has Privileges API calls
codebrain Mar 8, 2019
18da716
Remove ApplicationName type and move implementation to use existing N…
codebrain Mar 18, 2019
75d95dc
Merge branch '6.6' into v65/security-privileges.
codebrain Mar 18, 2019
0fbbb00
Implement JsonConverters on properties
codebrain Mar 18, 2019
db69de9
Use loops in ReadJson implementations
russcam Mar 18, 2019
76f376c
Mark TODO as fixable in 7.x
codebrain Mar 19, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/CodeGeneration/ApiGenerator/ApiGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,14 @@ public class ApiGenerator
"xpack.ml.put_calendar.json",
"xpack.ml.put_calendar_job.json",
"xpack.ml.get_calendar_job.json",
"xpack.ml.delete_forecast.json",
"xpack.ml.find_file_structure.json",
"xpack.ssl.certificates.json",
"delete_by_query_rethrottle.json",
"update_by_query_rethrottle.json",

// 6.4 new API's
"xpack.ml.update_filter.json",
"xpack.security.delete_privileges.json",
"xpack.security.get_privileges.json",
"xpack.security.has_privileges.json",
"xpack.security.put_privilege.json",
"xpack.security.put_privileges.json",
"xpack.rollup.get_rollup_index_caps.json",
"nodes.reload_secure_settings.json"
};

Expand Down
16 changes: 9 additions & 7 deletions src/CodeGeneration/ApiGenerator/CodeConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ public static class CodeConfiguration
{
private static string _root = null;

// @formatter:off — disable formatter after this line
public static string EsNetFolder { get; } = $@"{Root}..\..\..\src\Elasticsearch.Net\";
public static string LastDownloadedVersionFile { get; } = Path.Combine(Root, "last_downloaded_version.txt");

public static string NestFolder { get; } = $@"{Root}..\..\..\src\Nest\";
public static string RestSpecificationFolder { get; } = $@"{Root}RestSpecification\";
public static string ViewFolder { get; } = $@"{Root}Views\";
// @formatter:on — enable formatter after this line

public static readonly Assembly Assembly = typeof(ApiGenerator).Assembly;

public static readonly Dictionary<string, string> ApiNameMapping =
Expand Down Expand Up @@ -50,13 +59,6 @@ where c.StartsWith("I") && c.Contains("Request")
.ToDictionary(k => k.Key, v => v.Value);


public static string EsNetFolder { get; } = $@"{Root}..\..\..\src\Elasticsearch.Net\";
public static string LastDownloadedVersionFile { get; } = Path.Combine(Root, "last_downloaded_version.txt");

public static string NestFolder { get; } = $@"{Root}..\..\..\src\Nest\";
public static string RestSpecificationFolder { get; } = $@"{Root}RestSpecification\";
public static string ViewFolder { get; } = $@"{Root}Views\";

private static string Root
{
get
Expand Down
2 changes: 2 additions & 0 deletions src/CodeGeneration/ApiGenerator/Domain/ApiUrlPart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public string ClrTypeName
return "Metrics";
case "feature": return "Features";
case "action_id": return "ActionIds";
case "application": return "ApplicationName";
case "repository":
case "snapshot":
case "lang":
Expand All @@ -69,6 +70,7 @@ public string ClrTypeName
case "alias":
case "context":
case "name":
case "user":
case "thread_pool_patterns":
return Type == "string" ? "Name" : "Names";
case "parent_task_id":
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"delete_by_query_rethrottle": {
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html",
"methods": ["POST"],
"url": {
"path": "/_delete_by_query/{task_id}/_rethrottle",
"paths": ["/_delete_by_query/{task_id}/_rethrottle"],
"parts": {
"task_id": {
"type": "string",
"required" : true,
"description": "The task id to rethrottle"
}
},
"params": {
"requests_per_second": {
"type": "number",
"required": true,
"description": "The throttle to set on this request in floating sub-requests per second. -1 means set no throttle."
}
}
},
"body": null
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
"type" : "number",
"description" : "A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on it's rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint.",
"default" : 128
},
"max_concurrent_shard_requests" : {
"type" : "number",
"description" : "The number of concurrent shard requests each sub search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests",
"default" : "The default grows with the number of nodes in the cluster but is at most 256."
}
}
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"nodes.reload_secure_settings": {
"documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-reload-secure-settings.html",
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/6.5/secure-settings.html#reloadable-secure-settings",
"methods": ["POST"],
"url": {
"path": "/_nodes/reload_secure_settings",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"methods": ["POST"],
"url": {
"path": "/_reindex/{task_id}/_rethrottle",
"paths": ["/_reindex/{task_id}/_rethrottle", "/_update_by_query/{task_id}/_rethrottle", "/_delete_by_query/{task_id}/_rethrottle"],
"paths": ["/_reindex/{task_id}/_rethrottle"],
"parts": {
"task_id": {
"type": "string",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"update_by_query_rethrottle": {
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html",
"methods": ["POST"],
"url": {
"path": "/_update_by_query/{task_id}/_rethrottle",
"paths": ["/_update_by_query/{task_id}/_rethrottle"],
"parts": {
"task_id": {
"type": "string",
"required" : true,
"description": "The task id to rethrottle"
}
},
"params": {
"requests_per_second": {
"type": "number",
"required": true,
"description": "The throttle to set on this request in floating sub-requests per second. -1 means set no throttle."
}
}
},
"body": null
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"ccr.delete_auto_follow_pattern": {
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-delete-auto-follow-pattern.html",
"methods": [ "DELETE" ],
"url": {
"path": "/_ccr/auto_follow/{name}",
"paths": [ "/_ccr/auto_follow/{name}" ],
"parts": {
"name": {
"type": "string",
"required": true,
"description": "The name of the auto follow pattern."
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"ccr.follow": {
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-put-follow.html",
"methods": [ "PUT" ],
"url": {
"path": "/{index}/_ccr/follow",
"paths": [ "/{index}/_ccr/follow" ],
"parts": {
"index": {
"type": "string",
"required": true,
"description": "The name of the follower index"
}
}
},
"body": {
"description" : "The name of the leader index and other optional ccr related parameters",
"required" : true
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"ccr.follow_stats": {
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-follow-stats.html",
"methods": [ "GET" ],
"url": {
"path": "/{index}/_ccr/stats",
"paths": [ "/{index}/_ccr/stats" ],
"parts": {
"index": {
"type": "list",
"description": "A comma-separated list of index patterns; use `_all` to perform the operation on all indices"
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"ccr.get_auto_follow_pattern": {
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-auto-follow-pattern.html",
"methods": [ "GET" ],
"url": {
"path": "/_ccr/auto_follow/{name}",
"paths": [ "/_ccr/auto_follow", "/_ccr/auto_follow/{name}" ],
"parts": {
"name": {
"type": "string",
"description": "The name of the auto follow pattern."
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"ccr.pause_follow": {
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-pause-follow.html",
"methods": [ "POST" ],
"url": {
"path": "/{index}/_ccr/pause_follow",
"paths": [ "/{index}/_ccr/pause_follow" ],
"parts": {
"index": {
"type": "string",
"required": true,
"description": "The name of the follower index that should pause following its leader index."
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"ccr.put_auto_follow_pattern": {
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-put-auto-follow-pattern.html",
"methods": [ "PUT" ],
"url": {
"path": "/_ccr/auto_follow/{name}",
"paths": [ "/_ccr/auto_follow/{name}" ],
"parts": {
"name": {
"type": "string",
"required": true,
"description": "The name of the auto follow pattern."
}
}
},
"body": {
"description" : "The specification of the auto follow pattern",
"required" : true
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"ccr.resume_follow": {
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-resume-follow.html",
"methods": [ "POST" ],
"url": {
"path": "/{index}/_ccr/resume_follow",
"paths": [ "/{index}/_ccr/resume_follow" ],
"parts": {
"index": {
"type": "string",
"required": true,
"description": "The name of the follow index to resume following."
}
}
},
"body": {
"description" : "The name of the leader index and other optional ccr related parameters",
"required" : true
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"ccr.stats": {
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-stats.html",
"methods": [ "GET" ],
"url": {
"path": "/_ccr/stats",
"paths": [ "/_ccr/stats" ],
"parts": {},
"body": null
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"ccr.unfollow": {
"documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current",
"methods": [ "POST" ],
"url": {
"path": "/{index}/_ccr/unfollow",
"paths": [ "/{index}/_ccr/unfollow" ],
"parts": {
"index": {
"type": "string",
"required": true,
"description": "The name of the follower index that should be turned into a regular index."
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"xpack.ml.delete_forecast": {
"documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-forecast.html",
"methods": [ "DELETE" ],
"url": {
"path": "/_xpack/ml/anomaly_detectors/{job_id}/_forecast/{forecast_id}",
"paths": [
"/_xpack/ml/anomaly_detectors/{job_id}/_forecast",
"/_xpack/ml/anomaly_detectors/{job_id}/_forecast/{forecast_id}"
],
"parts": {
"job_id": {
"type": "string",
"required": true,
"description": "The ID of the job from which to delete forecasts"
},
"forecast_id": {
"type": "string",
"required": false,
"description": "The ID of the forecast to delete, can be comma delimited list. Leaving blank implies `_all`"
}
},
"params": {
"allow_no_forecasts": {
"type": "boolean",
"required": false,
"description": "Whether to ignore if `_all` matches no forecasts"
},
"timeout": {
"type": "time",
"requred": false,
"description": "Controls the time to wait until the forecast(s) are deleted. Default to 30 seconds"
}
}
},
"body": null
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@
"params": {
"force": {
"type": "boolean",
"required": false,
"description": "True if the job should be forcefully deleted"
"description": "True if the job should be forcefully deleted",
"default": false
},
"wait_for_completion": {
"type": "boolean",
"description": "Should this request wait until the operation has completed before returning",
"default": true
}
}
},
Expand Down
Loading