Skip to content

Commit c0b15cb

Browse files
committed
API Deployer: Add create_service method
1 parent fd20458 commit c0b15cb

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

dataikuapi/dss/apideployer.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,26 @@ def get_deployment(self, deployment_id):
3434
"""
3535
return DSSAPIDeployerDeployment(self.client, deployment_id)
3636

37+
def create_deployment(self, deployment_id, service_id, infra_id, version):
38+
"""
39+
Creates a deployment and returns the handle to interact with it. The returned deployment
40+
is not yet started and you need to call :meth:`~DSSAPIDeployerDeployment.update`
41+
42+
:param str deployment_id: Identifier of the deployment to create
43+
:param str service_id: Identifier of the API Service to target
44+
:param str infra_id: Identifier of the deployment infrastructure to use
45+
:param str version_id: Identifier of the API Service version to deploy
46+
:rtype: :class:`DSSAPIDeployerDeployment`
47+
"""
48+
settings = {
49+
"deploymentId" : deployment_id,
50+
"publishedServiceId" : service_id,
51+
"infraId" : infra_id,
52+
"version" : version
53+
}
54+
self.client._perform_json("POST", "/api-deployer/deployments", body=settings)
55+
return self.get_deployment(deployment_id)
56+
3757
def list_infras(self, as_objects = True):
3858
"""
3959
Lists deployment infrastructures on the API Deployer
@@ -205,7 +225,7 @@ def get_settings(self):
205225

206226
return DSSAPIDeployerDeploymentSettings(self.client, self.deployment_id, settings)
207227

208-
def update(self):
228+
def start_update(self):
209229
"""
210230
Updates this deployment to try to match the actual state to the current settings
211231

0 commit comments

Comments
 (0)