personal-cloud-client 0.0.1__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.
|
File without changes
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import requests
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def deploy_app(args):
|
|
6
|
+
with open(args.image, "rb") as f:
|
|
7
|
+
headers = {"Access-Token": args.token}
|
|
8
|
+
|
|
9
|
+
response = requests.post(
|
|
10
|
+
f"{args.host}/app/deploy",
|
|
11
|
+
files={"image": f},
|
|
12
|
+
data={ "name": args.name },
|
|
13
|
+
headers=headers
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
print(f"[{response.status_code}] {response.text}")
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def main():
|
|
20
|
+
parser = argparse.ArgumentParser(description="Personal Cloud Client")
|
|
21
|
+
parser.add_argument("--host", default="http://localhost:3000", help="Server URL")
|
|
22
|
+
parser.add_argument("--token", required=True, help="Auth token")
|
|
23
|
+
|
|
24
|
+
subparsers = parser.add_subparsers(dest="command", required=True)
|
|
25
|
+
|
|
26
|
+
# Command: deploy
|
|
27
|
+
deploy_parser = subparsers.add_parser("deploy", help="Deploy the application's docker image")
|
|
28
|
+
deploy_parser.add_argument("--name", required=True, help="App name")
|
|
29
|
+
deploy_parser.add_argument("--image", required=True, help="App image path")
|
|
30
|
+
deploy_parser.set_defaults(func=deploy_app)
|
|
31
|
+
|
|
32
|
+
# Execute command
|
|
33
|
+
args = parser.parse_args()
|
|
34
|
+
args.func(args)
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
personal_cloud_client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
personal_cloud_client/cli.py,sha256=23aHG0ylIh31wfpOyuUk4wYS9RLbT1YQPvqml1sAwm8,1091
|
|
3
|
+
personal_cloud_client-0.0.1.dist-info/METADATA,sha256=FusV-ZXmhczqY5P1xoHTI8IYiMFFLVT1WqKa_ozOaNQ,182
|
|
4
|
+
personal_cloud_client-0.0.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
5
|
+
personal_cloud_client-0.0.1.dist-info/RECORD,,
|