tower 0.3.4__py3-none-linux_armv6l.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.
- tower/__init__.py +4 -0
- tower/__main__.py +38 -0
- tower/client.py +115 -0
- tower/tower_api_client/__init__.py +7 -0
- tower/tower_api_client/api/__init__.py +1 -0
- tower/tower_api_client/api/default/__init__.py +0 -0
- tower/tower_api_client/api/default/accept_invitation.py +150 -0
- tower/tower_api_client/api/default/cancel_run.py +159 -0
- tower/tower_api_client/api/default/claim_device_login_ticket.py +154 -0
- tower/tower_api_client/api/default/create_account.py +150 -0
- tower/tower_api_client/api/default/create_api_key.py +142 -0
- tower/tower_api_client/api/default/create_apps.py +150 -0
- tower/tower_api_client/api/default/create_device_login_ticket.py +131 -0
- tower/tower_api_client/api/default/create_secret.py +150 -0
- tower/tower_api_client/api/default/create_session.py +150 -0
- tower/tower_api_client/api/default/create_team.py +150 -0
- tower/tower_api_client/api/default/delete_api_key.py +142 -0
- tower/tower_api_client/api/default/delete_app.py +146 -0
- tower/tower_api_client/api/default/delete_secret.py +104 -0
- tower/tower_api_client/api/default/delete_team.py +150 -0
- tower/tower_api_client/api/default/delete_team_invitation.py +167 -0
- tower/tower_api_client/api/default/deploy_app.py +166 -0
- tower/tower_api_client/api/default/describe_app.py +165 -0
- tower/tower_api_client/api/default/describe_app_version.py +163 -0
- tower/tower_api_client/api/default/describe_device_login_session.py +154 -0
- tower/tower_api_client/api/default/describe_run.py +172 -0
- tower/tower_api_client/api/default/describe_secrets_key.py +160 -0
- tower/tower_api_client/api/default/describe_session.py +125 -0
- tower/tower_api_client/api/default/export_secrets.py +218 -0
- tower/tower_api_client/api/default/generate_app_statistics.py +129 -0
- tower/tower_api_client/api/default/generate_run_statistics.py +160 -0
- tower/tower_api_client/api/default/get_app_run_logs.py +159 -0
- tower/tower_api_client/api/default/invite_team_member.py +163 -0
- tower/tower_api_client/api/default/leave_team.py +150 -0
- tower/tower_api_client/api/default/list_api_keys.py +125 -0
- tower/tower_api_client/api/default/list_app_environments.py +150 -0
- tower/tower_api_client/api/default/list_app_versions.py +146 -0
- tower/tower_api_client/api/default/list_apps.py +247 -0
- tower/tower_api_client/api/default/list_my_team_invitations.py +129 -0
- tower/tower_api_client/api/default/list_runs.py +184 -0
- tower/tower_api_client/api/default/list_secret_environments.py +129 -0
- tower/tower_api_client/api/default/list_secrets.py +201 -0
- tower/tower_api_client/api/default/list_team_invitations.py +150 -0
- tower/tower_api_client/api/default/list_team_members.py +146 -0
- tower/tower_api_client/api/default/list_teams.py +125 -0
- tower/tower_api_client/api/default/refresh_session.py +129 -0
- tower/tower_api_client/api/default/remove_team_member.py +163 -0
- tower/tower_api_client/api/default/resend_team_invitation.py +167 -0
- tower/tower_api_client/api/default/run_app.py +176 -0
- tower/tower_api_client/api/default/stream_app_run_logs.py +100 -0
- tower/tower_api_client/api/default/update_account_slug.py +163 -0
- tower/tower_api_client/api/default/update_my_team_invitation.py +154 -0
- tower/tower_api_client/api/default/update_team.py +167 -0
- tower/tower_api_client/api/default/update_user.py +150 -0
- tower/tower_api_client/client.py +51 -0
- tower/tower_api_client/models/__init__.py +193 -0
- tower/tower_api_client/models/accept_invitation_params.py +49 -0
- tower/tower_api_client/models/accept_invitation_response.py +56 -0
- tower/tower_api_client/models/account.py +45 -0
- tower/tower_api_client/models/api_key.py +67 -0
- tower/tower_api_client/models/app.py +122 -0
- tower/tower_api_client/models/app_statistics.py +66 -0
- tower/tower_api_client/models/app_summary.py +81 -0
- tower/tower_api_client/models/app_version.py +71 -0
- tower/tower_api_client/models/cancel_run_response.py +56 -0
- tower/tower_api_client/models/claim_device_login_ticket_params.py +49 -0
- tower/tower_api_client/models/claim_device_login_ticket_response.py +49 -0
- tower/tower_api_client/models/create_account_params.py +91 -0
- tower/tower_api_client/models/create_account_params_flags_struct.py +38 -0
- tower/tower_api_client/models/create_account_response.py +56 -0
- tower/tower_api_client/models/create_api_key_params.py +49 -0
- tower/tower_api_client/models/create_api_key_response.py +56 -0
- tower/tower_api_client/models/create_app_params.py +57 -0
- tower/tower_api_client/models/create_app_response.py +56 -0
- tower/tower_api_client/models/create_device_login_ticket_response.py +94 -0
- tower/tower_api_client/models/create_secret_params.py +70 -0
- tower/tower_api_client/models/create_secret_response.py +56 -0
- tower/tower_api_client/models/create_session_params.py +56 -0
- tower/tower_api_client/models/create_session_response.py +56 -0
- tower/tower_api_client/models/create_team_params.py +56 -0
- tower/tower_api_client/models/create_team_response.py +56 -0
- tower/tower_api_client/models/delete_api_key_params.py +49 -0
- tower/tower_api_client/models/delete_api_key_response.py +56 -0
- tower/tower_api_client/models/delete_app_response.py +56 -0
- tower/tower_api_client/models/delete_team_invitation_params.py +49 -0
- tower/tower_api_client/models/delete_team_invitation_response.py +56 -0
- tower/tower_api_client/models/delete_team_params.py +49 -0
- tower/tower_api_client/models/delete_team_response.py +56 -0
- tower/tower_api_client/models/deploy_app_response.py +56 -0
- tower/tower_api_client/models/describe_app_response.py +75 -0
- tower/tower_api_client/models/describe_app_version_response.py +56 -0
- tower/tower_api_client/models/describe_device_login_session_response.py +56 -0
- tower/tower_api_client/models/describe_run_response.py +56 -0
- tower/tower_api_client/models/describe_secrets_key_response.py +49 -0
- tower/tower_api_client/models/describe_session_response.py +56 -0
- tower/tower_api_client/models/error_detail.py +54 -0
- tower/tower_api_client/models/error_model.py +109 -0
- tower/tower_api_client/models/export_secrets_response.py +75 -0
- tower/tower_api_client/models/export_user_secrets_params.py +49 -0
- tower/tower_api_client/models/exported_secret.py +62 -0
- tower/tower_api_client/models/generate_app_statistics_response.py +56 -0
- tower/tower_api_client/models/generate_run_statistics_response.py +85 -0
- tower/tower_api_client/models/get_run_log_line.py +47 -0
- tower/tower_api_client/models/get_run_logs_output_body.py +65 -0
- tower/tower_api_client/models/invite_team_member_params.py +58 -0
- tower/tower_api_client/models/invite_team_member_response.py +65 -0
- tower/tower_api_client/models/leave_team_response.py +56 -0
- tower/tower_api_client/models/list_api_keys_response.py +65 -0
- tower/tower_api_client/models/list_app_environments_response.py +50 -0
- tower/tower_api_client/models/list_app_versions_response.py +65 -0
- tower/tower_api_client/models/list_apps_response.py +75 -0
- tower/tower_api_client/models/list_apps_status_item.py +11 -0
- tower/tower_api_client/models/list_my_team_invitations_response.py +65 -0
- tower/tower_api_client/models/list_runs_response.py +75 -0
- tower/tower_api_client/models/list_secret_environments_response.py +50 -0
- tower/tower_api_client/models/list_secrets_response.py +75 -0
- tower/tower_api_client/models/list_team_invitations_response.py +65 -0
- tower/tower_api_client/models/list_team_members_response.py +65 -0
- tower/tower_api_client/models/list_teams_response.py +65 -0
- tower/tower_api_client/models/log_line.py +62 -0
- tower/tower_api_client/models/log_line_error.py +47 -0
- tower/tower_api_client/models/pagination.py +59 -0
- tower/tower_api_client/models/parameter.py +52 -0
- tower/tower_api_client/models/refresh_session_response.py +66 -0
- tower/tower_api_client/models/remove_team_member_params.py +49 -0
- tower/tower_api_client/models/remove_team_member_response.py +56 -0
- tower/tower_api_client/models/resend_team_invitation_params.py +57 -0
- tower/tower_api_client/models/resend_team_invitation_response.py +56 -0
- tower/tower_api_client/models/run.py +129 -0
- tower/tower_api_client/models/run_app_params.py +72 -0
- tower/tower_api_client/models/run_app_params_parameters.py +43 -0
- tower/tower_api_client/models/run_app_response.py +56 -0
- tower/tower_api_client/models/run_results.py +73 -0
- tower/tower_api_client/models/run_statistics.py +52 -0
- tower/tower_api_client/models/secret.py +62 -0
- tower/tower_api_client/models/series_point.py +52 -0
- tower/tower_api_client/models/session.py +73 -0
- tower/tower_api_client/models/statistics_settings.py +38 -0
- tower/tower_api_client/models/team.py +75 -0
- tower/tower_api_client/models/team_invitation.py +61 -0
- tower/tower_api_client/models/token.py +38 -0
- tower/tower_api_client/models/update_account_slug_params.py +49 -0
- tower/tower_api_client/models/update_account_slug_response.py +56 -0
- tower/tower_api_client/models/update_my_team_invitation_params.py +56 -0
- tower/tower_api_client/models/update_my_team_invitation_response.py +39 -0
- tower/tower_api_client/models/update_team_params.py +58 -0
- tower/tower_api_client/models/update_team_response.py +56 -0
- tower/tower_api_client/models/update_user_params.py +71 -0
- tower/tower_api_client/models/update_user_response.py +56 -0
- tower/tower_api_client/models/user.py +90 -0
- tower/tower_api_client/types.py +44 -0
- tower-0.3.4.data/scripts/tower +0 -0
- tower-0.3.4.dist-info/METADATA +115 -0
- tower-0.3.4.dist-info/RECORD +156 -0
- tower-0.3.4.dist-info/WHEEL +4 -0
- tower-0.3.4.dist-info/licenses/LICENSE +21 -0
tower/__init__.py
ADDED
tower/__main__.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import io
|
|
2
|
+
import sys
|
|
3
|
+
|
|
4
|
+
_CLEAN_GLOBALS = globals().copy()
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def run_program(filename):
|
|
8
|
+
ns = dict(
|
|
9
|
+
_CLEAN_GLOBALS,
|
|
10
|
+
# Make sure the __file__ variable is usable
|
|
11
|
+
# by the script we're profiling
|
|
12
|
+
__file__=filename,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
with io.open(filename, encoding="utf-8") as f:
|
|
16
|
+
exec(compile(f.read(), filename, "exec"), ns, ns)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def parse_args():
|
|
20
|
+
from argparse import REMAINDER, ArgumentParser
|
|
21
|
+
|
|
22
|
+
parser = ArgumentParser()
|
|
23
|
+
parser.add_argument(
|
|
24
|
+
"program",
|
|
25
|
+
nargs=REMAINDER,
|
|
26
|
+
help="python script or module followed by command line arguments to run",
|
|
27
|
+
)
|
|
28
|
+
return parser.parse_args()
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
if __name__ == "__main__":
|
|
32
|
+
args = parse_args()
|
|
33
|
+
|
|
34
|
+
if len(args.program) == 0:
|
|
35
|
+
print("A program to run must be provided. Use -h for help")
|
|
36
|
+
sys.exit(1)
|
|
37
|
+
|
|
38
|
+
run_program(args.program[0])
|
tower/client.py
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import time
|
|
3
|
+
from typing import Dict, Optional
|
|
4
|
+
|
|
5
|
+
from .tower_api_client import AuthenticatedClient
|
|
6
|
+
from .tower_api_client.api.default import describe_run as describe_run_api
|
|
7
|
+
from .tower_api_client.api.default import run_app as run_app_api
|
|
8
|
+
from .tower_api_client.models import (
|
|
9
|
+
DescribeRunResponse,
|
|
10
|
+
Run,
|
|
11
|
+
RunAppParams,
|
|
12
|
+
RunAppParamsParameters,
|
|
13
|
+
RunAppResponse,
|
|
14
|
+
)
|
|
15
|
+
from .tower_api_client.models.error_model import ErrorModel
|
|
16
|
+
|
|
17
|
+
# DEFAULT_TOWER_URL is the default tower URL to use when connecting back to
|
|
18
|
+
# Tower.
|
|
19
|
+
DEFAULT_TOWER_URL = "https://api.tower.dev"
|
|
20
|
+
|
|
21
|
+
# DEFAULT_TOWER_ENVIRONMENT is the default environment to use when running an
|
|
22
|
+
# app somewhere.
|
|
23
|
+
DEFAULT_TOWER_ENVIRONMENT = "default"
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _env_client() -> AuthenticatedClient:
|
|
27
|
+
api_key = os.getenv("TOWER_API_KEY")
|
|
28
|
+
tower_url = os.getenv("TOWER_URL", DEFAULT_TOWER_URL)
|
|
29
|
+
|
|
30
|
+
if not tower_url.endswith("/v1"):
|
|
31
|
+
if tower_url.endswith("/"):
|
|
32
|
+
tower_url += "v1"
|
|
33
|
+
else:
|
|
34
|
+
tower_url += "/v1"
|
|
35
|
+
|
|
36
|
+
return AuthenticatedClient(
|
|
37
|
+
verify_ssl=False,
|
|
38
|
+
base_url=tower_url,
|
|
39
|
+
token=api_key,
|
|
40
|
+
auth_header_name="X-API-Key",
|
|
41
|
+
prefix="",
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def run_app(
|
|
46
|
+
name: str,
|
|
47
|
+
environment: Optional[str] = None,
|
|
48
|
+
parameters: Optional[Dict[str, str]] = None,
|
|
49
|
+
) -> Run:
|
|
50
|
+
"""
|
|
51
|
+
`run_app` invokes an app based on the configured environment. You can
|
|
52
|
+
supply an optional `environment` override, and an optional dict
|
|
53
|
+
`parameters` to pass into the app.
|
|
54
|
+
"""
|
|
55
|
+
client = _env_client()
|
|
56
|
+
run_params = RunAppParamsParameters()
|
|
57
|
+
|
|
58
|
+
if not environment:
|
|
59
|
+
environment = os.getenv("TOWER_ENVIRONMENT", DEFAULT_TOWER_ENVIRONMENT)
|
|
60
|
+
|
|
61
|
+
if parameters:
|
|
62
|
+
run_params = RunAppParamsParameters.from_dict(parameters)
|
|
63
|
+
|
|
64
|
+
input_body = RunAppParams(
|
|
65
|
+
environment=environment,
|
|
66
|
+
parameters=run_params,
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
output: Optional[Union[ErrorModel, RunAppResponse]] = run_app_api.sync(
|
|
70
|
+
name=name, client=client, json_body=input_body
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
if output is None:
|
|
74
|
+
raise RuntimeError("Error running app")
|
|
75
|
+
else:
|
|
76
|
+
if isinstance(output, ErrorModel):
|
|
77
|
+
raise RuntimeError(f"Error running app: {output.title}")
|
|
78
|
+
else:
|
|
79
|
+
return output.run
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def wait_for_run(run: Run) -> None:
|
|
83
|
+
"""
|
|
84
|
+
`wait_for_run` waits for a run to reach a terminal state by polling the
|
|
85
|
+
Tower API every 2 seconds for the latest status. If the app returns a
|
|
86
|
+
terminal status (`exited`, `errored`, `cancelled`, or `crashed`) then this
|
|
87
|
+
function returns.
|
|
88
|
+
"""
|
|
89
|
+
client = _env_client()
|
|
90
|
+
|
|
91
|
+
while True:
|
|
92
|
+
output: Optional[Union[DescribeRunResponse, ErrorModel]] = describe_run_api.sync(
|
|
93
|
+
name=run.app_name,
|
|
94
|
+
seq=run.number,
|
|
95
|
+
client=client
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
if output is None:
|
|
99
|
+
raise RuntimeError("Error fetching run")
|
|
100
|
+
else:
|
|
101
|
+
if isinstance(output, ErrorModel):
|
|
102
|
+
raise RuntimeError(f"Error fetching run: {output.title}")
|
|
103
|
+
else:
|
|
104
|
+
desc = output.run
|
|
105
|
+
|
|
106
|
+
if desc.status == "exited":
|
|
107
|
+
return
|
|
108
|
+
elif desc.status == "failed":
|
|
109
|
+
return
|
|
110
|
+
elif desc.status == "canceled":
|
|
111
|
+
return
|
|
112
|
+
elif desc.status == "errored":
|
|
113
|
+
return
|
|
114
|
+
else:
|
|
115
|
+
time.sleep(2)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
""" Contains methods for accessing the API """
|
|
File without changes
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Dict, Optional
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ...client import AuthenticatedClient
|
|
7
|
+
from ...models.accept_invitation_params import AcceptInvitationParams
|
|
8
|
+
from ...models.accept_invitation_response import AcceptInvitationResponse
|
|
9
|
+
from ...types import Response
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _get_kwargs(
|
|
13
|
+
*,
|
|
14
|
+
client: AuthenticatedClient,
|
|
15
|
+
json_body: AcceptInvitationParams,
|
|
16
|
+
) -> Dict[str, Any]:
|
|
17
|
+
url = "{}/accounts/invite".format(client.base_url)
|
|
18
|
+
|
|
19
|
+
headers: Dict[str, str] = client.get_headers()
|
|
20
|
+
cookies: Dict[str, Any] = client.get_cookies()
|
|
21
|
+
|
|
22
|
+
json_json_body = json_body.to_dict()
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
"method": "post",
|
|
26
|
+
"url": url,
|
|
27
|
+
"headers": headers,
|
|
28
|
+
"cookies": cookies,
|
|
29
|
+
"timeout": client.get_timeout(),
|
|
30
|
+
"json": json_json_body,
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _parse_response(*, response: httpx.Response) -> Optional[AcceptInvitationResponse]:
|
|
35
|
+
if response.status_code == 200:
|
|
36
|
+
response_200 = AcceptInvitationResponse.from_dict(response.json())
|
|
37
|
+
|
|
38
|
+
return response_200
|
|
39
|
+
return None
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def _build_response(*, response: httpx.Response) -> Response[AcceptInvitationResponse]:
|
|
43
|
+
return Response(
|
|
44
|
+
status_code=HTTPStatus(response.status_code),
|
|
45
|
+
content=response.content,
|
|
46
|
+
headers=response.headers,
|
|
47
|
+
parsed=_parse_response(response=response),
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def sync_detailed(
|
|
52
|
+
*,
|
|
53
|
+
client: AuthenticatedClient,
|
|
54
|
+
json_body: AcceptInvitationParams,
|
|
55
|
+
) -> Response[AcceptInvitationResponse]:
|
|
56
|
+
"""Accept an invitation code
|
|
57
|
+
|
|
58
|
+
Accept an invitation code to join an account
|
|
59
|
+
|
|
60
|
+
Args:
|
|
61
|
+
json_body (AcceptInvitationParams):
|
|
62
|
+
|
|
63
|
+
Returns:
|
|
64
|
+
Response[AcceptInvitationResponse]
|
|
65
|
+
"""
|
|
66
|
+
|
|
67
|
+
kwargs = _get_kwargs(
|
|
68
|
+
client=client,
|
|
69
|
+
json_body=json_body,
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
response = httpx.request(
|
|
73
|
+
verify=client.verify_ssl,
|
|
74
|
+
**kwargs,
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
return _build_response(response=response)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def sync(
|
|
81
|
+
*,
|
|
82
|
+
client: AuthenticatedClient,
|
|
83
|
+
json_body: AcceptInvitationParams,
|
|
84
|
+
) -> Optional[AcceptInvitationResponse]:
|
|
85
|
+
"""Accept an invitation code
|
|
86
|
+
|
|
87
|
+
Accept an invitation code to join an account
|
|
88
|
+
|
|
89
|
+
Args:
|
|
90
|
+
json_body (AcceptInvitationParams):
|
|
91
|
+
|
|
92
|
+
Returns:
|
|
93
|
+
Response[AcceptInvitationResponse]
|
|
94
|
+
"""
|
|
95
|
+
|
|
96
|
+
return sync_detailed(
|
|
97
|
+
client=client,
|
|
98
|
+
json_body=json_body,
|
|
99
|
+
).parsed
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
async def asyncio_detailed(
|
|
103
|
+
*,
|
|
104
|
+
client: AuthenticatedClient,
|
|
105
|
+
json_body: AcceptInvitationParams,
|
|
106
|
+
) -> Response[AcceptInvitationResponse]:
|
|
107
|
+
"""Accept an invitation code
|
|
108
|
+
|
|
109
|
+
Accept an invitation code to join an account
|
|
110
|
+
|
|
111
|
+
Args:
|
|
112
|
+
json_body (AcceptInvitationParams):
|
|
113
|
+
|
|
114
|
+
Returns:
|
|
115
|
+
Response[AcceptInvitationResponse]
|
|
116
|
+
"""
|
|
117
|
+
|
|
118
|
+
kwargs = _get_kwargs(
|
|
119
|
+
client=client,
|
|
120
|
+
json_body=json_body,
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
|
124
|
+
response = await _client.request(**kwargs)
|
|
125
|
+
|
|
126
|
+
return _build_response(response=response)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
async def asyncio(
|
|
130
|
+
*,
|
|
131
|
+
client: AuthenticatedClient,
|
|
132
|
+
json_body: AcceptInvitationParams,
|
|
133
|
+
) -> Optional[AcceptInvitationResponse]:
|
|
134
|
+
"""Accept an invitation code
|
|
135
|
+
|
|
136
|
+
Accept an invitation code to join an account
|
|
137
|
+
|
|
138
|
+
Args:
|
|
139
|
+
json_body (AcceptInvitationParams):
|
|
140
|
+
|
|
141
|
+
Returns:
|
|
142
|
+
Response[AcceptInvitationResponse]
|
|
143
|
+
"""
|
|
144
|
+
|
|
145
|
+
return (
|
|
146
|
+
await asyncio_detailed(
|
|
147
|
+
client=client,
|
|
148
|
+
json_body=json_body,
|
|
149
|
+
)
|
|
150
|
+
).parsed
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Dict, Optional
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ...client import AuthenticatedClient
|
|
7
|
+
from ...models.cancel_run_response import CancelRunResponse
|
|
8
|
+
from ...types import Response
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def _get_kwargs(
|
|
12
|
+
name: str,
|
|
13
|
+
seq: int,
|
|
14
|
+
*,
|
|
15
|
+
client: AuthenticatedClient,
|
|
16
|
+
) -> Dict[str, Any]:
|
|
17
|
+
url = "{}/apps/{name}/runs/{seq}".format(client.base_url, name=name, seq=seq)
|
|
18
|
+
|
|
19
|
+
headers: Dict[str, str] = client.get_headers()
|
|
20
|
+
cookies: Dict[str, Any] = client.get_cookies()
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
"method": "post",
|
|
24
|
+
"url": url,
|
|
25
|
+
"headers": headers,
|
|
26
|
+
"cookies": cookies,
|
|
27
|
+
"timeout": client.get_timeout(),
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _parse_response(*, response: httpx.Response) -> Optional[CancelRunResponse]:
|
|
32
|
+
if response.status_code == 200:
|
|
33
|
+
response_200 = CancelRunResponse.from_dict(response.json())
|
|
34
|
+
|
|
35
|
+
return response_200
|
|
36
|
+
return None
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def _build_response(*, response: httpx.Response) -> Response[CancelRunResponse]:
|
|
40
|
+
return Response(
|
|
41
|
+
status_code=HTTPStatus(response.status_code),
|
|
42
|
+
content=response.content,
|
|
43
|
+
headers=response.headers,
|
|
44
|
+
parsed=_parse_response(response=response),
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def sync_detailed(
|
|
49
|
+
name: str,
|
|
50
|
+
seq: int,
|
|
51
|
+
*,
|
|
52
|
+
client: AuthenticatedClient,
|
|
53
|
+
) -> Response[CancelRunResponse]:
|
|
54
|
+
"""Cancel run
|
|
55
|
+
|
|
56
|
+
Cancel a run
|
|
57
|
+
|
|
58
|
+
Args:
|
|
59
|
+
name (str): The name of the app to fetch runs for.
|
|
60
|
+
seq (int): The number of the run to fetch.
|
|
61
|
+
|
|
62
|
+
Returns:
|
|
63
|
+
Response[CancelRunResponse]
|
|
64
|
+
"""
|
|
65
|
+
|
|
66
|
+
kwargs = _get_kwargs(
|
|
67
|
+
name=name,
|
|
68
|
+
seq=seq,
|
|
69
|
+
client=client,
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
response = httpx.request(
|
|
73
|
+
verify=client.verify_ssl,
|
|
74
|
+
**kwargs,
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
return _build_response(response=response)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def sync(
|
|
81
|
+
name: str,
|
|
82
|
+
seq: int,
|
|
83
|
+
*,
|
|
84
|
+
client: AuthenticatedClient,
|
|
85
|
+
) -> Optional[CancelRunResponse]:
|
|
86
|
+
"""Cancel run
|
|
87
|
+
|
|
88
|
+
Cancel a run
|
|
89
|
+
|
|
90
|
+
Args:
|
|
91
|
+
name (str): The name of the app to fetch runs for.
|
|
92
|
+
seq (int): The number of the run to fetch.
|
|
93
|
+
|
|
94
|
+
Returns:
|
|
95
|
+
Response[CancelRunResponse]
|
|
96
|
+
"""
|
|
97
|
+
|
|
98
|
+
return sync_detailed(
|
|
99
|
+
name=name,
|
|
100
|
+
seq=seq,
|
|
101
|
+
client=client,
|
|
102
|
+
).parsed
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
async def asyncio_detailed(
|
|
106
|
+
name: str,
|
|
107
|
+
seq: int,
|
|
108
|
+
*,
|
|
109
|
+
client: AuthenticatedClient,
|
|
110
|
+
) -> Response[CancelRunResponse]:
|
|
111
|
+
"""Cancel run
|
|
112
|
+
|
|
113
|
+
Cancel a run
|
|
114
|
+
|
|
115
|
+
Args:
|
|
116
|
+
name (str): The name of the app to fetch runs for.
|
|
117
|
+
seq (int): The number of the run to fetch.
|
|
118
|
+
|
|
119
|
+
Returns:
|
|
120
|
+
Response[CancelRunResponse]
|
|
121
|
+
"""
|
|
122
|
+
|
|
123
|
+
kwargs = _get_kwargs(
|
|
124
|
+
name=name,
|
|
125
|
+
seq=seq,
|
|
126
|
+
client=client,
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
|
130
|
+
response = await _client.request(**kwargs)
|
|
131
|
+
|
|
132
|
+
return _build_response(response=response)
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
async def asyncio(
|
|
136
|
+
name: str,
|
|
137
|
+
seq: int,
|
|
138
|
+
*,
|
|
139
|
+
client: AuthenticatedClient,
|
|
140
|
+
) -> Optional[CancelRunResponse]:
|
|
141
|
+
"""Cancel run
|
|
142
|
+
|
|
143
|
+
Cancel a run
|
|
144
|
+
|
|
145
|
+
Args:
|
|
146
|
+
name (str): The name of the app to fetch runs for.
|
|
147
|
+
seq (int): The number of the run to fetch.
|
|
148
|
+
|
|
149
|
+
Returns:
|
|
150
|
+
Response[CancelRunResponse]
|
|
151
|
+
"""
|
|
152
|
+
|
|
153
|
+
return (
|
|
154
|
+
await asyncio_detailed(
|
|
155
|
+
name=name,
|
|
156
|
+
seq=seq,
|
|
157
|
+
client=client,
|
|
158
|
+
)
|
|
159
|
+
).parsed
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Dict, Optional
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ...client import AuthenticatedClient
|
|
7
|
+
from ...models.claim_device_login_ticket_params import ClaimDeviceLoginTicketParams
|
|
8
|
+
from ...models.claim_device_login_ticket_response import ClaimDeviceLoginTicketResponse
|
|
9
|
+
from ...types import Response
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _get_kwargs(
|
|
13
|
+
*,
|
|
14
|
+
client: AuthenticatedClient,
|
|
15
|
+
json_body: ClaimDeviceLoginTicketParams,
|
|
16
|
+
) -> Dict[str, Any]:
|
|
17
|
+
url = "{}/login/device/claim".format(client.base_url)
|
|
18
|
+
|
|
19
|
+
headers: Dict[str, str] = client.get_headers()
|
|
20
|
+
cookies: Dict[str, Any] = client.get_cookies()
|
|
21
|
+
|
|
22
|
+
json_json_body = json_body.to_dict()
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
"method": "post",
|
|
26
|
+
"url": url,
|
|
27
|
+
"headers": headers,
|
|
28
|
+
"cookies": cookies,
|
|
29
|
+
"timeout": client.get_timeout(),
|
|
30
|
+
"json": json_json_body,
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _parse_response(
|
|
35
|
+
*, response: httpx.Response
|
|
36
|
+
) -> Optional[ClaimDeviceLoginTicketResponse]:
|
|
37
|
+
if response.status_code == 200:
|
|
38
|
+
response_200 = ClaimDeviceLoginTicketResponse.from_dict(response.json())
|
|
39
|
+
|
|
40
|
+
return response_200
|
|
41
|
+
return None
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _build_response(
|
|
45
|
+
*, response: httpx.Response
|
|
46
|
+
) -> Response[ClaimDeviceLoginTicketResponse]:
|
|
47
|
+
return Response(
|
|
48
|
+
status_code=HTTPStatus(response.status_code),
|
|
49
|
+
content=response.content,
|
|
50
|
+
headers=response.headers,
|
|
51
|
+
parsed=_parse_response(response=response),
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def sync_detailed(
|
|
56
|
+
*,
|
|
57
|
+
client: AuthenticatedClient,
|
|
58
|
+
json_body: ClaimDeviceLoginTicketParams,
|
|
59
|
+
) -> Response[ClaimDeviceLoginTicketResponse]:
|
|
60
|
+
"""Claim a device login ticket
|
|
61
|
+
|
|
62
|
+
Claims a device login ticket code for the authenticated user.
|
|
63
|
+
|
|
64
|
+
Args:
|
|
65
|
+
json_body (ClaimDeviceLoginTicketParams):
|
|
66
|
+
|
|
67
|
+
Returns:
|
|
68
|
+
Response[ClaimDeviceLoginTicketResponse]
|
|
69
|
+
"""
|
|
70
|
+
|
|
71
|
+
kwargs = _get_kwargs(
|
|
72
|
+
client=client,
|
|
73
|
+
json_body=json_body,
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
response = httpx.request(
|
|
77
|
+
verify=client.verify_ssl,
|
|
78
|
+
**kwargs,
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
return _build_response(response=response)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def sync(
|
|
85
|
+
*,
|
|
86
|
+
client: AuthenticatedClient,
|
|
87
|
+
json_body: ClaimDeviceLoginTicketParams,
|
|
88
|
+
) -> Optional[ClaimDeviceLoginTicketResponse]:
|
|
89
|
+
"""Claim a device login ticket
|
|
90
|
+
|
|
91
|
+
Claims a device login ticket code for the authenticated user.
|
|
92
|
+
|
|
93
|
+
Args:
|
|
94
|
+
json_body (ClaimDeviceLoginTicketParams):
|
|
95
|
+
|
|
96
|
+
Returns:
|
|
97
|
+
Response[ClaimDeviceLoginTicketResponse]
|
|
98
|
+
"""
|
|
99
|
+
|
|
100
|
+
return sync_detailed(
|
|
101
|
+
client=client,
|
|
102
|
+
json_body=json_body,
|
|
103
|
+
).parsed
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
async def asyncio_detailed(
|
|
107
|
+
*,
|
|
108
|
+
client: AuthenticatedClient,
|
|
109
|
+
json_body: ClaimDeviceLoginTicketParams,
|
|
110
|
+
) -> Response[ClaimDeviceLoginTicketResponse]:
|
|
111
|
+
"""Claim a device login ticket
|
|
112
|
+
|
|
113
|
+
Claims a device login ticket code for the authenticated user.
|
|
114
|
+
|
|
115
|
+
Args:
|
|
116
|
+
json_body (ClaimDeviceLoginTicketParams):
|
|
117
|
+
|
|
118
|
+
Returns:
|
|
119
|
+
Response[ClaimDeviceLoginTicketResponse]
|
|
120
|
+
"""
|
|
121
|
+
|
|
122
|
+
kwargs = _get_kwargs(
|
|
123
|
+
client=client,
|
|
124
|
+
json_body=json_body,
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
|
128
|
+
response = await _client.request(**kwargs)
|
|
129
|
+
|
|
130
|
+
return _build_response(response=response)
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
async def asyncio(
|
|
134
|
+
*,
|
|
135
|
+
client: AuthenticatedClient,
|
|
136
|
+
json_body: ClaimDeviceLoginTicketParams,
|
|
137
|
+
) -> Optional[ClaimDeviceLoginTicketResponse]:
|
|
138
|
+
"""Claim a device login ticket
|
|
139
|
+
|
|
140
|
+
Claims a device login ticket code for the authenticated user.
|
|
141
|
+
|
|
142
|
+
Args:
|
|
143
|
+
json_body (ClaimDeviceLoginTicketParams):
|
|
144
|
+
|
|
145
|
+
Returns:
|
|
146
|
+
Response[ClaimDeviceLoginTicketResponse]
|
|
147
|
+
"""
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
await asyncio_detailed(
|
|
151
|
+
client=client,
|
|
152
|
+
json_body=json_body,
|
|
153
|
+
)
|
|
154
|
+
).parsed
|