rsconnect-python 1.30.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rsconnect/__init__.py +13 -0
- rsconnect/actions.py +565 -0
- rsconnect/actions_content.py +508 -0
- rsconnect/actions_environment.py +160 -0
- rsconnect/actions_integration.py +118 -0
- rsconnect/api.py +2582 -0
- rsconnect/bundle.py +2481 -0
- rsconnect/certificates.py +39 -0
- rsconnect/environment.py +390 -0
- rsconnect/environment_node.py +115 -0
- rsconnect/environment_r.py +300 -0
- rsconnect/exception.py +15 -0
- rsconnect/git_metadata.py +180 -0
- rsconnect/http_support.py +595 -0
- rsconnect/json_web_token.py +178 -0
- rsconnect/log.py +253 -0
- rsconnect/main.py +5889 -0
- rsconnect/metadata.py +879 -0
- rsconnect/models.py +835 -0
- rsconnect/oauth.py +623 -0
- rsconnect/py.typed +0 -0
- rsconnect/pyproject.py +283 -0
- rsconnect/quickstart/__init__.py +16 -0
- rsconnect/quickstart/quickstart.py +486 -0
- rsconnect/quickstart/templates/__init__.py +16 -0
- rsconnect/quickstart/templates/api/README.md.tmpl +15 -0
- rsconnect/quickstart/templates/api/__connect__.py.tmpl +3 -0
- rsconnect/quickstart/templates/api/__init__.py.tmpl +1 -0
- rsconnect/quickstart/templates/api/__main__.py.tmpl +14 -0
- rsconnect/quickstart/templates/api/app.py.tmpl +11 -0
- rsconnect/quickstart/templates/api/pyproject.toml.tmpl +13 -0
- rsconnect/quickstart/templates/fastapi/README.md.tmpl +15 -0
- rsconnect/quickstart/templates/fastapi/__connect__.py.tmpl +3 -0
- rsconnect/quickstart/templates/fastapi/__init__.py.tmpl +1 -0
- rsconnect/quickstart/templates/fastapi/__main__.py.tmpl +16 -0
- rsconnect/quickstart/templates/fastapi/app.py.tmpl +11 -0
- rsconnect/quickstart/templates/fastapi/pyproject.toml.tmpl +14 -0
- rsconnect/quickstart/templates/notebook/README.md.tmpl +15 -0
- rsconnect/quickstart/templates/notebook/notebook.ipynb.tmpl +34 -0
- rsconnect/quickstart/templates/notebook/pyproject.toml.tmpl +13 -0
- rsconnect/quickstart/templates/quarto/README.md.tmpl +19 -0
- rsconnect/quickstart/templates/quarto/pyproject.toml.tmpl +11 -0
- rsconnect/quickstart/templates/quarto/report.qmd.tmpl +8 -0
- rsconnect/quickstart/templates/shiny/README.md.tmpl +15 -0
- rsconnect/quickstart/templates/shiny/app.py.tmpl +3 -0
- rsconnect/quickstart/templates/shiny/pyproject.toml.tmpl +13 -0
- rsconnect/quickstart/templates/streamlit/README.md.tmpl +15 -0
- rsconnect/quickstart/templates/streamlit/app.py.tmpl +3 -0
- rsconnect/quickstart/templates/streamlit/pyproject.toml.tmpl +13 -0
- rsconnect/quickstart/templates/voila/README.md.tmpl +15 -0
- rsconnect/quickstart/templates/voila/pyproject.toml.tmpl +14 -0
- rsconnect/shiny_express.py +136 -0
- rsconnect/snowflake.py +93 -0
- rsconnect/subprocesses/__init__.py +0 -0
- rsconnect/subprocesses/inspect_environment.py +362 -0
- rsconnect/timeouts.py +89 -0
- rsconnect/utils_package.py +261 -0
- rsconnect/validation.py +156 -0
- rsconnect/version_check.py +154 -0
- rsconnect_python-1.30.0.dist-info/METADATA +89 -0
- rsconnect_python-1.30.0.dist-info/RECORD +63 -0
- rsconnect_python-1.30.0.dist-info/WHEEL +4 -0
- rsconnect_python-1.30.0.dist-info/entry_points.txt +3 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Public API for managing OAuth integrations on Posit Connect.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
from typing import Optional, Union
|
|
8
|
+
|
|
9
|
+
from .api import RSConnectClient, RSConnectServer, SPCSConnectServer
|
|
10
|
+
from .models import (
|
|
11
|
+
OAuthIntegration,
|
|
12
|
+
OAuthIntegrationInput,
|
|
13
|
+
OAuthIntegrationPermission,
|
|
14
|
+
OAuthIntegrationUpdate,
|
|
15
|
+
OAuthTemplate,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def list_oauth_integrations(
|
|
20
|
+
connect_server: Union[RSConnectServer, SPCSConnectServer],
|
|
21
|
+
) -> list[OAuthIntegration]:
|
|
22
|
+
with RSConnectClient(connect_server) as client:
|
|
23
|
+
return client.oauth_integration_list()
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def get_oauth_integration(
|
|
27
|
+
connect_server: Union[RSConnectServer, SPCSConnectServer],
|
|
28
|
+
guid: str,
|
|
29
|
+
) -> OAuthIntegration:
|
|
30
|
+
with RSConnectClient(connect_server) as client:
|
|
31
|
+
return client.oauth_integration_get(guid)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def create_oauth_integration(
|
|
35
|
+
connect_server: Union[RSConnectServer, SPCSConnectServer],
|
|
36
|
+
template: str,
|
|
37
|
+
config: dict[str, object],
|
|
38
|
+
name: Optional[str] = None,
|
|
39
|
+
description: Optional[str] = None,
|
|
40
|
+
user_guids: Optional[list[str]] = None,
|
|
41
|
+
group_guids: Optional[list[str]] = None,
|
|
42
|
+
) -> OAuthIntegration:
|
|
43
|
+
permissions: list[OAuthIntegrationPermission] = []
|
|
44
|
+
for g in user_guids or []:
|
|
45
|
+
permissions.append({"user_guid": g, "group_guid": None})
|
|
46
|
+
for g in group_guids or []:
|
|
47
|
+
permissions.append({"user_guid": None, "group_guid": g})
|
|
48
|
+
|
|
49
|
+
body: OAuthIntegrationInput = {
|
|
50
|
+
"template": template,
|
|
51
|
+
"config": config,
|
|
52
|
+
}
|
|
53
|
+
if name is not None:
|
|
54
|
+
body["name"] = name
|
|
55
|
+
if description is not None:
|
|
56
|
+
body["description"] = description
|
|
57
|
+
if permissions:
|
|
58
|
+
body["permissions"] = permissions
|
|
59
|
+
|
|
60
|
+
with RSConnectClient(connect_server) as client:
|
|
61
|
+
return client.oauth_integration_create(body)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def update_oauth_integration(
|
|
65
|
+
connect_server: Union[RSConnectServer, SPCSConnectServer],
|
|
66
|
+
guid: str,
|
|
67
|
+
config: Optional[dict[str, object]] = None,
|
|
68
|
+
name: Optional[str] = None,
|
|
69
|
+
description: Optional[str] = None,
|
|
70
|
+
user_guids: Optional[list[str]] = None,
|
|
71
|
+
group_guids: Optional[list[str]] = None,
|
|
72
|
+
) -> OAuthIntegration:
|
|
73
|
+
with RSConnectClient(connect_server) as client:
|
|
74
|
+
body: OAuthIntegrationUpdate = {}
|
|
75
|
+
if name is not None:
|
|
76
|
+
body["name"] = name
|
|
77
|
+
if description is not None:
|
|
78
|
+
body["description"] = description
|
|
79
|
+
if config is not None:
|
|
80
|
+
existing = client.oauth_integration_get(guid)
|
|
81
|
+
merged_config = dict(existing["config"])
|
|
82
|
+
merged_config.update(config)
|
|
83
|
+
body["config"] = merged_config
|
|
84
|
+
|
|
85
|
+
permissions: list[OAuthIntegrationPermission] = []
|
|
86
|
+
if user_guids:
|
|
87
|
+
for g in user_guids:
|
|
88
|
+
permissions.append({"user_guid": g, "group_guid": None})
|
|
89
|
+
if group_guids:
|
|
90
|
+
for g in group_guids:
|
|
91
|
+
permissions.append({"user_guid": None, "group_guid": g})
|
|
92
|
+
if permissions:
|
|
93
|
+
body["permissions"] = permissions
|
|
94
|
+
|
|
95
|
+
return client.oauth_integration_update(guid, body)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def delete_oauth_integration(
|
|
99
|
+
connect_server: Union[RSConnectServer, SPCSConnectServer],
|
|
100
|
+
guid: str,
|
|
101
|
+
) -> None:
|
|
102
|
+
with RSConnectClient(connect_server) as client:
|
|
103
|
+
client.oauth_integration_delete(guid)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def list_oauth_templates(
|
|
107
|
+
connect_server: Union[RSConnectServer, SPCSConnectServer],
|
|
108
|
+
) -> list[OAuthTemplate]:
|
|
109
|
+
with RSConnectClient(connect_server) as client:
|
|
110
|
+
return client.oauth_template_list()
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def get_oauth_template(
|
|
114
|
+
connect_server: Union[RSConnectServer, SPCSConnectServer],
|
|
115
|
+
key: str,
|
|
116
|
+
) -> OAuthTemplate:
|
|
117
|
+
with RSConnectClient(connect_server) as client:
|
|
118
|
+
return client.oauth_template_get(key)
|