-
Notifications
You must be signed in to change notification settings - Fork 0
/
plugin.ts
86 lines (80 loc) · 2.54 KB
/
plugin.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
import { IndexManagementPluginSetup, IndexManagementPluginStart } from ".";
import { Plugin, CoreSetup, CoreStart, ILegacyCustomClusterClient } from "../../../src/core/server";
import ismPlugin from "./clusters/ism/ismPlugin";
import {
PolicyService,
ManagedIndexService,
IndexService,
RollupService,
TransformService,
DataStreamService,
NotificationService,
SnapshotManagementService,
CommonService,
AliasServices,
} from "./services";
import {
indices,
policies,
managedIndices,
rollups,
transforms,
notifications,
snapshotManagement,
common,
aliases,
} from "../server/routes";
import dataStreams from "./routes/dataStreams";
import { NodeServices } from "./models/interfaces";
export class IndexPatternManagementPlugin implements Plugin<IndexManagementPluginSetup, IndexManagementPluginStart> {
public async setup(core: CoreSetup) {
// create OpenSearch client that aware of ISM API endpoints
const osDriver: ILegacyCustomClusterClient = core.opensearch.legacy.createClient("index_management", {
plugins: [ismPlugin],
});
// Initialize services
const indexService = new IndexService(osDriver);
const dataStreamService = new DataStreamService(osDriver);
const policyService = new PolicyService(osDriver);
const managedIndexService = new ManagedIndexService(osDriver);
const rollupService = new RollupService(osDriver);
const transformService = new TransformService(osDriver);
const notificationService = new NotificationService(osDriver);
const snapshotManagementService = new SnapshotManagementService(osDriver);
const commonService = new CommonService(osDriver);
const aliasService = new AliasServices(osDriver);
const services: NodeServices = {
indexService,
dataStreamService,
policyService,
managedIndexService,
rollupService,
transformService,
notificationService,
snapshotManagementService,
commonService,
aliasService,
};
// create router
const router = core.http.createRouter();
// Add server routes
indices(services, router);
dataStreams(services, router);
policies(services, router);
managedIndices(services, router);
rollups(services, router);
transforms(services, router);
notifications(services, router);
snapshotManagement(services, router);
common(services, router);
aliases(services, router);
return {};
}
public async start(core: CoreStart) {
return {};
}
}