@@ -218,6 +218,15 @@ def test_server(connect_server):
218218 raise RSConnectException ("\n " .join (failures ))
219219
220220
221+ def test_shinyapps_server (server : api .ShinyappsServer ):
222+ with api .ShinyappsClient (server ) as client :
223+ try :
224+ result = client .get_current_user ()
225+ server .handle_bad_response (result )
226+ except RSConnectException as exc :
227+ raise RSConnectException ("Failed to verify with shinyapps.io ({})." .format (exc ))
228+
229+
221230def test_api_key (connect_server ):
222231 """
223232 Test that an API Key may be used to authenticate with the given RStudio Connect server.
@@ -313,7 +322,7 @@ def check_server_capabilities(connect_server, capability_functions, details_sour
313322 raise RSConnectException (message )
314323
315324
316- def _make_deployment_name (connect_server , title , force_unique ) -> str :
325+ def _make_deployment_name (remote_server : api . TargetableServer , title : str , force_unique : bool ) -> str :
317326 """
318327 Produce a name for a deployment based on its title. It is assumed that the
319328 title is already defaulted and validated as appropriate (meaning the title
@@ -324,7 +333,7 @@ def _make_deployment_name(connect_server, title, force_unique) -> str:
324333 that we collapse repeating underscores and, if the name is too short, it is
325334 padded to the left with underscores.
326335
327- :param connect_server : the information needed to interact with the Connect server.
336+ :param remote_server : the information needed to interact with the Connect server.
328337 :param title: the title to start with.
329338 :param force_unique: a flag noting whether the generated name must be forced to be
330339 unique.
@@ -338,7 +347,7 @@ def _make_deployment_name(connect_server, title, force_unique) -> str:
338347
339348 # Now, make sure it's unique, if needed.
340349 if force_unique :
341- name = api .find_unique_name (connect_server , name )
350+ name = api .find_unique_name (remote_server , name )
342351
343352 return name
344353
@@ -1447,7 +1456,7 @@ def _generate_gather_basic_deployment_info_for_python(app_mode: AppMode) -> typi
14471456 """
14481457
14491458 def gatherer (
1450- connect_server : api .RSConnectServer ,
1459+ remote_server : api .TargetableServer ,
14511460 app_store : AppStore ,
14521461 directory : str ,
14531462 entry_point : str ,
@@ -1456,7 +1465,7 @@ def gatherer(
14561465 title : str ,
14571466 ) -> typing .Tuple [str , int , str , str , bool , AppMode ]:
14581467 return _gather_basic_deployment_info_for_framework (
1459- connect_server ,
1468+ remote_server ,
14601469 app_store ,
14611470 directory ,
14621471 entry_point ,
@@ -1477,7 +1486,7 @@ def gatherer(
14771486
14781487
14791488def _gather_basic_deployment_info_for_framework (
1480- connect_server : api .RSConnectServer ,
1489+ remote_server : api .TargetableServer ,
14811490 app_store : AppStore ,
14821491 directory : str ,
14831492 entry_point : str ,
@@ -1489,7 +1498,7 @@ def _gather_basic_deployment_info_for_framework(
14891498 """
14901499 Helps to gather the necessary info for performing a deployment.
14911500
1492- :param connect_server : the Connect server information.
1501+ :param remote_server : the server information.
14931502 :param app_store: the store for the specified directory.
14941503 :param directory: the primary file being deployed.
14951504 :param entry_point: the entry point for the API in '<module>:<object> format. if
@@ -1514,13 +1523,19 @@ def _gather_basic_deployment_info_for_framework(
15141523 if app_id is None :
15151524 # Possible redeployment - check for saved metadata.
15161525 # Use the saved app information unless overridden by the user.
1517- app_id , existing_app_mode = app_store .resolve (connect_server .url , app_id , app_mode )
1526+ app_id , existing_app_mode = app_store .resolve (remote_server .url , app_id , app_mode )
15181527 logger .debug ("Using app mode from app %s: %s" % (app_id , app_mode ))
15191528 elif app_id is not None :
15201529 # Don't read app metadata if app-id is specified. Instead, we need
15211530 # to get this from Connect.
1522- app = api .get_app_info (connect_server , app_id )
1523- existing_app_mode = AppModes .get_by_ordinal (app .get ("app_mode" , 0 ), True )
1531+ if isinstance (remote_server , api .RSConnectServer ):
1532+ app = api .get_app_info (remote_server , app_id )
1533+ existing_app_mode = AppModes .get_by_ordinal (app .get ("app_mode" , 0 ), True )
1534+ elif isinstance (remote_server , api .ShinyappsServer ):
1535+ app = api .get_shinyapp_info (remote_server , app_id )
1536+ existing_app_mode = AppModes .get_by_cloud_name (app .json_data ["mode" ])
1537+ else :
1538+ raise RSConnectException ("Unable to infer Connect client." )
15241539 if existing_app_mode and app_mode != existing_app_mode :
15251540 msg = (
15261541 "Deploying with mode '%s',\n "
@@ -1538,7 +1553,7 @@ def _gather_basic_deployment_info_for_framework(
15381553 return (
15391554 entry_point ,
15401555 app_id ,
1541- _make_deployment_name (connect_server , title , app_id is None ),
1556+ _make_deployment_name (remote_server , title , app_id is None ),
15421557 title ,
15431558 default_title ,
15441559 app_mode ,
@@ -1697,7 +1712,7 @@ def create_quarto_deployment_bundle(
16971712
16981713
16991714def deploy_bundle (
1700- connect_server : api .RSConnectServer ,
1715+ remote_server : api .TargetableServer ,
17011716 app_id : int ,
17021717 name : str ,
17031718 title : str ,
@@ -1708,7 +1723,7 @@ def deploy_bundle(
17081723 """
17091724 Deploys the specified bundle.
17101725
1711- :param connect_server : the Connect server information.
1726+ :param remote_server : the server information.
17121727 :param app_id: the ID of the app to deploy, if this is a redeploy.
17131728 :param name: the name for the deploy.
17141729 :param title: the title for the deploy.
@@ -1718,7 +1733,17 @@ def deploy_bundle(
17181733 :return: application information about the deploy. This includes the ID of the
17191734 task that may be queried for deployment progress.
17201735 """
1721- return api .do_bundle_deploy (connect_server , app_id , name , title , title_is_default , bundle , env_vars )
1736+ ce = RSConnectExecutor (
1737+ server = remote_server ,
1738+ app_id = app_id ,
1739+ name = name ,
1740+ title = title ,
1741+ title_is_default = title_is_default ,
1742+ bundle = bundle ,
1743+ env_vars = env_vars ,
1744+ )
1745+ ce .deploy_bundle ()
1746+ return ce .state ["deployed_info" ]
17221747
17231748
17241749def spool_deployment_log (connect_server , app , log_callback ):
0 commit comments