Skip to content

Commit 523e7ce

Browse files
Merge pull request #265 from dataiku/feature/dss110-sc-99387-missing-govern-node-type-in-fm-client-api
99387 : support creating a govern node
2 parents 9f8f716 + 169c499 commit 523e7ce

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

Diff for: dataikuapi/fm/instances.py

+14-8
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def __init__(
1515
self, client, label, instance_settings_template_id, virtual_network_id, image_id
1616
):
1717
"""
18-
Helper to create a DSS Instance
18+
Helper to create a DSS instance.
1919
2020
:param client: The FM client
2121
:type client: :class:`dataikuapi.fm.fmclient`
@@ -36,16 +36,17 @@ def __init__(
3636

3737
def with_dss_node_type(self, dss_node_type):
3838
"""
39-
Set the DSS Node type of the instance to create
39+
Set the DSS node type of the instance to create. The default node type is `DESIGN`.
4040
41-
:param str dss_node_type: Optional , the type of the dss node to create. Supports "design", "automation" or "deployer". Defaults to "design"
41+
:param dss_node_type: the type of the dss node to create.
42+
:type dss_node_type: :class:`dataikuapi.fm.instances.FMNodeType`
4243
:rtype: :class:`dataikuapi.fm.instances.FMInstanceCreator`
4344
"""
44-
if dss_node_type not in ["design", "automation", "deployer"]:
45-
raise ValueError(
46-
'Only "design", "automation" or "deployer" dss_node_type are supported'
47-
)
48-
self.data["dssNodeType"] = dss_node_type
45+
# backward compatibility, was a string before . be sure the value falls into the enum
46+
value = dss_node_type;
47+
if isinstance(dss_node_type, str):
48+
value = FMNodeType[dss_node_type.upper()]
49+
self.data["dssNodeType"] = value.value
4950
return self
5051

5152
def with_cloud_instance_type(self, cloud_instance_type):
@@ -399,6 +400,11 @@ def set_public_ip(self, enable, public_ip_id):
399400
self.instance_data["gcpPublicIPId"] = public_ip_id
400401
return self
401402

403+
class FMNodeType(Enum):
404+
DESIGN = "design"
405+
DEPLOYER = "deployer"
406+
AUTOMATION = "automation"
407+
GOVERN = "govern"
402408

403409
class FMInstanceEncryptionMode(Enum):
404410
NONE = "NONE"

Diff for: dataikuapi/fm/virtualnetworks.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def delete(self):
181181
return FMFuture.from_resp(self.client, future)
182182

183183
def set_fleet_management(
184-
self, enable, event_server=None, deployer_management="NO_MANAGED_DEPLOYER"
184+
self, enable, event_server=None, deployer_management="NO_MANAGED_DEPLOYER", govern_server=None
185185
):
186186
"""
187187
When enabled, all instances in this virtual network know each other and can centrally manage deployer and logs centralization
@@ -193,12 +193,14 @@ def set_fleet_management(
193193
- "NO_MANAGED_DEPLOYER": Do not manage the deployer. This is the default mode.
194194
- "CENTRAL_DEPLOYER": Central deployer. Recommended if you have more than one design node or may have more than one design node in the future.
195195
- "EACH_DESIGN_NODE": Deployer from design. Recommended if you have a single design node and want a simpler setup.
196+
:param str govern_server: Optional, node name of the node that should act as the centralized Govern server.
196197
197198
"""
198199

199200
self.vn_data["managedNodesDirectory"] = enable
200201
self.vn_data["eventServerNodeLabel"] = event_server
201202
self.vn_data["nodesDirectoryDeployerMode"] = deployer_management
203+
self.vn_data["governServerNodeLabel"] = govern_server
202204
return self
203205

204206
def set_https_strategy(self, https_strategy):

0 commit comments

Comments
 (0)