Skip to content

Commit

Permalink
Rename to getScopedCallCluster
Browse files Browse the repository at this point in the history
  • Loading branch information
mikecote committed Apr 24, 2020
1 parent b21d4bd commit d4d3bd8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions x-pack/plugins/actions/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,11 @@ export class ActionsPlugin implements Plugin<Promise<PluginSetupContract>, Plugi
return request => ({
callCluster: elasticsearch.legacy.client.asScoped(request).callAsCurrentUser,
savedObjectsClient: savedObjects.getScopedClient(request),
getScopedClusterClient(clusterClient: IClusterClient) {
getScopedCallCluster(clusterClient: IClusterClient) {
if (!(clusterClient instanceof ClusterClient)) {
throw new Error('given clusterClient is not an instance of ClusterClient');
}
return clusterClient.asScoped(request);
return clusterClient.asScoped(request).callAsCurrentUser;
},
});
}
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/actions/server/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export type SpaceIdToNamespaceFunction = (spaceId?: string) => string | undefine
export interface Services {
callCluster(path: string, opts: any): Promise<any>;
savedObjectsClient: SavedObjectsClientContract;
getScopedClusterClient(clusterClient: IClusterClient): IScopedClusterClient;
getScopedCallCluster(clusterClient: IClusterClient): IScopedClusterClient['callAsCurrentUser'];
}

declare module 'src/core/server' {
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/alerting/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,11 @@ export class AlertingPlugin {
return request => ({
callCluster: elasticsearch.legacy.client.asScoped(request).callAsCurrentUser,
savedObjectsClient: savedObjects.getScopedClient(request),
getScopedClusterClient(clusterClient: IClusterClient) {
getScopedCallCluster(clusterClient: IClusterClient) {
if (!(clusterClient instanceof ClusterClient)) {
throw new Error('given clusterClient is not an instance of ClusterClient');
}
return clusterClient.asScoped(request);
return clusterClient.asScoped(request).callAsCurrentUser;
},
});
}
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/alerting/server/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ declare module 'src/core/server' {
export interface Services {
callCluster(path: string, opts: any): Promise<any>;
savedObjectsClient: SavedObjectsClientContract;
getScopedClusterClient(clusterClient: IClusterClient): IScopedClusterClient;
getScopedCallCluster(clusterClient: IClusterClient): IScopedClusterClient['callAsCurrentUser'];
}

export interface AlertServices extends Services {
Expand Down

0 comments on commit d4d3bd8

Please sign in to comment.