Skip to content

Commit dba1cc1

Browse files
Tonychen0227Tony Chen (DevDiv)
andauthored
{ServiceConnector-Passwordless} Fix Fabric SQL target interactive mode (#8503)
* Args for fabric * Fix comment * Expose new fields * Add params related to target ID for Fabric SQL * Fix versioning * Add params to extension --------- Co-authored-by: Tony Chen (DevDiv) <[email protected]>
1 parent dfd6e4c commit dba1cc1

File tree

6 files changed

+43
-7
lines changed

6 files changed

+43
-7
lines changed

src/serviceconnector-passwordless/HISTORY.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
33
Release History
44
===============
5+
3.3.0
6+
++++++
7+
* Fix issue with params to support interactive mode for Fabric SQL
8+
59
3.2.0
610
++++++
711
* Introduce support for Fabric SQL as a target service. Introduce new `connstr_props` argument to configure Fabric SQL.

src/serviceconnector-passwordless/azext_serviceconnector_passwordless/_params.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
add_client_type_argument,
1010
add_connection_name_argument,
1111
add_source_resource_block,
12-
add_target_resource_block,
1312
add_new_addon_argument,
1413
add_vnet_block,
1514
add_connection_string_argument,
@@ -61,6 +60,29 @@ def add_auth_block(context, source, target):
6160
context.ignore(arg)
6261

6362

63+
def add_target_resource_block(context, target):
64+
target_args = TARGET_RESOURCES_PARAMS.get(target)
65+
for resource, args in TARGET_RESOURCES_PARAMS.items():
66+
if resource != target:
67+
for arg in args:
68+
if arg not in target_args:
69+
context.ignore(arg)
70+
71+
required_args = []
72+
if target in TARGET_RESOURCES_PARAMS:
73+
for arg, content in TARGET_RESOURCES_PARAMS.get(target).items():
74+
context.argument(arg, options_list=content.get('options'), type=str,
75+
help='{}. Required if \'--target-id\' is not specified.'.format(content.get('help')))
76+
required_args.append(content.get('options')[0])
77+
78+
context.argument('target_id', type=str,
79+
help='The resource id of target service. Required if {required_args} '
80+
'are not specified.'.format(required_args=str(required_args)))
81+
82+
if target != RESOURCE.KeyVault:
83+
context.ignore('enable_csi')
84+
85+
6486
def load_arguments(self, _):
6587
source = RESOURCE.Local
6688
for target in TARGET_RESOURCES_PARAMS:

src/serviceconnector-passwordless/azext_serviceconnector_passwordless/_resource_config.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,15 @@
133133
}
134134
},
135135
RESOURCE.FabricSql: {
136-
'connstr_props': {
137-
'options': ['--connstr-props'],
138-
'help': 'Connection string properties of the Fabric SQL server. Format like: --connstr-props "Server=<Server_Host>,<Port>" "Database=<Database_Name>".',
139-
'placeholder': 'Server=MyServer,1433 Database=MyDB'
136+
'fabric_workspace_uuid': {
137+
'options': ['--fabric-workspace-uuid'],
138+
'help': 'UUID of Fabric workspace which contains the target SQL database',
139+
'placeholder': 'TargetFabricWorkspaceUUID'
140+
},
141+
'fabric_sql_db_uuid': {
142+
'options': ['--fabric-sql-db-uuid'],
143+
'help': 'UUID of the target Fabric SQL database',
144+
'placeholder': 'TargetFabricSQLDatabaseUUID'
140145
}
141146
}
142147
}

src/serviceconnector-passwordless/azext_serviceconnector_passwordless/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
# --------------------------------------------------------------------------------------------
55

66

7-
VERSION = '3.2.0'
7+
VERSION = '3.3.0'
88
NAME = 'serviceconnector-passwordless'

src/serviceconnector-passwordless/azext_serviceconnector_passwordless/custom.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ def connection_create_ext(cmd, client,
2828
spring=None, app=None, deployment='default', # Resource.SpringCloud
2929
# Resource.*Postgres, Resource.*Sql*
3030
server=None, database=None,
31+
# Resource.FabricSQL
3132
connstr_props=None,
33+
fabric_workspace_uuid=None,
34+
fabric_sql_db_uuid=None,
3235
**kwargs,
3336
):
3437
from azure.cli.command_modules.serviceconnector.custom import connection_create_func
@@ -54,6 +57,8 @@ def connection_create_ext(cmd, client,
5457
opt_out_list=opt_out_list,
5558
app_config_id=app_config_id,
5659
connstr_props=connstr_props,
60+
fabric_workspace_uuid=fabric_workspace_uuid,
61+
fabric_sql_db_uuid=fabric_sql_db_uuid,
5762
**kwargs)
5863

5964

src/serviceconnector-passwordless/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
logger.warn("Wheel is not available, disabling bdist_wheel hook")
1616

1717

18-
VERSION = '3.2.0'
18+
VERSION = '3.3.0'
1919
try:
2020
from azext_serviceconnector_passwordless.config import VERSION
2121
except ImportError:

0 commit comments

Comments
 (0)