Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions dataikuapi/dss/apideployer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import json
from .future import DSSFuture


class DSSAPIDeployer(object):
"""
Handle to interact with the API Deployer.
Expand All @@ -10,7 +11,7 @@ class DSSAPIDeployer(object):
def __init__(self, client):
self.client = client

def list_deployments(self, as_objects = True):
def list_deployments(self, as_objects=True):
Comment thread
AgatheG marked this conversation as resolved.
"""
Lists deployments on the API Deployer

Expand Down Expand Up @@ -55,7 +56,16 @@ def create_deployment(self, deployment_id, service_id, infra_id, version):
self.client._perform_json("POST", "/api-deployer/deployments", body=settings)
return self.get_deployment(deployment_id)

def list_infras(self, as_objects = True):
def list_stages(self):
"""
Lists infrastructure stages of the API Deployer

:rtype: a list of dict. Each dict contains a field "id" for the stage identifier and "desc" for its description.
:rtype: list
"""
return self.client._perform_json("GET", "/api-deployer/stages")

def list_infras(self, as_objects=True):
"""
Lists deployment infrastructures on the API Deployer

Expand Down Expand Up @@ -97,7 +107,7 @@ def get_infra(self, infra_id):
"""
return DSSAPIDeployerInfra(self.client, infra_id)

def list_services(self, as_objects = True):
def list_services(self, as_objects=True):
"""
Lists API services on the API Deployer

Expand Down Expand Up @@ -331,6 +341,7 @@ def save(self):
"PUT", "/api-deployer/deployments/%s/settings" % (self.deployment_id),
body = self.settings)


class DSSAPIDeployerDeploymentStatus(object):
"""The status of an API Deployer deployment.

Expand Down Expand Up @@ -386,7 +397,6 @@ def get_health_messages(self):
return self.heavy_status["healthMessages"]



###############################################
# Published Service
###############################################
Expand Down Expand Up @@ -439,6 +449,15 @@ def get_settings(self):

return DSSAPIDeployerServiceSettings(self.client, self.service_id, settings)

def delete(self):
"""
Deletes this service

You may only delete a service if it has no deployments on it anymore.
"""
return self.client._perform_empty(
"DELETE", "/api-deployer/services/%s" % (self.service_id))


class DSSAPIDeployerServiceSettings(object):
"""The settings of an API Deployer Service.
Expand All @@ -465,6 +484,7 @@ def save(self):
"PUT", "/api-deployer/services/%s/settings" % (self.service_id),
body = self.settings)


class DSSAPIDeployerServiceStatus(object):
"""The status of an API Deployer Service.

Expand Down
Loading