@@ -36,7 +36,7 @@ def get_deployment(self, deployment_id):
3636 return DSSProjectDeployerDeployment (self .client , deployment_id )
3737
3838 def create_deployment (self , deployment_id , project_key , infra_id , bundle_id ,
39- deployed_project_key = None , project_folder_id = None ):
39+ deployed_project_key = None , project_folder_id = None , ignore_warnings = False ):
4040 """
4141 Creates a deployment and returns the handle to interact with it. The returned deployment
4242 is not yet started and you need to call :meth:`~DSSProjectDeployerDeployment.start_update`
@@ -50,6 +50,7 @@ def create_deployment(self, deployment_id, project_key, infra_id, bundle_id,
5050 published project
5151 :param str project_folder_id: The automation node project folder id to deploy this project into. If not set,
5252 the project will be created in the root folder
53+ :param boolean ignore_warnings: ignore warnings concerning the governance status of the bundle to deploy
5354 :rtype: :class:`DSSProjectDeployerDeployment`
5455 """
5556 settings = {
@@ -62,7 +63,7 @@ def create_deployment(self, deployment_id, project_key, infra_id, bundle_id,
6263 settings ["deployedProjectKey" ] = deployed_project_key
6364 if project_folder_id :
6465 settings ["projectFolderId" ] = project_folder_id
65- self .client ._perform_json ("POST" , "/project-deployer/deployments" , body = settings )
66+ self .client ._perform_json ("POST" , "/project-deployer/deployments" , params = { "ignoreWarnings" : ignore_warnings }, body = settings )
6667 return self .get_deployment (deployment_id )
6768
6869 def list_stages (self ):
@@ -90,17 +91,19 @@ def list_infras(self, as_objects=True):
9091 else :
9192 return l
9293
93- def create_infra (self , infra_id , stage ):
94+ def create_infra (self , infra_id , stage , govern_check_policy = "NO_CHECK" ):
9495 """
9596 Creates a new infrastructure on the Project Deployer and returns the handle to interact with it.
9697
9798 :param str infra_id: Unique Identifier of the infra to create
9899 :param str stage: Infrastructure stage
100+ :param str govern_check_policy: PREVENT, WARN, or NO_CHECK depending if the deployer will check wether the bundle deployed on this infrastructure has to be managed and approved in Dataiku Govern
99101 :rtype: :class:`DSSProjectDeployerInfra`
100102 """
101103 settings = {
102104 "id" : infra_id ,
103- "stage" : stage
105+ "stage" : stage ,
106+ "govern_check_policy" : govern_check_policy ,
104107 }
105108 self .client ._perform_json ("POST" , "/project-deployer/infras" , body = settings )
106109 return self .get_infra (infra_id )
@@ -309,6 +312,14 @@ def get_status(self):
309312
310313 return DSSProjectDeployerDeploymentStatus (self .client , self .deployment_id , light , heavy )
311314
315+ def get_governance_status (self ):
316+ """
317+ Returns the governance status about this deployment if applicable
318+
319+ :rtype: dict InforMessages containing the governance status
320+ """
321+ return self .client ._perform_json ("GET" , "/project-deployer/deployments/%s/governance-status" % (self .deployment_id ))
322+
312323 def get_settings (self ):
313324 """
314325 Gets the settings of this deployment. If you want to modify the settings, you need to
@@ -377,12 +388,15 @@ def bundle_id(self):
377388 def bundle_id (self , new_bundle_id ):
378389 self .settings ["bundleId" ] = new_bundle_id
379390
380- def save (self ):
391+ def save (self , ignore_warnings = False ):
381392 """
382393 Saves back these settings to the deployment
394+
395+ :param boolean ignore_warnings: ignore warnings concerning the governance status of the bundle to deploy
383396 """
384397 self .client ._perform_empty (
385398 "PUT" , "/project-deployer/deployments/%s/settings" % (self .deployment_id ),
399+ params = { "ignoreWarnings" : ignore_warnings },
386400 body = self .settings )
387401
388402
0 commit comments