Skip to content

Commit a689214

Browse files
authored
Merge PR #68 Static infra: delete / delete node
from feature/dss70-improve-public-API-api-deployer
2 parents 56859e6 + cc12875 commit a689214

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+
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+
api_nodes = list(self.settings["apiNodes"])
211+
for node in api_nodes:
212+
if node.get("url") == node_url:
213+
self.settings["apiNodes"].remove(node)
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)