-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathIronBoxCreateRemoveSFTContainer.py
62 lines (53 loc) · 2.24 KB
/
IronBoxCreateRemoveSFTContainer.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
62
#!/usr/bin/python
#---------------------------------------------------
#
# Demonstrates how to create and remove an IronBox
# secure file transfer container
#
# Written by [email protected]
# Website: www.goironbox.com
#
#---------------------------------------------------
from IronBoxREST import IronBoxRESTClient
from IronBoxREST import IronBoxSFTContainerConfig
#---------------------------------------------------
# Your IronBox authentication parameters, you could
# also pass these in as command arguments
#---------------------------------------------------
IronBoxEmail = "[email protected]"
IronBoxPassword = "password123"
IronBoxAPIVersion = "latest"
# Default context, otherwise use your IronBox context
# instance, i.e., your_company.goironcloud.com
Context = "secure.goironcloud.com"
#---------------------------------------------------
# Main
#---------------------------------------------------
def main():
#--------------------------------------------------
# Create an instance of the IronBox REST class
#--------------------------------------------------
IronBoxRESTObj = IronBoxRESTClient(IronBoxEmail, IronBoxPassword, version=IronBoxAPIVersion, verbose=True)
#--------------------------------------------------
# Create the container, duplicate container names
# are supported
#--------------------------------------------------
ContainerConfig = IronBoxSFTContainerConfig()
ContainerConfig.Name = "New container name"
ContainerConfig.Description = "Description of the new container (optional)"
ResultContainerConfig = IronBoxRESTObj.CreateEntitySFTContainer(Context, ContainerConfig)
if ResultContainerConfig is None:
print "Unable to create container"
return
print "New container created with ID=%s" % ResultContainerConfig.ContainerID
#--------------------------------------------------
# Remove the container
#--------------------------------------------------
if IronBoxRESTObj.RemoveEntityContainer(ResultContainerConfig.ContainerID) is False:
print "Unable to remove container"
return
print "New container was successfully removed"
#---------------------------------------------------
import string, datetime
if __name__ == "__main__":
main()