use of co.cask.cdap.proto.PluginInstanceDetail in project cdap by caskdata.
the class ApplicationLifecycleService method getPlugins.
/**
* Get detail about the plugin in the specified application
*
* @param appId the id of the application
* @return list of plugins in the application
* @throws ApplicationNotFoundException if the specified application does not exist
*/
public List<PluginInstanceDetail> getPlugins(ApplicationId appId) throws ApplicationNotFoundException {
ApplicationSpecification appSpec = store.getApplication(appId);
if (appSpec == null) {
throw new ApplicationNotFoundException(appId);
}
List<PluginInstanceDetail> pluginInstanceDetails = new ArrayList<>();
for (Map.Entry<String, Plugin> entry : appSpec.getPlugins().entrySet()) {
pluginInstanceDetails.add(new PluginInstanceDetail(entry.getKey(), entry.getValue()));
}
return pluginInstanceDetails;
}
use of co.cask.cdap.proto.PluginInstanceDetail in project cdap by caskdata.
the class AppFabricClient method getPlugins.
public List<PluginInstanceDetail> getPlugins(ApplicationId application) throws Exception {
HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, String.format("%s/apps/%s", getNamespacePath(application.getNamespace()), application.getApplication()));
request.headers().set(Constants.Gateway.API_KEY, "api-key-example");
MockResponder mockResponder = new MockResponder();
appLifecycleHttpHandler.getPluginsInfo(request, mockResponder, application.getNamespace(), application.getApplication());
verifyResponse(HttpResponseStatus.OK, mockResponder.getStatus(), "Getting app info failed");
return mockResponder.decodeResponseContent(new TypeToken<List<PluginInstanceDetail>>() {
}.getType(), GSON);
}
Aggregations