/
HQApi.java
172 lines (156 loc) · 5.18 KB
/
HQApi.java
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
/*
*
* NOTE: This copyright does *not* cover user programs that use HQ
* program services by normal system calls through the application
* program interfaces provided as part of the Hyperic Plug-in Development
* Kit or the Hyperic Client Development Kit - this is merely considered
* normal use of the program, and does *not* fall under the heading of
* "derived work".
*
* Copyright (C) [2008, 2009], Hyperic, Inc.
* This file is part of HQ.
*
* HQ is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. This program is distributed
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
*/
package org.hyperic.hq.hqapi1;
/**
* The Hyperic HQ API.
*
* This is the main entry point into the HQ Api.
*/
public class HQApi {
private final UserApi _userApi;
private final RoleApi _roleApi;
private final MetricApi _metricApi;
private final GroupApi _groupApi;
private final EscalationApi _escalationApi;
private final AutodiscoveryApi _autodiscoveryApi;
private final ResourceApi _resourceApi;
private final AgentApi _agentApi;
private final AlertDefinitionApi _alertDefinitionApi;
private final MaintenanceApi _maintenanceApi;
private final ResourceEdgeApi _resourceEdgeApi;
/**
* @param host The hostname of the HQ Server to connect to.
* @param port The port on the HQ server to connect to.
* @param isSecure Set to true if connecting via SSL.
* @param user The user to connect as.
* @param password The password for the given user.
*/
public HQApi(String host, int port, boolean isSecure, String user,
String password) {
HQConnection connection = new HQConnection(host, port, isSecure,
user, password);
_userApi = new UserApi(connection);
_roleApi = new RoleApi(connection);
_groupApi = new GroupApi(connection);
_metricApi = new MetricApi(connection);
_escalationApi = new EscalationApi(connection);
_autodiscoveryApi = new AutodiscoveryApi(connection);
_resourceApi = new ResourceApi(connection);
_agentApi = new AgentApi(connection);
_alertDefinitionApi = new AlertDefinitionApi(connection);
_maintenanceApi = new MaintenanceApi(connection);
_resourceEdgeApi = new ResourceEdgeApi(connection);
}
/**
* Add, remove and update users.
*
* @return The API for operating on users.
*/
public UserApi getUserApi() {
return _userApi;
}
/**
* Add, remove and list resource and resource prototypes.
*
* @return The API for operating on resource and resource prototypes.
*/
public ResourceApi getResourceApi() {
return _resourceApi;
}
/**
* Add, remove and update roles.
*
* @return The API for operating on roles.
*/
public RoleApi getRoleApi() {
return _roleApi;
}
/**
* Add, remove and modify groups.
*
* @return The API for operating on groups.
*/
public GroupApi getGroupApi() {
return _groupApi;
}
/**
* Import, export measurement data and modify measurement schedules.
*
* @return The API for operating on measurement data and schedules.
*/
public MetricApi getMetricApi() {
return _metricApi;
}
/**
* Add, remove and assign escalations.
*
* @return The API for operating on esclations.
*/
public EscalationApi getEscalationApi() {
return _escalationApi;
}
/**
* List and approve auto-discovered resources.
*
* @return The API for operating on auto-discovered resources.
*/
public AutodiscoveryApi getAutodiscoveryApi() {
return _autodiscoveryApi;
}
/**
* Get and ping agents.
*
* @return The API for operating on agent resources.
*/
public AgentApi getAgentApi() {
return _agentApi;
}
/**
* Add, remove and list alert definitions.
*
* @return The API for operating on alert definitions.
*/
public AlertDefinitionApi getAlertDefinitionApi() {
return _alertDefinitionApi;
}
/**
* Schedule maintenance for groups in HQ.
*
* @return The API for operating on alert definitions.
*/
public MaintenanceApi getMaintenanceApi() {
return _maintenanceApi;
}
/**
* List and update the relationships between resources.
*
* @return The API for operating on resource relationships.
*/
public ResourceEdgeApi getResourceEdgeApi() {
return _resourceEdgeApi;
}
}