-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathIronBoxGetContextContainers.py
61 lines (54 loc) · 1.97 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
58
59
60
61
#!/usr/bin/python
#---------------------------------------------------
#
# 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 [email protected]
# 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
#---------------------------------------------------
IronBoxEmail = "[email protected]"
IronBoxPassword = "password123"
IronBoxAPIServerURL = "https://api.goironcloud.com/latest/"
IronBoxAPIVersion = "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
ContainerType = 5
#---------------------------------------------------
# Main
#---------------------------------------------------
def main():
#----------------------------
# Create an instance of the IronBox REST class
#----------------------------
IronBoxRESTObj = IronBoxRESTClient(IronBoxEmail, IronBoxPassword, version=IronBoxAPIVersion, 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, ContainerType)
for item in result:
print "%s -> %s" % (item[0],item[1])
#---------------------------------------------------
if __name__ == "__main__":
main()