Skip to content

Commit

Permalink
[Core] mark legacy ES client methods deprecated (#84358) (#84569)
Browse files Browse the repository at this point in the history
* mark context ES client & ES client methods deprecated

* update docs

* improve comment
  • Loading branch information
mshustov committed Nov 30, 2020
1 parent 4efd1d9 commit 9a6acb4
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

## LegacyClusterClient.callAsInternalUser property

> Warning: This API is now obsolete.
>
> Use [IClusterClient.asInternalUser](./kibana-plugin-core-server.iclusterclient.asinternaluser.md)<!-- -->.
>
Calls specified endpoint with provided clientParams on behalf of the Kibana internal user. See [LegacyAPICaller](./kibana-plugin-core-server.legacyapicaller.md)<!-- -->.

<b>Signature:</b>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

## LegacyScopedClusterClient.callAsCurrentUser() method

> Warning: This API is now obsolete.
>
> Use [IScopedClusterClient.asCurrentUser](./kibana-plugin-core-server.iscopedclusterclient.ascurrentuser.md)<!-- -->.
>
Calls specified `endpoint` with provided `clientParams` on behalf of the user initiated request to the Kibana server (via HTTP request headers). See [LegacyAPICaller](./kibana-plugin-core-server.legacyapicaller.md)<!-- -->.

<b>Signature:</b>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

## LegacyScopedClusterClient.callAsInternalUser() method

> Warning: This API is now obsolete.
>
> Use [IScopedClusterClient.asInternalUser](./kibana-plugin-core-server.iscopedclusterclient.asinternaluser.md)<!-- -->.
>
Calls specified `endpoint` with provided `clientParams` on behalf of the Kibana internal user. See [LegacyAPICaller](./kibana-plugin-core-server.legacyapicaller.md)<!-- -->.

<b>Signature:</b>
Expand Down
1 change: 1 addition & 0 deletions src/core/server/elasticsearch/legacy/cluster_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ export class LegacyClusterClient implements ILegacyClusterClient {
* Calls specified endpoint with provided clientParams on behalf of the
* Kibana internal user.
* See {@link LegacyAPICaller}.
* @deprecated Use {@link IClusterClient.asInternalUser}.
*
* @param endpoint - String descriptor of the endpoint e.g. `cluster.getSettings` or `ping`.
* @param clientParams - A dictionary of parameters that will be passed directly to the Elasticsearch JS client.
Expand Down
2 changes: 2 additions & 0 deletions src/core/server/elasticsearch/legacy/scoped_cluster_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export class LegacyScopedClusterClient implements ILegacyScopedClusterClient {
* Calls specified `endpoint` with provided `clientParams` on behalf of the
* Kibana internal user.
* See {@link LegacyAPICaller}.
* @deprecated Use {@link IScopedClusterClient.asInternalUser}.
*
* @param endpoint - String descriptor of the endpoint e.g. `cluster.getSettings` or `ping`.
* @param clientParams - A dictionary of parameters that will be passed directly to the Elasticsearch JS client.
Expand All @@ -73,6 +74,7 @@ export class LegacyScopedClusterClient implements ILegacyScopedClusterClient {
* Calls specified `endpoint` with provided `clientParams` on behalf of the
* user initiated request to the Kibana server (via HTTP request headers).
* See {@link LegacyAPICaller}.
* @deprecated Use {@link IScopedClusterClient.asCurrentUser}.
*
* @param endpoint - String descriptor of the endpoint e.g. `cluster.getSettings` or `ping`.
* @param clientParams - A dictionary of parameters that will be passed directly to the Elasticsearch JS client.
Expand Down
3 changes: 3 additions & 0 deletions src/core/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,9 @@ export interface RequestHandlerContext {
elasticsearch: {
client: IScopedClusterClient;
legacy: {
/*
* @deprecated Use {@link IScopedClusterClient}.
*/
client: ILegacyScopedClusterClient;
};
};
Expand Down
3 changes: 3 additions & 0 deletions src/core/server/server.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1324,6 +1324,7 @@ export interface LegacyCallAPIOptions {
export class LegacyClusterClient implements ILegacyClusterClient {
constructor(config: LegacyElasticsearchClientConfig, log: Logger, getAuthHeaders?: GetAuthHeaders);
asScoped(request?: ScopeableRequest): ILegacyScopedClusterClient;
// @deprecated
callAsInternalUser: LegacyAPICaller;
close(): void;
}
Expand Down Expand Up @@ -1371,7 +1372,9 @@ export interface LegacyRequest extends Request {
// @public @deprecated
export class LegacyScopedClusterClient implements ILegacyScopedClusterClient {
constructor(internalAPICaller: LegacyAPICaller, scopedAPICaller: LegacyAPICaller, headers?: Headers | undefined);
// @deprecated
callAsCurrentUser(endpoint: string, clientParams?: Record<string, any>, options?: LegacyCallAPIOptions): Promise<any>;
// @deprecated
callAsInternalUser(endpoint: string, clientParams?: Record<string, any>, options?: LegacyCallAPIOptions): Promise<any>;
}

Expand Down

0 comments on commit 9a6acb4

Please sign in to comment.