Skip to content

Commit ebce666

Browse files
authored
Add extra API parameters for CDW virtual warehouses (#86)
Signed-off-by: Jim Enright <[email protected]>
1 parent c97d43a commit ebce666

File tree

1 file changed

+40
-7
lines changed

1 file changed

+40
-7
lines changed

src/cdpy/dw.py

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -189,15 +189,34 @@ def update_data_visualization(self, cluster_id: str, data_viz_id: str, config: d
189189

190190
def create_vw(self, cluster_id: str, dbc_id: str, vw_type: str, name: str, template: str = None,
191191
autoscaling_min_cluster: int = None, autoscaling_max_cluster: int = None,
192-
common_configs: dict = None, application_configs: dict = None, ldap_groups: list = None,
193-
enable_sso: bool = None, tags: dict = None):
192+
autoscaling_auto_suspend_timeout_seconds: int = None, autoscaling_disable_auto_suspend: bool = None,
193+
autoscaling_hive_desired_free_capacity: int = None, autoscaling_hive_scale_wait_time_seconds: int = None,
194+
autoscaling_impala_scale_down_delay_seconds: int = None, autoscaling_impala_scale_up_delay_seconds: int = None,
195+
autoscaling_pod_config_name: str = None, common_configs: dict = None, application_configs: dict = None,
196+
ldap_groups: list = None, enable_sso: bool = None, tags: dict = None,
197+
enable_unified_analytics: bool = None, enable_platform_jwt_auth: bool = None,
198+
impala_ha_enable_catalog_high_availability: bool = None, impala_ha_enable_shutdown_of_coordinator: bool = None,
199+
impala_ha_high_availability_mode: str = None, impala_ha_num_of_active_coordinators: int = None,
200+
impala_ha_shutdown_of_coordinator_delay_seconds: int = None
201+
):
194202

195-
if any(x is not None for x in [autoscaling_min_cluster, autoscaling_max_cluster]):
196-
autoscaling = {}
203+
if any(x is not None for x in [autoscaling_min_cluster, autoscaling_max_cluster, autoscaling_auto_suspend_timeout_seconds,
204+
autoscaling_disable_auto_suspend,
205+
autoscaling_hive_desired_free_capacity,
206+
autoscaling_hive_scale_wait_time_seconds,
207+
autoscaling_impala_scale_down_delay_seconds,
208+
autoscaling_impala_scale_up_delay_seconds,
209+
autoscaling_pod_config_name]):
210+
autoscaling_all = dict(autoSuspendTimeoutSeconds=autoscaling_auto_suspend_timeout_seconds, disableAutoSuspend=autoscaling_disable_auto_suspend, hiveDesiredFreeCapacity=autoscaling_hive_desired_free_capacity,
211+
hiveScaleWaitTimeSeconds=autoscaling_hive_scale_wait_time_seconds, impalaScaleDownDelaySeconds=autoscaling_impala_scale_down_delay_seconds, impalaScaleUpDelaySeconds=autoscaling_impala_scale_up_delay_seconds, podConfigName=autoscaling_pod_config_name)
197212
if autoscaling_min_cluster is not None and autoscaling_min_cluster != 0:
198-
autoscaling['minClusters'] = autoscaling_min_cluster
213+
autoscaling_all['minClusters'] = autoscaling_min_cluster
199214
if autoscaling_max_cluster is not None and autoscaling_max_cluster != 0:
200-
autoscaling['maxClusters'] = autoscaling_max_cluster
215+
autoscaling_all['maxClusters'] = autoscaling_max_cluster
216+
217+
autoscaling = {k: v for k,
218+
v in autoscaling_all.items() if v is not None}
219+
201220
else:
202221
autoscaling = None
203222

@@ -221,10 +240,24 @@ def create_vw(self, cluster_id: str, dbc_id: str, vw_type: str, name: str, templ
221240
else:
222241
config = None
223242

243+
if any(x is not None for x in [impala_ha_enable_catalog_high_availability, impala_ha_enable_shutdown_of_coordinator, impala_ha_high_availability_mode, impala_ha_num_of_active_coordinators, impala_ha_shutdown_of_coordinator_delay_seconds]):
244+
245+
impala_ha_settings_all = dict(enableCatalogHighAvailability=impala_ha_enable_catalog_high_availability, enableShutdownOfCoordinator=impala_ha_enable_shutdown_of_coordinator,
246+
highAvailabilityMode=impala_ha_high_availability_mode, numOfActiveCoordinators=impala_ha_num_of_active_coordinators,
247+
shutdownOfCoordinatorDelaySeconds=impala_ha_shutdown_of_coordinator_delay_seconds)
248+
249+
impala_ha_settings = {k: v for k,
250+
v in impala_ha_settings_all.items() if v is not None}
251+
252+
else:
253+
impala_ha_settings = None
254+
224255
return self.sdk.call(
225256
svc='dw', func='create_vw', ret_field='vwId', clusterId=cluster_id, dbcId=dbc_id,
226257
vwType=vw_type, name=name, template=template, autoscaling=autoscaling, config=config,
227-
tags=tag_list, squelch=[
258+
tags=tag_list, enableUnifiedAnalytics=enable_unified_analytics,
259+
platformJwtAuth=enable_platform_jwt_auth, impalaHaSettings=impala_ha_settings,
260+
squelch=[
228261
Squelch(value='PATH_DISABLED', warning=ENTITLEMENT_DISABLED)
229262
]
230263
)

0 commit comments

Comments
 (0)