-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
User Profile - GetProfile API nows supports multiple UIDs (#89023)
This PR expands the existing GetProfile API to support getting multiple profiles by IDs. As a result, the response format is also changed to align with the latest version of API design guideline. Concretely, this means moving the profiles as an array inside a top level "profiles" field so that (1) does not mix dynamic fields (uid) with static fields and (2) enforcing an order in the response which is desirable for clients. The change also reports any error encounter in the retrieving process in a top level "errors" field. Relates: #81910
- Loading branch information
Showing
26 changed files
with
951 additions
and
366 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
pr: 89023 | ||
summary: User Profile - `GetProfile` API nows supports multiple UIDs | ||
area: Security | ||
type: enhancement | ||
issues: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/common/ResultsAndErrors.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.core.common; | ||
|
||
import java.util.Collection; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
/** | ||
* A record class encapsulate a collection of results and associated errors. An intended usage is to model the | ||
* generic MultiGetResponse to domain specific ones. The results are a collection of entity objects translated | ||
* from the documents retrieved by MultiGet and the errors are a map key by IDs and any exception encountered | ||
* when attempt retrieving associated documents. | ||
*/ | ||
public record ResultsAndErrors<T> (Collection<T> results, Map<String, Exception> errors) { | ||
|
||
private static final ResultsAndErrors<?> EMPTY = new ResultsAndErrors<>(List.of(), Map.of()); | ||
|
||
public boolean isEmpty() { | ||
return results.isEmpty() && errors.isEmpty(); | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
public static <T> ResultsAndErrors<T> empty() { | ||
return (ResultsAndErrors<T>) EMPTY; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 0 additions & 53 deletions
53
...src/main/java/org/elasticsearch/xpack/core/security/action/profile/GetProfileRequest.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.