@@ -99,24 +99,41 @@ def delete_cluster(self, cluster_id: str, force: bool = False):
9999
100100 def create_vw (self , cluster_id :str , dbc_id :str , vw_type :str , name :str , template :str = None ,
101101 autoscaling_min_cluster :int = None , autoscaling_max_cluster :int = None ,
102- service_config_req :str = None , tags :dict = None ):
103- if autoscaling_min_cluster == 0 and autoscaling_max_cluster == 0 :
104- autoscaling_options = None
105- elif autoscaling_min_cluster == 0 and autoscaling_max_cluster > 0 :
106- autoscaling_options = dict (maxClusters = autoscaling_max_cluster )
107- elif autoscaling_min_cluster > 0 and autoscaling_min_cluster == 0 :
108- autoscaling_options = dict (minClusters = autoscaling_max_cluster )
109- else :
110- autoscaling_options = dict (minClusters = autoscaling_max_cluster , maxClusters = autoscaling_max_cluster )
102+ common_configs :dict = None , application_configs :dict = None , ldap_groups :list = None ,
103+ enable_sso :bool = None , tags :dict = None ):
104+ # if autoscaling_min_cluster == 0 and autoscaling_max_cluster == 0:
105+ # autoscaling_options = None
106+ # elif autoscaling_min_cluster == 0 and autoscaling_max_cluster > 0:
107+ # autoscaling_options = dict(maxClusters=autoscaling_max_cluster)
108+ # elif autoscaling_min_cluster > 0 and autoscaling_min_cluster == 0:
109+ # autoscaling_options = dict(minClusters=autoscaling_max_cluster)
110+ # else:
111+ # autoscaling_options = dict(minClusters=autoscaling_max_cluster, maxClusters=autoscaling_max_cluster)
112+
113+ autoscaling = {}
114+ if autoscaling_min_cluster != 0 :
115+ autoscaling ['minClusters' ] = autoscaling_min_cluster
116+ if autoscaling_max_cluster != 0 :
117+ autoscaling ['maxClusters' ] = autoscaling_max_cluster
111118
112119 tag_list = []
113120 for key ,value in tags .items ():
114121 tag_list .append ({'key' : key , 'value' : value })
115122
123+ config = {}
124+ if not common_configs is None :
125+ config ['commonConfigs' ] = common_configs
126+ if not application_configs is None :
127+ config ['applicationConfigs' ] = application_configs
128+ if not ldap_groups is None :
129+ config ['ldapGroups' ] = ldap_groups
130+ if not enable_sso is None :
131+ config ['enableSSO' ] = enable_sso
132+
116133 return self .sdk .call (
117134 svc = 'dw' , func = 'create_vw' , ret_field = 'vwId' , clusterId = cluster_id , dbcId = dbc_id ,
118- vwType = vw_type , name = name , template = template , autoscaling = autoscaling_options ,
119- config = service_config_req , tags = tag_list
135+ vwType = vw_type , name = name , template = template , autoscaling = autoscaling ,
136+ config = config , tags = tag_list
120137 )
121138
122139 def create_dbc (self , cluster_id :str , name :str , load_demo_data : bool = None ):
0 commit comments