forked from IronBox/ironbox-client-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
IronBoxGetContextContainers.py
57 lines (41 loc) · 1.56 KB
/
IronBoxGetContextContainers.py
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
45
46
47
48
49
50
51
52
53
54
55
56
57
"""
Demonstrates how to get the containers that
an entity has access to in a context.
A context simply refers to an IronBox instance
or server that an entity logs into. For example,
an entity might log into the following:
Context1: secure.goironcloud.com
Context2: test.goironcloud.com
This demo shows you how to the retrieve the
IronBox containers that the entity has access to
in each of the individual contexts
Written by KevinLam@goironbox.com
Website: www.goironbox.com
Usage:
python IronBoxGetContextContainers.py
"""
from IronBoxREST import IronBoxRESTClient
# ---------------------------------------------------
# Your IronBox authentication parameters, you could
# also pass these in as command arguments
# ---------------------------------------------------
ironbox_email = "email@email.com"
ironbox_pwd = "password123"
ironbox_api_url = "https://api.goironcloud.com/latest/"
ironbox_api_version = "latest"
# This is the server you log into, minus the "https://"
context = "secure.goironcloud.com"
# Always use '5' which refers to AES-256 secure file
# transfer containers
container_type = 5
def main():
IronBoxRESTObj = IronBoxRESTClient(
ironbox_email, ironbox_pwd, version=ironbox_api_version, verbose=True
)
# Get all the blobs in a ready state, result is a tuple list
# where 0 = blob ID and 1 = blob name
result = IronBoxRESTObj.GetContainerInfoListByContext(context, container_type)
for item in result:
print(f"{item[0]} -> {item[1]}")
if __name__ == "__main__":
main()