Skip to content

Commit a4e34e4

Browse files
author
Agathe Guillemot
committed
Rename list_deployments --> get_deployments
Add DSSAPIDeployerServiceStatus#get_deployments
1 parent 7bb0584 commit a4e34e4

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

dataikuapi/dss/apideployer.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ def __init__(self, client, infra_id, light_status):
260260
self.infra_id = infra_id
261261
self.light_status = light_status
262262

263-
def list_deployments(self):
263+
def get_deployments(self):
264264
"""
265265
Returns the deployments that are deployed on this infrastructure
266266
@@ -559,6 +559,20 @@ def __init__(self, client, service_id, light_status):
559559
self.service_id = service_id
560560
self.light_status = light_status
561561

562+
def get_deployments(self, infra_id=None):
563+
"""
564+
Returns the deployments that have been created from this published project
565+
566+
:param str infra_id: Identifier of an infra, allows to only keep in the returned list the deployments on this infra.
567+
If not set, the list contains all the deployments using this published project, across every infra of the Project Deployer.
568+
569+
:returns: a list of deployments
570+
:rtype: list of :class:`dataikuapi.dss.apideployer.DSSAPIDeployerDeployment`
571+
"""
572+
if infra_id is None:
573+
return [DSSAPIDeployerDeployment(self.client, deployment["id"]) for deployment in self.light_status["deployments"]]
574+
return [DSSAPIDeployerDeployment(self.client, deployment["id"]) for deployment in self.light_status["deployments"] if infra_id == deployment["infraId"]]
575+
562576
def get_versions(self):
563577
"""
564578
Returns the versions of this service that have been published on the API Service

dataikuapi/dss/projectdeployer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ def __init__(self, client, infra_id, light_status):
262262
self.infra_id = infra_id
263263
self.light_status = light_status
264264

265-
def list_deployments(self):
265+
def get_deployments(self):
266266
"""
267267
Returns the deployments that are deployed on this infrastructure
268268
@@ -526,7 +526,7 @@ def __init__(self, client, project_key, light_status):
526526
self.project_key = project_key
527527
self.light_status = light_status
528528

529-
def list_deployments(self, infra_id=None):
529+
def get_deployments(self, infra_id=None):
530530
"""
531531
Returns the deployments that have been created from this published project
532532

0 commit comments

Comments
 (0)