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"	
def main():

    #-----------------------------------------------
    #  Parse command line arguments
    #-----------------------------------------------
    ContainerID = sys.argv[1]
    IronBoxEmail = sys.argv[2]
    IronBoxPassword = sys.argv[3]
    InFile = sys.argv[4]
    IronBoxFileName = path.basename(InFile)

    #-----------------------------------------------
    #	Create an instance of the IronBox REST class
    #-----------------------------------------------
    IronBoxRESTObj = IronBoxRESTClient(IronBoxEmail,
                                       IronBoxPassword,
                                       version=IronBoxAPIVersion,
                                       verbose=True)

    #-----------------------------------------------
    #	Upload the file to IronBox
    #	Duplicate file names will automatically
    #	get renamed
    #-----------------------------------------------
    IronBoxRESTObj.UploadFileToContainer(ContainerID, InFile, IronBoxFileName)
Esempio n. 3
0
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.GetContainerBlobInfoListByState(ContainerID, BlobState)
    for item in result:
	print "%s -> %s" % (item[0],item[1]) 
def main():
    
    #----------------------------
    #	Create an instance of the IronBox REST class
    #----------------------------
    IronBoxRESTObj = IronBoxRESTClient(IronBoxEmail, IronBoxPassword, version=IronBoxAPIVersion, verbose=True)

    #----------------------------
    #	Upload the file to IronBox
    #	Duplicate file names will automatically
    #	get renamed
    #----------------------------
    IronBoxRESTObj.UploadFileToContainer(ContainerID, InFile, IronBoxFileName)
Esempio n. 5
0
def main():

    #----------------------------
    #	Create an instance of the IronBox REST class
    #----------------------------
    IronBoxRESTObj = IronBoxRESTClient(IronBoxEmail,
                                       IronBoxPassword,
                                       version=IronBoxAPIVersion,
                                       verbose=True)

    #----------------------------
    #	Get some public information about the context
    #----------------------------
    print "Company Name: %s" % IronBoxRESTObj.GetContextSetting(
        Context, "CompanyName")
    print "Company Logo URL: %s" % IronBoxRESTObj.GetContextSetting(
        Context, "CompanyLogoUrl")
def main():
    
    #----------------------------
    #	Create an instance of the IronBox REST class
    #----------------------------
    IronBoxRESTObj = IronBoxRESTClient(IronBoxEmail, IronBoxPassword, version=IronBoxAPIVersion, verbose=True)

    #----------------------------
    # Get all the files in the target directory
    #----------------------------
    dirFiles = [f for f in listdir(InDir) if isfile(join(InDir,f)) ]
    
    #----------------------------
    # Iterate the dirFiles array and upload each file
    #----------------------------
    for fileName in dirFiles:  
	currentFilePath = join(InDir,fileName)	
	IronBoxRESTObj.UploadFileToContainer(ContainerID, currentFilePath, fileName)
Esempio n. 7
0
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.GetContainerBlobInfoListByState(
        ContainerID, BlobState)
    for item in result:
        # Download and save the file locally
        DestFilePath = join(OutputDir, item[1])
        if IronBoxRESTObj.DownloadBlobFromContainer(ContainerID, item[0],
                                                    DestFilePath) is True:
            # Optionally you can delete the blob after download
            #IronBoxRESTObj.RemoveEntityContainerBlob(ContainerID,item[0])
            pass