1212import com .microsoft .azure .toolkit .intellij .function .runner .library .IPrompter ;
1313import com .microsoft .azure .toolkit .lib .common .exception .AzureExecutionException ;
1414import com .microsoft .azure .toolkit .lib .common .exception .AzureToolkitRuntimeException ;
15+ import com .microsoft .azure .toolkit .lib .common .messager .AzureMessager ;
1516import com .microsoft .azure .toolkit .lib .common .operation .AzureOperation ;
1617import com .microsoft .azure .toolkit .lib .legacy .appservice .AppServiceUtils ;
1718import com .microsoft .azure .toolkit .lib .legacy .appservice .DeployTarget ;
@@ -72,20 +73,20 @@ public FunctionApp execute() throws Exception {
7273 final FunctionApp app = getFunctionApp ();
7374 updateFunctionAppSettings (app );
7475 final DeployTarget deployTarget = new DeployTarget (app , DeployTargetType .FUNCTION );
75- prompt (message ("function.deploy.hint.startDeployFunction" ));
76+ AzureMessager . getMessager (). info (message ("function.deploy.hint.startDeployFunction" ));
7677 getArtifactHandler ().publish (deployTarget );
77- prompt (message ("function.deploy.hint.deployDone" , model .getAppName ()));
78+ AzureMessager . getMessager (). info (message ("function.deploy.hint.deployDone" , model .getAppName ()));
7879 listHTTPTriggerUrls ();
7980 return (FunctionApp ) deployTarget .getApp ();
8081 }
8182
8283 private void updateFunctionAppSettings (final FunctionApp app ) throws AzureExecutionException {
83- prompt (message ("function.deploy.hint.updateFunctionApp" ));
84+ AzureMessager . getMessager (). info (message ("function.deploy.hint.updateFunctionApp" ));
8485 // Work around of https://github.com/Azure/azure-sdk-for-java/issues/1755
8586 final Update update = app .update ();
8687 configureAppSettings (update ::withAppSettings , getAppSettingsWithDefaultValue ());
8788 update .apply ();
88- prompt (message ("function.deploy.hint.updateDone" , model .getAppName ()));
89+ AzureMessager . getMessager (). info (message ("function.deploy.hint.updateDone" , model .getAppName ()));
8990 }
9091
9192 private void configureAppSettings (final Consumer <Map > withAppSettings , final Map appSettings ) {
@@ -113,13 +114,13 @@ private void listHTTPTriggerUrls() {
113114 AuthorizationLevel .ANONYMOUS .toString ()))
114115 .collect (Collectors .toList ());
115116 if (CollectionUtils .isEmpty (httpFunction ) || CollectionUtils .isEmpty (anonymousTriggers )) {
116- prompt (message ("function.deploy.hint.noAnonymousHttpTrigger" ));
117+ AzureMessager . getMessager (). info (message ("function.deploy.hint.noAnonymousHttpTrigger" ));
117118 return ;
118119 }
119- prompt (message ("function.deploy.hint.httpTriggerUrls" ));
120- anonymousTriggers .forEach (trigger -> prompt (String .format ("\t %s : %s" , trigger .getName (), trigger .getTriggerUrl ())));
120+ AzureMessager . getMessager (). info (message ("function.deploy.hint.httpTriggerUrls" ));
121+ anonymousTriggers .forEach (trigger -> AzureMessager . getMessager (). info (String .format ("\t %s : %s" , trigger .getName (), trigger .getTriggerUrl ())));
121122 if (anonymousTriggers .size () < httpFunction .size ()) {
122- prompt (message ("function.deploy.error.listHttpTriggerFailed" ));
123+ AzureMessager . getMessager (). info (message ("function.deploy.error.listHttpTriggerFailed" ));
123124 }
124125 }
125126
@@ -141,7 +142,7 @@ private List<FunctionResource> listFunctions() {
141142 for (int i = 0 ; i < LIST_TRIGGERS_MAX_RETRY ; i ++) {
142143 try {
143144 Thread .sleep (LIST_TRIGGERS_RETRY_PERIOD_IN_SECONDS * 1000 );
144- prompt (String .format (message ("function.deploy.hint.syncTriggers" ), i + 1 , LIST_TRIGGERS_MAX_RETRY ));
145+ AzureMessager . getMessager (). info (String .format (message ("function.deploy.hint.syncTriggers" ), i + 1 , LIST_TRIGGERS_MAX_RETRY ));
145146 functionApp .syncTriggers ();
146147 final List <FunctionResource > triggers =
147148 model .getAzureClient ().appServices ().functionApps ()
@@ -209,7 +210,7 @@ private void setDefaultAppSetting(Map result, String settingName, String setting
209210
210211 final String setting = (String ) result .get (settingName );
211212 if (StringUtils .isEmpty (setting )) {
212- prompt (settingIsEmptyMessage );
213+ AzureMessager . getMessager (). info (settingIsEmptyMessage );
213214 result .put (settingName , settingValue );
214215 }
215216 }
@@ -219,9 +220,9 @@ private void overrideDefaultAppSetting(Map result, String settingName, String se
219220
220221 final String setting = (String ) result .get (settingName );
221222 if (StringUtils .isEmpty (setting )) {
222- prompt (settingIsEmptyMessage );
223+ AzureMessager . getMessager (). info (settingIsEmptyMessage );
223224 } else if (!setting .equals (settingValue )) {
224- prompt (String .format (changeSettingMessage , setting ));
225+ AzureMessager . getMessager (). info (String .format (changeSettingMessage , setting ));
225226 }
226227 result .put (settingName , settingValue );
227228 }
@@ -258,7 +259,4 @@ private ArtifactHandler getArtifactHandler() throws AzureExecutionException {
258259 .build ();
259260 }
260261
261- private void prompt (String promptMessage ) {
262- prompter .prompt (promptMessage );
263- }
264262}
0 commit comments