Skip to content

Commit db2d76d

Browse files
author
Agathe Guillemot
committed
Add a method to publish versions
1 parent fe66dfb commit db2d76d

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

dataikuapi/dss/apiservice.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,16 @@ def download_package_to_file(self, package_id, path):
106106
f.write(chunk)
107107
f.flush()
108108

109+
def publish_package(self, package_id, published_service_id):
110+
"""
111+
Publish a package on the API Deployer.
112+
113+
:param string package_id: The identifier of the package
114+
:param string published_service_id: The identifier of the API service on the API Deployer where the package will be published.
115+
A new published API service will be created if none matches the identifier.
116+
If the parameter is not set, the identifier from the current :class:`DSSAPIService` is used.
117+
"""
118+
params = None
119+
if published_service_id is not None:
120+
params = {"publishedProjectKey": published_service_id}
121+
return self.client._perform_json("POST", "/projects/%s/apiservices/%s/packages/%s/publish" % (self.project_key, self.service_id, package_id), params=params)

dataikuapi/dss/project.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1035,7 +1035,7 @@ def publish_bundle(self, bundle_id, published_project_key=None):
10351035
params = None
10361036
if published_project_key is not None:
10371037
params = {"publishedProjectKey": published_project_key}
1038-
return self.client._perform_json("GET", "/projects/%s/bundles/%s/publish" % (self.project_key, bundle_id), params=params)
1038+
return self.client._perform_json("POST", "/projects/%s/bundles/%s/publish" % (self.project_key, bundle_id), params=params)
10391039

10401040
########################################################
10411041
# Bundles / Import (Automation node)

0 commit comments

Comments
 (0)