Add REST endpoint to check consistency of external IDs

The REST endpoint is generic so that further consistency checks can be
added later. Each consistency check has a specific input entity so that
sepcific options for a check can be set. At the moment the consistency
check for external IDs doesn't support any input options, but we may add
options later, e.g. to tell the consistency check to automatically fix
certain inconsistencies.

Change-Id: I2ae76ea9254798744d8d5408d1ba640931319ed8
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2017-03-24 15:32:03 +01:00
parent a2b6bd9648
commit 54fd1d362a
10 changed files with 672 additions and 8 deletions

View File

@@ -138,6 +138,51 @@ As result a link:#server-info[ServerInfo] entity is returned.
}
----
[[check-consistency]]
=== Check Consistency
--
'POST /config/server/check'
--
Runs consistency checks and returns detected problems.
Input for the consistency checks that should be run must be provided in
the request body inside a
link:#consistency-check-input[ConsistencyCheckInput] entity.
.Request
----
POST /config/server/check HTTP/1.0
Content-Type: application/json; charset=UTF-8
{
"check_account_external_ids": {}
}
----
As result a link:#consistency-check-info[ConsistencyCheckInfo] entity
is returned that contains detected consistency problems.
.Response
----
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
)]}'
{
"results": {
"account_external_id_result": {
"problems": [
{
"status": "ERROR",
"message": "External ID \u0027uuid:ccb8d323-1361-45aa-8874-41987a660c46\u0027 belongs to account that doesn\u0027t exist: 1000012"
}
]
}
}
}
----
[[confirm-email]]
=== Confirm Email
--
@@ -1365,6 +1410,66 @@ link:config-gerrit.html#change.submitWholeTopic[A configuration if
the whole topic is submitted].
|=============================
[[check-account-external-ids-input]]
=== CheckAccountExternalIdsInput
The `CheckAccountExternalIdsInput` entity contains input for the
account external IDs consistency check.
Currently this entity contains no fields.
[[check-account-external-ids-result-info]]
=== CheckAccountExternalIdsResultInfo
The `CheckAccountExternalIdsResultInfo` entity contains the result of
running the account external IDs consistency check.
[options="header",cols="1,6"]
|======================
|Field Name|Description
|`problems`|A list of link:#consistency-problem-info[
ConsistencyProblemInfo] entities.
|======================
[[consistency-check-info]]
=== ConsistencyCheckInfo
The `ConsistencyCheckInfo` entity contains the results of running
consistency checks.
[options="header",cols="1,^1,5"]
|================================================
|Field Name ||Description
|`check_account_external_ids_result`|optional|
The result of running the account external ID consistency check as a
link:#check-account-external-ids-result-info[
CheckAccountExternalIdsResultInfo] entity.
|================================================
[[consistency-check-input]]
=== ConsistencyCheckInput
The `ConsistencyCheckInput` entity contains information about which
consistency checks should be run.
[options="header",cols="1,^1,5"]
|=========================================
|Field Name ||Description
|`check_account_external_ids`|optional|
Input for the account external ID consistency check as
link:#check-account-external-ids-input[CheckAccountExternalIdsInput]
entity.
|=========================================
[[consistency-problem-info]]
=== ConsistencyProblemInfo
The `ConsistencyProblemInfo` entity contains information about a
consistency problem.
[options="header",cols="1,6"]
|======================
|Field Name|Description
|`status` |The status of the consistency problem. +
Possible values are `ERROR` and `WARNING`.
|`message` |Message describing the consistency problem.
|======================
[[download-info]]
=== DownloadInfo
The `DownloadInfo` entity contains information about supported download