in src/main/java/org/apache/openwhisk/intellij/common/whisk/service/WhiskPackageService.java [79:100]
public Optional<WhiskPackageWithActions> deleteWhiskPackage(WhiskAuth whiskAuth, String name) throws IOException {
String endpoint = whiskAuth.getApihost() + "/api/v1/namespaces/_/packages/" + name;
String authorization = whiskAuth.getBasicAuthHeader();
HttpResponse response = Request.Delete(endpoint)
.setHeader(HttpHeaders.AUTHORIZATION, authorization)
.execute()
.returnResponse();
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_CONFLICT) {
return Optional.empty();
} else {
BufferedReader reader = new BufferedReader(new InputStreamReader(
response.getEntity().getContent()));
String inputLine;
StringBuffer result = new StringBuffer();
while ((inputLine = reader.readLine()) != null) {
result.append(inputLine);
}
reader.close();
return JsonParserUtils.parseWhiskPackage(result.toString());
}
}