Skip to content

Commit

Permalink
Implement delete and remove legacy applicationDeployment publisher
Browse files Browse the repository at this point in the history
Change-Id: Iaa033666d46579cba00ced0969b08eaae090820d
  • Loading branch information
gsavvas-exz committed Mar 20, 2024
1 parent 163a11c commit 3b1077c
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ class ConfigureEXNConnector {
new Publisher("cluster.get","cluster.get.reply",true,false),
new Publisher("cluster.define","cluster.define.reply",true,false),
new Publisher("cluster.deploy","cluster.deploy.reply",true,false),
new Publisher("cluster.deployApplication","cluster.deployApplication.reply",true,false),
new Publisher("cluster.scaleout","cluster.scaleout.reply",true,false),
new Publisher("cluster.scalein","cluster.scalein.reply",true,false),
new Publisher("cluster.label","cluster.label.reply",true,false),
new Publisher("cluster.deployapplication","cluster.deployapplication.reply",true,false)
new Publisher("cluster.deployapplication","cluster.deployapplication.reply",true,false),
new Publisher("cluster.delete","cluster.delete.reply",true,false)
],
[
new Consumer("cloud","cloud.>", amqpSalMessageHandler,true,false),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,23 @@ class ClusterProcessor extends AbstractProcessor{

}

@Override
Map delete(Map metaData, String o) {

logger.info('{} - Deleting cluster {}',metaData.user, metaData.cluster)

String sessionId = gatewayRepository.login(salConfiguration.username,salConfiguration.password)

HttpHeaders headers = new HttpHeaders()
headers.add('sessionid',sessionId)

def response = clusterRepository.deleteById(metaData.clusterName as String,headers,Object.class)

return [
"status": HttpStatus.OK.value(),
"body": response
]

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -145,5 +145,9 @@ abstract class AbstractSalRepository{
return delete(url,body,headers,responseType)
}

def deleteById(String id, HttpHeaders headers, Class responseType){
return delete(id,null,headers,responseType)
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ class ClusterRepository extends AbstractSalRepository{
super('cluster')
}

private final Map<String,String> SCALE_ACTION_MAPPING = [
'scaleout' : 'out',
'scalein' : 'in'
]

def postAction(String body, Map metaData, HttpHeaders headers, Class responseType){

switch (metaData.action){
Expand All @@ -35,7 +30,7 @@ class ClusterRepository extends AbstractSalRepository{
default:
return [
"status": HttpStatus.NOT_IMPLEMENTED.value(),
"body": ["key":"action-not-support","message":"Action type "+ action +" is not supported"]
"body": ["key":"action-not-support","message":"Action type "+ metaData.action +" is not supported"]
]
}
}
Expand Down

0 comments on commit 3b1077c

Please sign in to comment.