-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbootstrap-lk.py
More file actions
44 lines (38 loc) · 2.9 KB
/
bootstrap-lk.py
File metadata and controls
44 lines (38 loc) · 2.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import requests
def init_lk():
# boostrap
resp = requests.post(url='http://localhost:20001/management/v1/bootstrap', json={"accept-terms-of-use": True})
if resp.status_code not in [200, 400]:
resp.raise_for_status()
# create warehouse
resp = requests.post(url='http://localhost:20001/management/v1/warehouse', json={
"warehouse-name": "demo",
"project-id": "00000000-0000-0000-0000-000000000000",
"storage-profile": {
"type": "s3",
"bucket": "tmp",
"key-prefix": "initial-warehouse",
"assume-role-arn": None,
"endpoint": "http://localhost:9000",
"region": "us-east-1",
"path-style-access": True,
"flavor": "minio",
"sts-enabled": False
},
"storage-credential": {
"type": "s3",
"credential-type": "access-key",
"aws-access-key-id": "minioadmin",
"aws-secret-access-key": "minioadmin"
}
})
if resp.status_code not in [409, 200]:
resp.raise_for_status()
# add namespace
warehouse_prefix = requests.get("http://localhost:20001/catalog/v1/config?warehouse=demo").json()["defaults"]["prefix"]
ns_resp = requests.post(f"http://localhost:20001/catalog/v1/{warehouse_prefix}/namespaces", json={
"namespace": ["test"]
})
ns_resp.raise_for_status()
if __name__ == "__main__":
init_lk()