Skip to content

Commit d4e540a

Browse files
author
Agathe Guillemot
committed
Add methods to delete infra/node on infra
1 parent 56859e6 commit d4e540a

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

dataikuapi/dss/apideployer.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,15 @@ def get_settings(self):
166166

167167
return DSSAPIDeployerInfraSettings(self.client, self.infra_id, settings)
168168

169+
def delete(self):
170+
"""
171+
Deletes this infra
172+
You may only delete an infra if it has no deployments on it anymore.
173+
"""
174+
return self.client._perform_empty(
175+
"DELETE", "/api-deployer/infras/%s" % (self.infra_id))
176+
177+
169178
class DSSAPIDeployerInfraSettings(object):
170179
"""The settings of an API Deployer Infra.
171180
@@ -191,6 +200,18 @@ def add_apinode(self, url, api_key, graphite_prefix=None):
191200
}
192201
self.settings["apiNodes"].append(new_node)
193202

203+
def remove_apinode(self, node_url):
204+
"""
205+
Removes a node from the list of nodes of this infra.
206+
Only applicable to STATIC infrastructures
207+
208+
:param str node_url: URL of the node to remove
209+
"""
210+
for node in self.settings["apiNodes"]:
211+
if node["url"] == node_url:
212+
self.settings["apiNodes"].remove(node)
213+
break
214+
194215
def get_raw(self):
195216
"""
196217
Gets the raw settings of this infra. This returns a reference to the raw settings, not a copy,

0 commit comments

Comments
 (0)