Skip to content

Commit 3733cbf

Browse files
authored
Merge pull request #318 from rstudio/cloud-rebrand
Posit Cloud rebrand
2 parents 26c6fa2 + a5f7191 commit 3733cbf

File tree

5 files changed

+52
-52
lines changed

5 files changed

+52
-52
lines changed

rsconnect/actions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,8 @@ def test_server(connect_server):
225225
raise RSConnectException("\n".join(failures))
226226

227227

228-
def test_rstudio_server(server: api.RStudioServer):
229-
with api.RStudioClient(server) as client:
228+
def test_rstudio_server(server: api.PositServer):
229+
with api.PositClient(server) as client:
230230
try:
231231
result = client.get_current_user()
232232
server.handle_bad_response(result)

rsconnect/api.py

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ def handle_bad_response(self, response):
6464
)
6565

6666

67-
class RStudioServer(AbstractRemoteServer):
67+
class PositServer(AbstractRemoteServer):
6868
"""
69-
A class used to represent the server of the shinyapps.io and RStudio Cloud APIs.
69+
A class used to represent the server of the shinyapps.io and Posit Cloud APIs.
7070
"""
7171

7272
def __init__(self, remote_name: str, url: str, account_name: str, token: str, secret: str):
@@ -76,7 +76,7 @@ def __init__(self, remote_name: str, url: str, account_name: str, token: str, se
7676
self.secret = secret
7777

7878

79-
class ShinyappsServer(RStudioServer):
79+
class ShinyappsServer(PositServer):
8080
"""
8181
A class to encapsulate the information needed to interact with an
8282
instance of the shinyapps.io server.
@@ -89,16 +89,16 @@ def __init__(self, url: str, account_name: str, token: str, secret: str):
8989
super().__init__(remote_name=remote_name, url=url, account_name=account_name, token=token, secret=secret)
9090

9191

92-
class CloudServer(RStudioServer):
92+
class CloudServer(PositServer):
9393
"""
9494
A class to encapsulate the information needed to interact with an
95-
instance of the RStudio Cloud server.
95+
instance of the Posit Cloud server.
9696
"""
9797

9898
def __init__(self, url: str, account_name: str, token: str, secret: str):
99-
remote_name = "RStudio Cloud"
100-
if url == "rstudio.cloud" or url is None:
101-
url = "https://api.rstudio.cloud"
99+
remote_name = "Posit Cloud"
100+
if url in {"posit.cloud", "rstudio.cloud", None}:
101+
url = "https://api.posit.cloud"
102102
super().__init__(remote_name=remote_name, url=url, account_name=account_name, token=token, secret=secret)
103103

104104

@@ -475,7 +475,7 @@ def setup_remote_server(
475475
if api_key:
476476
self.remote_server = RSConnectServer(url, api_key, insecure, ca_data)
477477
elif token and secret:
478-
if url and "rstudio.cloud" in url:
478+
if url and ("rstudio.cloud" in url or "posit.cloud" in url):
479479
self.remote_server = CloudServer(url, account_name, token, secret)
480480
else:
481481
self.remote_server = ShinyappsServer(url, account_name, token, secret)
@@ -485,8 +485,8 @@ def setup_remote_server(
485485
def setup_client(self, cookies=None, timeout=30, **kwargs):
486486
if isinstance(self.remote_server, RSConnectServer):
487487
self.client = RSConnectClient(self.remote_server, cookies, timeout)
488-
elif isinstance(self.remote_server, RStudioServer):
489-
self.client = RStudioClient(self.remote_server, timeout)
488+
elif isinstance(self.remote_server, PositServer):
489+
self.client = PositClient(self.remote_server, timeout)
490490
else:
491491
raise RSConnectException("Unable to infer Connect client.")
492492

@@ -515,7 +515,7 @@ def validate_server(
515515
):
516516
if (url and api_key) or isinstance(self.remote_server, RSConnectServer):
517517
self.validate_connect_server(name, url, api_key, insecure, cacert, api_key_is_required)
518-
elif (url and token and secret) or isinstance(self.remote_server, RStudioServer):
518+
elif (url and token and secret) or isinstance(self.remote_server, PositServer):
519519
self.validate_rstudio_server(url, account_name, token, secret)
520520
else:
521521
raise RSConnectException("Unable to validate server from information provided.")
@@ -596,11 +596,11 @@ def validate_rstudio_server(
596596
secret = secret or self.remote_server.secret
597597
server = (
598598
CloudServer(url, account_name, token, secret)
599-
if "rstudio.cloud" in url
599+
if "rstudio.cloud" in url or "posit.cloud" in url
600600
else ShinyappsServer(url, account_name, token, secret)
601601
)
602602

603-
with RStudioClient(server) as client:
603+
with PositClient(server) as client:
604604
try:
605605
result = client.get_current_user()
606606
server.handle_bad_response(result)
@@ -657,7 +657,7 @@ def check_server_capabilities(self, capability_functions):
657657
:param details_source: the source for obtaining server details, gather_server_details(),
658658
by default.
659659
"""
660-
if isinstance(self.remote_server, RStudioServer):
660+
if isinstance(self.remote_server, PositServer):
661661
return self
662662

663663
details = self.server_details
@@ -847,7 +847,7 @@ def validate_app_mode(self, *args, **kwargs):
847847
if isinstance(self.remote_server, RSConnectServer):
848848
app = get_app_info(self.remote_server, app_id)
849849
existing_app_mode = AppModes.get_by_ordinal(app.get("app_mode", 0), True)
850-
elif isinstance(self.remote_server, RStudioServer):
850+
elif isinstance(self.remote_server, PositServer):
851851
app = get_rstudio_app_info(self.remote_server, app_id)
852852
existing_app_mode = AppModes.get_by_cloud_name(app.json_data["mode"])
853853
else:
@@ -1008,14 +1008,14 @@ def __init__(
10081008
self.output_id = output_id
10091009

10101010

1011-
class RStudioClient(HTTPServer):
1011+
class PositClient(HTTPServer):
10121012
"""
1013-
An HTTP client to call the RStudio Cloud and shinyapps.io APIs.
1013+
An HTTP client to call the Posit Cloud and shinyapps.io APIs.
10141014
"""
10151015

10161016
_TERMINAL_STATUSES = {"success", "failed", "error"}
10171017

1018-
def __init__(self, rstudio_server: RStudioServer, timeout: int = 30):
1018+
def __init__(self, rstudio_server: PositServer, timeout: int = 30):
10191019
self._token = rstudio_server.token
10201020
try:
10211021
self._key = base64.b64decode(rstudio_server.secret)
@@ -1156,7 +1156,7 @@ class ShinyappsService:
11561156
Encapsulates operations involving multiple API calls to shinyapps.io.
11571157
"""
11581158

1159-
def __init__(self, rstudio_client: RStudioClient, server: ShinyappsServer):
1159+
def __init__(self, rstudio_client: PositClient, server: ShinyappsServer):
11601160
self._rstudio_client = rstudio_client
11611161
self._server = server
11621162

@@ -1202,10 +1202,10 @@ def do_deploy(self, bundle_id, app_id):
12021202

12031203
class CloudService:
12041204
"""
1205-
Encapsulates operations involving multiple API calls to RStudio Cloud.
1205+
Encapsulates operations involving multiple API calls to Posit Cloud.
12061206
"""
12071207

1208-
def __init__(self, rstudio_client: RStudioClient, server: CloudServer):
1208+
def __init__(self, rstudio_client: PositClient, server: CloudServer):
12091209
self._rstudio_client = rstudio_client
12101210
self._server = server
12111211

@@ -1332,7 +1332,7 @@ def get_app_info(connect_server, app_id):
13321332

13331333

13341334
def get_rstudio_app_info(server, app_id):
1335-
with RStudioClient(server) as client:
1335+
with PositClient(server) as client:
13361336
result = client.get_application(app_id)
13371337
server.handle_bad_response(result)
13381338
return result
@@ -1541,7 +1541,7 @@ def find_unique_name(remote_server: TargetableServer, name: str):
15411541
mapping_function=lambda client, app: app["name"],
15421542
)
15431543
elif isinstance(remote_server, ShinyappsServer):
1544-
client = RStudioClient(remote_server)
1544+
client = PositClient(remote_server)
15451545
existing_names = client.get_applications_like_name(name)
15461546
else:
15471547
# non-unique names are permitted in cloud

rsconnect/main.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,13 @@ def rstudio_args(func):
152152
"--token",
153153
"-T",
154154
envvar=["SHINYAPPS_TOKEN", "RSCLOUD_TOKEN"],
155-
help="The shinyapps.io/RStudio Cloud token.",
155+
help="The shinyapps.io/Posit Cloud token.",
156156
)
157157
@click.option(
158158
"--secret",
159159
"-S",
160160
envvar=["SHINYAPPS_SECRET", "RSCLOUD_SECRET"],
161-
help="The shinyapps.io/RStudio Cloud token secret.",
161+
help="The shinyapps.io/Posit Cloud token secret.",
162162
)
163163
@functools.wraps(func)
164164
def wrapper(*args, **kwargs):
@@ -245,8 +245,8 @@ def cli(future):
245245
certificate file to use for TLS. The last two items are only relevant if the
246246
URL specifies the "https" protocol.
247247
248-
For RStudio Cloud, the information needed to connect includes the auth token, auth
249-
secret, and server ('rstudio.cloud'). For shinyapps.io, the auth token, auth secret,
248+
For Posit Cloud, the information needed to connect includes the auth token, auth
249+
secret, and server ('posit.cloud'). For shinyapps.io, the auth token, auth secret,
250250
server ('shinyapps.io'), and account are needed.
251251
"""
252252
global future_enabled
@@ -285,7 +285,7 @@ def _test_server_and_api(server, api_key, insecure, ca_cert):
285285
return real_server, me
286286

287287

288-
def _test_rstudio_creds(server: api.RStudioServer):
288+
def _test_rstudio_creds(server: api.PositServer):
289289
with cli_feedback("Checking {} credential".format(server.remote_name)):
290290
test_rstudio_server(server)
291291

@@ -434,7 +434,7 @@ def add(ctx, name, server, api_key, insecure, cacert, account, token, secret, ve
434434
old_server = server_store.get_by_name(name)
435435

436436
if token:
437-
if server and "rstudio.cloud" in server:
437+
if server and ("rstudio.cloud" in server or "posit.cloud" in server):
438438
real_server = api.CloudServer(server, account, token, secret)
439439
else:
440440
real_server = api.ShinyappsServer(server, account, token, secret)

rsconnect/validation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ def validate_connection_options(url, api_key, insecure, cacert, account_name, to
3535

3636
if present_connect_options and present_shinyapps_options:
3737
raise RSConnectException(
38-
"Connect options ({}) may not be passed alongside shinyapps.io or RStudio Cloud options ({}).".format(
38+
"Connect options ({}) may not be passed alongside shinyapps.io or Posit Cloud options ({}).".format(
3939
", ".join(present_connect_options), ", ".join(present_shinyapps_options)
4040
)
4141
)
4242

43-
if url and 'rstudio.cloud' in url:
43+
if url and ('posit.cloud' in url or 'rstudio.cloud' in url):
4444
if len(present_cloud_options) != len(cloud_options):
4545
raise RSConnectException(
46-
"-T/--token and -S/--secret must be provided for RStudio Cloud."
46+
"-T/--token and -S/--secret must be provided for Posit Cloud."
4747
)
4848
elif present_shinyapps_options:
4949
if len(present_shinyapps_options) != len(shinyapps_options):

tests/test_main.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -270,21 +270,21 @@ def test_deploy_manifest_cloud(self, project_application_id, project_id):
270270

271271
httpretty.register_uri(
272272
httpretty.GET,
273-
"https://api.rstudio.cloud/v1/users/me",
273+
"https://api.posit.cloud/v1/users/me",
274274
body=open("tests/testdata/rstudio-responses/get-user.json", "r").read(),
275275
status=200,
276276
)
277277
httpretty.register_uri(
278278
httpretty.GET,
279-
"https://api.rstudio.cloud/v1/applications"
279+
"https://api.posit.cloud/v1/applications"
280280
"?filter=name:like:shinyapp&offset=0&count=100&use_advanced_filters=true",
281281
body=open("tests/testdata/rstudio-responses/get-applications.json", "r").read(),
282282
adding_headers={"Content-Type": "application/json"},
283283
status=200,
284284
)
285285
httpretty.register_uri(
286286
httpretty.GET,
287-
"https://api.rstudio.cloud/v1/accounts/",
287+
"https://api.posit.cloud/v1/accounts/",
288288
body=open("tests/testdata/rstudio-responses/get-accounts.json", "r").read(),
289289
adding_headers={"Content-Type": "application/json"},
290290
status=200,
@@ -293,21 +293,21 @@ def test_deploy_manifest_cloud(self, project_application_id, project_id):
293293
if project_application_id:
294294
httpretty.register_uri(
295295
httpretty.GET,
296-
"https://api.rstudio.cloud/v1/applications/444",
296+
"https://api.posit.cloud/v1/applications/444",
297297
body=open("tests/testdata/rstudio-responses/get-project-application.json", "r").read(),
298298
adding_headers={"Content-Type": "application/json"},
299299
status=200,
300300
)
301301
httpretty.register_uri(
302302
httpretty.GET,
303-
"https://api.rstudio.cloud/v1/content/555",
303+
"https://api.posit.cloud/v1/content/555",
304304
body=open("tests/testdata/rstudio-responses/get-content.json", "r").read(),
305305
adding_headers={"Content-Type": "application/json"},
306306
status=200,
307307
)
308308
httpretty.register_uri(
309309
httpretty.GET,
310-
"https://api.rstudio.cloud/v1/content/1",
310+
"https://api.posit.cloud/v1/content/1",
311311
body=open("tests/testdata/rstudio-responses/create-output.json", "r").read(),
312312
adding_headers={"Content-Type": "application/json"},
313313
status=200,
@@ -328,15 +328,15 @@ def post_output_callback(request, uri, response_headers):
328328

329329
httpretty.register_uri(
330330
httpretty.GET,
331-
"https://api.rstudio.cloud/v1/applications/8442",
331+
"https://api.posit.cloud/v1/applications/8442",
332332
body=open("tests/testdata/rstudio-responses/get-output-application.json", "r").read(),
333333
adding_headers={"Content-Type": "application/json"},
334334
status=200,
335335
)
336336

337337
httpretty.register_uri(
338338
httpretty.POST,
339-
"https://api.rstudio.cloud/v1/outputs/",
339+
"https://api.posit.cloud/v1/outputs/",
340340
body=post_output_callback,
341341
)
342342

@@ -359,7 +359,7 @@ def post_bundle_callback(request, uri, response_headers):
359359

360360
httpretty.register_uri(
361361
httpretty.POST,
362-
"https://api.rstudio.cloud/v1/bundles",
362+
"https://api.posit.cloud/v1/bundles",
363363
body=post_bundle_callback,
364364
)
365365

@@ -382,17 +382,17 @@ def post_bundle_status_callback(request, uri, response_headers):
382382
assert parsed_request == {"status": "ready"}
383383
except AssertionError as e:
384384
return _error_to_response(e)
385-
return [303, {"Location": "https://api.rstudio.cloud/v1/bundles/12640"}, ""]
385+
return [303, {"Location": "https://api.posit.cloud/v1/bundles/12640"}, ""]
386386

387387
httpretty.register_uri(
388388
httpretty.POST,
389-
"https://api.rstudio.cloud/v1/bundles/12640/status",
389+
"https://api.posit.cloud/v1/bundles/12640/status",
390390
body=post_bundle_status_callback,
391391
)
392392

393393
httpretty.register_uri(
394394
httpretty.GET,
395-
"https://api.rstudio.cloud/v1/bundles/12640",
395+
"https://api.posit.cloud/v1/bundles/12640",
396396
body=open("tests/testdata/rstudio-responses/get-accounts.json", "r").read(),
397397
adding_headers={"Content-Type": "application/json"},
398398
status=200,
@@ -406,19 +406,19 @@ def post_deploy_callback(request, uri, response_headers):
406406
return _error_to_response(e)
407407
return [
408408
303,
409-
{"Location": "https://api.rstudio.cloud/v1/tasks/333"},
409+
{"Location": "https://api.posit.cloud/v1/tasks/333"},
410410
open("tests/testdata/rstudio-responses/post-deploy.json", "r").read(),
411411
]
412412

413413
httpretty.register_uri(
414414
httpretty.POST,
415-
"https://api.rstudio.cloud/v1/applications/8442/deploy",
415+
"https://api.posit.cloud/v1/applications/8442/deploy",
416416
body=post_deploy_callback,
417417
)
418418

419419
httpretty.register_uri(
420420
httpretty.GET,
421-
"https://api.rstudio.cloud/v1/tasks/333",
421+
"https://api.posit.cloud/v1/tasks/333",
422422
body=open("tests/testdata/rstudio-responses/get-task.json", "r").read(),
423423
adding_headers={"Content-Type": "application/json"},
424424
status=200,
@@ -505,7 +505,7 @@ def test_add_cloud(self):
505505
original_server_value = os.environ.pop("CONNECT_SERVER", None)
506506
try:
507507
httpretty.register_uri(
508-
httpretty.GET, "https://api.rstudio.cloud/v1/users/me", body='{"id": 1000}', status=200
508+
httpretty.GET, "https://api.posit.cloud/v1/users/me", body='{"id": 1000}', status=200
509509
)
510510

511511
runner = CliRunner()
@@ -524,7 +524,7 @@ def test_add_cloud(self):
524524
],
525525
)
526526
assert result.exit_code == 0, result.output
527-
assert "RStudio Cloud credential" in result.output
527+
assert "Posit Cloud credential" in result.output
528528

529529
finally:
530530
if original_api_key_value:

0 commit comments

Comments
 (0)