From a37a69027b11e6726ed76e6bbd7d963cfb2e8066 Mon Sep 17 00:00:00 2001 From: Saravanan Raju Date: Wed, 23 Jun 2021 16:50:58 +0530 Subject: [PATCH 01/19] Expose use private load balancer while creating dw datacatalog Signed-off-by: Saravanan Raju --- src/cdpy/dw.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cdpy/dw.py b/src/cdpy/dw.py index f6a660f..496b007 100644 --- a/src/cdpy/dw.py +++ b/src/cdpy/dw.py @@ -75,7 +75,8 @@ def gather_clusters(self, env_crn=None): return out def create_cluster(self, env_crn: str, overlay: bool, aws_public_subnets: list = None, - aws_private_subnets: list = None, az_subnet: str = None, az_enable_az: bool = None): + aws_private_subnets: list = None, az_subnet: str = None, az_enable_az: bool = None, + use_private_load_balancer: bool = None): self.sdk.validate_crn(env_crn) if all(x is not None for x in [aws_private_subnets, aws_private_subnets]): aws_options = dict(publicSubnetIds=aws_public_subnets, privateSubnetIds=aws_private_subnets) @@ -87,7 +88,8 @@ def create_cluster(self, env_crn: str, overlay: bool, aws_public_subnets: list = azure_options = None return self.sdk.call( svc='dw', func='create_cluster', ret_field='clusterId', environmentCrn=env_crn, - useOverlayNetwork=overlay, awsOptions=aws_options, azureOptions=azure_options + useOverlayNetwork=overlay, awsOptions=aws_options, azureOptions=azure_options, + usePrivateLoadBalancer=use_private_load_balancer ) def delete_cluster(self, cluster_id: str, force: bool = False): From 4018ca6a41013bc7212bacfb585ec9d1fa3f7077 Mon Sep 17 00:00:00 2001 From: Saravanan Raju Date: Wed, 23 Jun 2021 19:17:39 +0530 Subject: [PATCH 02/19] Refactor exposed parameter Signed-off-by: Saravanan Raju --- src/cdpy/dw.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cdpy/dw.py b/src/cdpy/dw.py index 496b007..f36bdfb 100644 --- a/src/cdpy/dw.py +++ b/src/cdpy/dw.py @@ -88,8 +88,8 @@ def create_cluster(self, env_crn: str, overlay: bool, aws_public_subnets: list = azure_options = None return self.sdk.call( svc='dw', func='create_cluster', ret_field='clusterId', environmentCrn=env_crn, - useOverlayNetwork=overlay, awsOptions=aws_options, azureOptions=azure_options, - usePrivateLoadBalancer=use_private_load_balancer + useOverlayNetwork=overlay, usePrivateLoadBalancer=use_private_load_balancer, + awsOptions=aws_options, azureOptions=azure_options ) def delete_cluster(self, cluster_id: str, force: bool = False): From b6c26ff49de8506fa9f940ae763900329c778899 Mon Sep 17 00:00:00 2001 From: Saravanan Raju Date: Wed, 23 Jun 2021 19:41:37 +0530 Subject: [PATCH 03/19] Fix typo Signed-off-by: Saravanan Raju --- src/cdpy/dw.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cdpy/dw.py b/src/cdpy/dw.py index f36bdfb..77e2aa3 100644 --- a/src/cdpy/dw.py +++ b/src/cdpy/dw.py @@ -76,7 +76,7 @@ def gather_clusters(self, env_crn=None): def create_cluster(self, env_crn: str, overlay: bool, aws_public_subnets: list = None, aws_private_subnets: list = None, az_subnet: str = None, az_enable_az: bool = None, - use_private_load_balancer: bool = None): + private_load_balancer: bool = None): self.sdk.validate_crn(env_crn) if all(x is not None for x in [aws_private_subnets, aws_private_subnets]): aws_options = dict(publicSubnetIds=aws_public_subnets, privateSubnetIds=aws_private_subnets) @@ -88,7 +88,7 @@ def create_cluster(self, env_crn: str, overlay: bool, aws_public_subnets: list = azure_options = None return self.sdk.call( svc='dw', func='create_cluster', ret_field='clusterId', environmentCrn=env_crn, - useOverlayNetwork=overlay, usePrivateLoadBalancer=use_private_load_balancer, + useOverlayNetwork=overlay, usePrivateLoadBalancer=private_load_balancer, awsOptions=aws_options, azureOptions=azure_options ) From 2bb42420741a1510f939a12ac3d0a0cc27653890 Mon Sep 17 00:00:00 2001 From: Saravanan Raju Date: Tue, 6 Jul 2021 13:57:43 +0530 Subject: [PATCH 04/19] Plugin cdw create virtual warehouse function Signed-off-by: Saravanan Raju --- src/cdpy/dw.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/cdpy/dw.py b/src/cdpy/dw.py index 77e2aa3..c00f8d7 100644 --- a/src/cdpy/dw.py +++ b/src/cdpy/dw.py @@ -96,3 +96,17 @@ def delete_cluster(self, cluster_id: str, force: bool = False): return self.sdk.call( svc='dw', func='delete_cluster', squelch=[Squelch('NOT_FOUND')], clusterId=cluster_id, force=force ) + + def create_vw(self, cluster_id:str, dbc_id:str, vw_type:str, name:str, template:str = None, + autoscaling_min_cluster:int = None, autoscaling_max_cluster:int = None, + service_config_req:str = None, tags:str = None): + if all(x is not None for x in [autoscaling_min_cluster, autoscaling_max_cluster]): + autoscaling_options = dict(minClusters=autoscaling_min_cluster, maxClusters=autoscaling_max_cluster) + else: + autoscaling_options = None + return self.sdk.call( + svc='dw', func='create_vw', ret_field='vwId', clusterId=cluster_id, dbcId=dbc_id, + vwType=vw_type, name=name, template=template, autoscaling=autoscaling_options, + config=service_config_req, tags=tags + ) + From a5b8d9515f291b866b53b6fc1592e482506b6854 Mon Sep 17 00:00:00 2001 From: Saravanan Raju Date: Thu, 8 Jul 2021 11:49:17 +0530 Subject: [PATCH 05/19] Change tags type to dict Signed-off-by: Saravanan Raju --- src/cdpy/dw.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cdpy/dw.py b/src/cdpy/dw.py index c00f8d7..4925a59 100644 --- a/src/cdpy/dw.py +++ b/src/cdpy/dw.py @@ -99,7 +99,7 @@ def delete_cluster(self, cluster_id: str, force: bool = False): def create_vw(self, cluster_id:str, dbc_id:str, vw_type:str, name:str, template:str = None, autoscaling_min_cluster:int = None, autoscaling_max_cluster:int = None, - service_config_req:str = None, tags:str = None): + service_config_req:str = None, tags:dict = None): if all(x is not None for x in [autoscaling_min_cluster, autoscaling_max_cluster]): autoscaling_options = dict(minClusters=autoscaling_min_cluster, maxClusters=autoscaling_max_cluster) else: From 7fe9f1d8fd9e27781834b14379b0ecd1672728ad Mon Sep 17 00:00:00 2001 From: Saravanan Raju Date: Thu, 8 Jul 2021 12:09:56 +0530 Subject: [PATCH 06/19] Revert tags dict type to list Signed-off-by: Saravanan Raju --- src/cdpy/dw.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cdpy/dw.py b/src/cdpy/dw.py index 4925a59..99be06c 100644 --- a/src/cdpy/dw.py +++ b/src/cdpy/dw.py @@ -99,7 +99,7 @@ def delete_cluster(self, cluster_id: str, force: bool = False): def create_vw(self, cluster_id:str, dbc_id:str, vw_type:str, name:str, template:str = None, autoscaling_min_cluster:int = None, autoscaling_max_cluster:int = None, - service_config_req:str = None, tags:dict = None): + service_config_req:str = None, tags:list = None): if all(x is not None for x in [autoscaling_min_cluster, autoscaling_max_cluster]): autoscaling_options = dict(minClusters=autoscaling_min_cluster, maxClusters=autoscaling_max_cluster) else: From 715c425ae45f62adf907f8d8b62a5f2d0c40f195 Mon Sep 17 00:00:00 2001 From: Saravanan Raju Date: Sun, 11 Jul 2021 11:18:44 +0530 Subject: [PATCH 07/19] Add create dbc code Signed-off-by: Saravanan Raju --- src/cdpy/dw.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cdpy/dw.py b/src/cdpy/dw.py index 99be06c..674cb9c 100644 --- a/src/cdpy/dw.py +++ b/src/cdpy/dw.py @@ -110,3 +110,7 @@ def create_vw(self, cluster_id:str, dbc_id:str, vw_type:str, name:str, template: config=service_config_req, tags=tags ) + def create_dbc(self, cluster_id:str, name:str, load_demo_data: bool = None): + return self.sdk.call( + svc='dw', func='create_dbc', clusterId = cluster_id, name=name, loadDemoData = load_demo_data + ) From c0cccdb71571617076ff7f8106b71f0d2f42d99c Mon Sep 17 00:00:00 2001 From: Saravanan Raju Date: Mon, 12 Jul 2021 01:10:56 +0530 Subject: [PATCH 08/19] Convert tags from dict to list Signed-off-by: Saravanan Raju --- src/cdpy/dw.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/cdpy/dw.py b/src/cdpy/dw.py index 674cb9c..6d43528 100644 --- a/src/cdpy/dw.py +++ b/src/cdpy/dw.py @@ -99,15 +99,20 @@ def delete_cluster(self, cluster_id: str, force: bool = False): def create_vw(self, cluster_id:str, dbc_id:str, vw_type:str, name:str, template:str = None, autoscaling_min_cluster:int = None, autoscaling_max_cluster:int = None, - service_config_req:str = None, tags:list = None): + service_config_req:str = None, tags:dict = None): if all(x is not None for x in [autoscaling_min_cluster, autoscaling_max_cluster]): autoscaling_options = dict(minClusters=autoscaling_min_cluster, maxClusters=autoscaling_max_cluster) else: autoscaling_options = None + + tag_list = [] + for item in tags: + tag_list = tag_list.append({'key': item.key, 'value': item.value}) + return self.sdk.call( svc='dw', func='create_vw', ret_field='vwId', clusterId=cluster_id, dbcId=dbc_id, vwType=vw_type, name=name, template=template, autoscaling=autoscaling_options, - config=service_config_req, tags=tags + config=service_config_req, tags=tag_list ) def create_dbc(self, cluster_id:str, name:str, load_demo_data: bool = None): From 1376a76f15ac95135164b3e1c26fb9457e155936 Mon Sep 17 00:00:00 2001 From: Saravanan Raju Date: Mon, 12 Jul 2021 01:35:27 +0530 Subject: [PATCH 09/19] Fix syntax error Signed-off-by: Saravanan Raju --- src/cdpy/dw.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cdpy/dw.py b/src/cdpy/dw.py index 6d43528..1116c79 100644 --- a/src/cdpy/dw.py +++ b/src/cdpy/dw.py @@ -107,7 +107,7 @@ def create_vw(self, cluster_id:str, dbc_id:str, vw_type:str, name:str, template: tag_list = [] for item in tags: - tag_list = tag_list.append({'key': item.key, 'value': item.value}) + tag_list.append({'key': item.key, 'value': item.value}) return self.sdk.call( svc='dw', func='create_vw', ret_field='vwId', clusterId=cluster_id, dbcId=dbc_id, From 4a60693d07fcabc37bdde54d2ac0a39ebb651e7d Mon Sep 17 00:00:00 2001 From: Saravanan Raju Date: Mon, 12 Jul 2021 01:38:53 +0530 Subject: [PATCH 10/19] Fix tag list building logic Signed-off-by: Saravanan Raju --- src/cdpy/dw.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cdpy/dw.py b/src/cdpy/dw.py index 1116c79..ddc7676 100644 --- a/src/cdpy/dw.py +++ b/src/cdpy/dw.py @@ -106,8 +106,8 @@ def create_vw(self, cluster_id:str, dbc_id:str, vw_type:str, name:str, template: autoscaling_options = None tag_list = [] - for item in tags: - tag_list.append({'key': item.key, 'value': item.value}) + for key,value in tags.items(): + tag_list.append({'key': key, 'value': value}) return self.sdk.call( svc='dw', func='create_vw', ret_field='vwId', clusterId=cluster_id, dbcId=dbc_id, From d793638dfd21d1d30151c761179bed6fcd867104 Mon Sep 17 00:00:00 2001 From: Saravanan Raju Date: Mon, 12 Jul 2021 01:51:23 +0530 Subject: [PATCH 11/19] handle 0 values Signed-off-by: Saravanan Raju --- src/cdpy/dw.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/cdpy/dw.py b/src/cdpy/dw.py index ddc7676..88ec5cb 100644 --- a/src/cdpy/dw.py +++ b/src/cdpy/dw.py @@ -100,10 +100,11 @@ def delete_cluster(self, cluster_id: str, force: bool = False): def create_vw(self, cluster_id:str, dbc_id:str, vw_type:str, name:str, template:str = None, autoscaling_min_cluster:int = None, autoscaling_max_cluster:int = None, service_config_req:str = None, tags:dict = None): - if all(x is not None for x in [autoscaling_min_cluster, autoscaling_max_cluster]): - autoscaling_options = dict(minClusters=autoscaling_min_cluster, maxClusters=autoscaling_max_cluster) - else: + if all(x is None for x in [autoscaling_min_cluster, autoscaling_max_cluster]): autoscaling_options = None + else: + autoscaling_options = dict(minClusters=None if autoscaling_min_cluster == 0 else autoscaling_min_cluster, + maxClusters=None if autoscaling_max_cluster == 0 else autoscaling_max_cluster) tag_list = [] for key,value in tags.items(): From b4c782b41d779414a25a4585ed22a7dc814ec364 Mon Sep 17 00:00:00 2001 From: Saravanan Raju Date: Mon, 12 Jul 2021 02:03:16 +0530 Subject: [PATCH 12/19] Redefine autoscale options Signed-off-by: Saravanan Raju --- src/cdpy/dw.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/cdpy/dw.py b/src/cdpy/dw.py index 88ec5cb..e2e8902 100644 --- a/src/cdpy/dw.py +++ b/src/cdpy/dw.py @@ -100,11 +100,14 @@ def delete_cluster(self, cluster_id: str, force: bool = False): def create_vw(self, cluster_id:str, dbc_id:str, vw_type:str, name:str, template:str = None, autoscaling_min_cluster:int = None, autoscaling_max_cluster:int = None, service_config_req:str = None, tags:dict = None): - if all(x is None for x in [autoscaling_min_cluster, autoscaling_max_cluster]): + if autoscaling_min_cluster == 0 and autoscaling_max_cluster == 0: autoscaling_options = None - else: - autoscaling_options = dict(minClusters=None if autoscaling_min_cluster == 0 else autoscaling_min_cluster, - maxClusters=None if autoscaling_max_cluster == 0 else autoscaling_max_cluster) + elif autoscaling_min_cluster == 0 and autoscaling_max_cluster > 0: + autoscaling_options = dict(maxClusters=autoscaling_max_cluster) + elif autoscaling_min_cluster > 0 and autoscaling_min_cluster == 0: + autoscaling_options = dict(minClusters=autoscaling_max_cluster) + else + autoscaling_options = dict(minClusters=autoscaling_max_cluster, maxClusters=autoscaling_max_cluster) tag_list = [] for key,value in tags.items(): From beff222d9fe2605cb89d192d265336ae110b4c18 Mon Sep 17 00:00:00 2001 From: Saravanan Raju Date: Mon, 12 Jul 2021 02:05:13 +0530 Subject: [PATCH 13/19] Fix typo Signed-off-by: Saravanan Raju --- src/cdpy/dw.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cdpy/dw.py b/src/cdpy/dw.py index e2e8902..354bb43 100644 --- a/src/cdpy/dw.py +++ b/src/cdpy/dw.py @@ -106,7 +106,7 @@ def create_vw(self, cluster_id:str, dbc_id:str, vw_type:str, name:str, template: autoscaling_options = dict(maxClusters=autoscaling_max_cluster) elif autoscaling_min_cluster > 0 and autoscaling_min_cluster == 0: autoscaling_options = dict(minClusters=autoscaling_max_cluster) - else + else: autoscaling_options = dict(minClusters=autoscaling_max_cluster, maxClusters=autoscaling_max_cluster) tag_list = [] From 549df6acf6e9c3b008a8c0d183072933aa0a7245 Mon Sep 17 00:00:00 2001 From: Saravanan Raju Date: Mon, 12 Jul 2021 10:51:33 +0530 Subject: [PATCH 14/19] Plug in configs Signed-off-by: Saravanan Raju --- src/cdpy/dw.py | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/src/cdpy/dw.py b/src/cdpy/dw.py index 354bb43..057e230 100644 --- a/src/cdpy/dw.py +++ b/src/cdpy/dw.py @@ -99,24 +99,41 @@ def delete_cluster(self, cluster_id: str, force: bool = False): def create_vw(self, cluster_id:str, dbc_id:str, vw_type:str, name:str, template:str = None, autoscaling_min_cluster:int = None, autoscaling_max_cluster:int = None, - service_config_req:str = None, tags:dict = None): - if autoscaling_min_cluster == 0 and autoscaling_max_cluster == 0: - autoscaling_options = None - elif autoscaling_min_cluster == 0 and autoscaling_max_cluster > 0: - autoscaling_options = dict(maxClusters=autoscaling_max_cluster) - elif autoscaling_min_cluster > 0 and autoscaling_min_cluster == 0: - autoscaling_options = dict(minClusters=autoscaling_max_cluster) - else: - autoscaling_options = dict(minClusters=autoscaling_max_cluster, maxClusters=autoscaling_max_cluster) + common_configs:dict = None, application_configs:dict = None, ldap_groups:list = None, + enable_sso:bool = None, tags:dict = None): + # if autoscaling_min_cluster == 0 and autoscaling_max_cluster == 0: + # autoscaling_options = None + # elif autoscaling_min_cluster == 0 and autoscaling_max_cluster > 0: + # autoscaling_options = dict(maxClusters=autoscaling_max_cluster) + # elif autoscaling_min_cluster > 0 and autoscaling_min_cluster == 0: + # autoscaling_options = dict(minClusters=autoscaling_max_cluster) + # else: + # autoscaling_options = dict(minClusters=autoscaling_max_cluster, maxClusters=autoscaling_max_cluster) + + autoscaling = {} + if autoscaling_min_cluster != 0: + autoscaling['minClusters'] = autoscaling_min_cluster + if autoscaling_max_cluster != 0: + autoscaling['maxClusters'] = autoscaling_max_cluster tag_list = [] for key,value in tags.items(): tag_list.append({'key': key, 'value': value}) + config = {} + if not common_configs is None: + config['commonConfigs'] = common_configs + if not application_configs is None: + config['applicationConfigs'] = application_configs + if not ldap_groups is None: + config['ldapGroups'] = ldap_groups + if not enable_sso is None: + config['enableSSO'] = enable_sso + return self.sdk.call( svc='dw', func='create_vw', ret_field='vwId', clusterId=cluster_id, dbcId=dbc_id, - vwType=vw_type, name=name, template=template, autoscaling=autoscaling_options, - config=service_config_req, tags=tag_list + vwType=vw_type, name=name, template=template, autoscaling=autoscaling, + config=config, tags=tag_list ) def create_dbc(self, cluster_id:str, name:str, load_demo_data: bool = None): From f12221c347c60147b4ead85402080ed4cc724e40 Mon Sep 17 00:00:00 2001 From: Saravanan Raju Date: Mon, 12 Jul 2021 14:55:45 +0530 Subject: [PATCH 15/19] Print variables Signed-off-by: Saravanan Raju --- src/cdpy/dw.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cdpy/dw.py b/src/cdpy/dw.py index 057e230..a66766f 100644 --- a/src/cdpy/dw.py +++ b/src/cdpy/dw.py @@ -130,6 +130,8 @@ def create_vw(self, cluster_id:str, dbc_id:str, vw_type:str, name:str, template: if not enable_sso is None: config['enableSSO'] = enable_sso + print('autoscaling', autoscaling, 'configs', config) + return self.sdk.call( svc='dw', func='create_vw', ret_field='vwId', clusterId=cluster_id, dbcId=dbc_id, vwType=vw_type, name=name, template=template, autoscaling=autoscaling, From e3eb5101fc7d2aa03e0d27720a7a8b43ef6187b5 Mon Sep 17 00:00:00 2001 From: Saravanan Raju Date: Mon, 12 Jul 2021 15:26:35 +0530 Subject: [PATCH 16/19] Adjust configs Signed-off-by: Saravanan Raju --- src/cdpy/dw.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cdpy/dw.py b/src/cdpy/dw.py index a66766f..5fc94b9 100644 --- a/src/cdpy/dw.py +++ b/src/cdpy/dw.py @@ -121,11 +121,11 @@ def create_vw(self, cluster_id:str, dbc_id:str, vw_type:str, name:str, template: tag_list.append({'key': key, 'value': value}) config = {} - if not common_configs is None: + if not common_configs is None and not common_configs: config['commonConfigs'] = common_configs - if not application_configs is None: + if not application_configs is None and not application_configs: config['applicationConfigs'] = application_configs - if not ldap_groups is None: + if not ldap_groups is None and not ldap_groups: config['ldapGroups'] = ldap_groups if not enable_sso is None: config['enableSSO'] = enable_sso From f7383753686546eaf8afe5baf44547b5f84f51ff Mon Sep 17 00:00:00 2001 From: Saravanan Raju Date: Tue, 13 Jul 2021 13:15:42 +0530 Subject: [PATCH 17/19] Remove unused code Signed-off-by: Saravanan Raju --- src/cdpy/dw.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/cdpy/dw.py b/src/cdpy/dw.py index 5fc94b9..5b9b401 100644 --- a/src/cdpy/dw.py +++ b/src/cdpy/dw.py @@ -101,15 +101,6 @@ def create_vw(self, cluster_id:str, dbc_id:str, vw_type:str, name:str, template: autoscaling_min_cluster:int = None, autoscaling_max_cluster:int = None, common_configs:dict = None, application_configs:dict = None, ldap_groups:list = None, enable_sso:bool = None, tags:dict = None): - # if autoscaling_min_cluster == 0 and autoscaling_max_cluster == 0: - # autoscaling_options = None - # elif autoscaling_min_cluster == 0 and autoscaling_max_cluster > 0: - # autoscaling_options = dict(maxClusters=autoscaling_max_cluster) - # elif autoscaling_min_cluster > 0 and autoscaling_min_cluster == 0: - # autoscaling_options = dict(minClusters=autoscaling_max_cluster) - # else: - # autoscaling_options = dict(minClusters=autoscaling_max_cluster, maxClusters=autoscaling_max_cluster) - autoscaling = {} if autoscaling_min_cluster != 0: autoscaling['minClusters'] = autoscaling_min_cluster @@ -130,8 +121,6 @@ def create_vw(self, cluster_id:str, dbc_id:str, vw_type:str, name:str, template: if not enable_sso is None: config['enableSSO'] = enable_sso - print('autoscaling', autoscaling, 'configs', config) - return self.sdk.call( svc='dw', func='create_vw', ret_field='vwId', clusterId=cluster_id, dbcId=dbc_id, vwType=vw_type, name=name, template=template, autoscaling=autoscaling, From 74ad92425413137925755ba701bbf1f2059c9240 Mon Sep 17 00:00:00 2001 From: Saravanan Raju Date: Wed, 21 Jul 2021 15:48:31 +0530 Subject: [PATCH 18/19] Add delete dbc and vw functions Signed-off-by: Saravanan Raju --- src/cdpy/dw.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/cdpy/dw.py b/src/cdpy/dw.py index 5b9b401..5b0d5fe 100644 --- a/src/cdpy/dw.py +++ b/src/cdpy/dw.py @@ -127,7 +127,17 @@ def create_vw(self, cluster_id:str, dbc_id:str, vw_type:str, name:str, template: config=config, tags=tag_list ) + def delete_vw(self, cluster_id:str, vw_id:str): + return self.sdk.call( + svc='dw', func='delete_vw', squelch=[Squelch('NOT_FOUND')], clusterId=cluster_id, vwId=vw_id + ) + def create_dbc(self, cluster_id:str, name:str, load_demo_data: bool = None): return self.sdk.call( svc='dw', func='create_dbc', clusterId = cluster_id, name=name, loadDemoData = load_demo_data ) + + def delete_dbc(self, cluster_id:str, dbc_id:str): + return self.sdk.call( + svc='dw', func='delete_dbc', squelch=[Squelch('NOT_FOUND')], clusterId=cluster_id, dbcId=dbc_id + ) From b77a1dd869774668086b83b59bd68cc80a1568f5 Mon Sep 17 00:00:00 2001 From: Saravanan Raju Date: Thu, 22 Jul 2021 12:50:28 +0530 Subject: [PATCH 19/19] Modify the return field for cdpy Signed-off-by: Saravanan Raju --- src/cdpy/dw.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cdpy/dw.py b/src/cdpy/dw.py index 5b0d5fe..38e218a 100644 --- a/src/cdpy/dw.py +++ b/src/cdpy/dw.py @@ -134,7 +134,8 @@ def delete_vw(self, cluster_id:str, vw_id:str): def create_dbc(self, cluster_id:str, name:str, load_demo_data: bool = None): return self.sdk.call( - svc='dw', func='create_dbc', clusterId = cluster_id, name=name, loadDemoData = load_demo_data + svc='dw', func='create_dbc', ret_field='dbcId', clusterId = cluster_id, name=name, + loadDemoData = load_demo_data ) def delete_dbc(self, cluster_id:str, dbc_id:str):