Exemple #1
0
def submit(syncselection_name, now=True, as_object=False, p5_connection=None):
    """
    Syntax: SyncSelection <name> submit [<now>]
    Description: Submits the sync selection for execution. You can optionally
    override plan execution times by giving the <now> as one of the strings
    "1", "t", "true", "True", "y", "yes", or "Yes".
    This command implicitly destroys the SyncSelection object for the user and
    transfers the ownership of the internal underlying object to the job
    scheduler. You should not attempt to use the <name> afterwards.
    Return Values:
    -On Success:    the sync job ID. Use this job ID to query the
                    status of the job by using Job resource.
                    Please see the Job resource description for details.
    """
    method_name = "submit"
    now_option = ""
    if now is True:
        now_option = "1"
    result = exec_nsdchat(
        [module_name, syncselection_name, method_name, now_option],
        p5_connection)
    if not as_object:
        return result
    else:
        return resourcelist(result, Job, p5_connection)
 def adddirectoryabs(self, path, key_value_list=None, as_object=True):
     """
     Syntax: ArchiveSelection <name> adddirectoryabs <path>
             [<key> <value> [<key> <value>].. ]
     Description: Adds a new directory <path> to the archive selection
     <name>. It expects the absolute path to the directory to be archived.
     The directory must be located on the client <client> given at the
     resource creation time (see the create method).
     The directory path will be added 1:1 into the index. Any prefixes and
     alternative index destinations are ignored.
     Note that this method will only add the directory node to the archive
     selection and that only a directory node itself will be archived. If
     you want to archive both the directory and its contents recursively,
     use the ArchiveSelection addentry method.
     See the addentry method description for explanation of other method
     arguments.
     Return Values:
     -On Success:    see the addentry method for return values
     """
     method_name = "adddirectoryabs"
     result = self.p5_connection.nsdchat_call(
         [module_name, self.name, method_name, path, key_value_list])
     if not as_object:
         return result
     else:
         return resourcelist(result, ArchiveEntry, self.p5_connection)
 def create(client, relocate=None, as_object=True, p5_connection=None):
     """
     Syntax: RestoreSelection create <client> [<relocate>]
     Description: Creates a new temporary restore selection resource. The
     resource will be automatically deleted after the associated archive job
     has been submitted.
     The <client> must be one of the registered client computers on the
     current P5 server. Restored files will be placed on the named client.
     You can get the list of client computers with the Client names CLI
     command.
     The <relocate> overrides default restore location. If this option is
     given, it must point to a directory on the <client> file system. All
     files will be placed in this directory instead of their original
     location. The <relocate> directory must exist on the client.
     Return Values:
     -On Success:    the name of the new resource. Use this name to
                     address the resource in all other methods.
     """
     method_name = "create"
     result = exec_nsdchat([module_name, method_name, client, relocate],
                           p5_connection)
     if not as_object:
         return result
     else:
         return resourcelist(result, RestoreSelection, p5_connection)
 def create(client,
            plan,
            indexroot=None,
            as_object=True,
            p5_connection=None):
     """
     Syntax: ArchiveSelection create <client> <plan> [<indexroot>]
     Description: Creates a new temporary archive selection resource. The
     resource will be automatically deleted after the associated archive job
     has been submitted.
     The <client> must be the one of the registered client computers on the
     current P5 server. You can get the list of client computers with the
     Client names CLI command. All files added with the addentry method
     (below) must reside on this client.
     The <plan> must be one of the registered archive plans. You can get the
     list of archive plans with the ArchivePlan names CLI command.
     The optional <indexroot> argument, if given, will force all files in
     the archive selection to be indexed under the <indexroot> path.
     Return Values:
     -On Success:    the name of the new resource. Use this name to
                     address this resource in all other methods.
     """
     method_name = "create"
     result = exec_nsdchat(
         [module_name, method_name, client, plan, indexroot], p5_connection)
     if not as_object:
         return result
     else:
         return resourcelist(result, ArchiveSelection, p5_connection)
 def addentryabs(self, path, key_value_list=None, as_object=True):
     """
     Syntax: ArchiveSelection <name> addentryabs <path>
             [<key> <value> [<key> <value>].. ]
     Description: Adds one new <path> to the archive selection <name>. It
     expects the absolute path to the file or directory to be archived. The
     file or directory must be located on the client <client> given at the
     resource creation time (see the create method).
     The entry path will be added 1:1 into the index. Any prefixes and
     alternative index destinations are ignored.
     If the passed <path> contains blanks, be sure to enclose it in curly
     braces: {/some/path with blanks/file}. Furthermore, if the <path>
     contains { and/or } chars themselves, you must escape them with a
     backslash '\' character.
     To each path, you can assign an arbitrary number of <key> and <value>
     pairs. Those are saved in the archive index and can be used for
     searches during restore (see RestoreSelection).
     Each key allows a string value of unlimited length. If the value
     contains blanks, it should be enclosed in curly braces. If the value
     itself contains curly braces, you must escape them with '\' character.
     Return Values:
     -On Success:    the name of the new ArchiveEntry resource.
                     This name must be used with ArchiveEntry methods
                     to get the status and other meta-information of the
                     entry after the archive operation has been completed.
                     Please see the ArchiveEntry resource description
     """
     method_name = "addentryabs"
     result = self.p5_connection.nsdchat_call(
         [module_name, self.name, method_name, path, key_value_list])
     if not as_object:
         return result
     else:
         return resourcelist(result, ArchiveEntry, self.p5_connection)
def addfileabs(archiveselection_name,
               path,
               key_value_list=None,
               as_object=False,
               p5_connection=None):
    """
    Syntax: ArchiveSelection <name> addfileabs <path>
            [<key> <value> [<key> <value>].. ]
    Description: Adds a new file <path> to the archive selection <name>. It
    expects the absolute path to the file to be archived. The file must be
    located on the client <client> given at the resource creation time (see the
    create method).
    The directory path will be added 1:1 into the index. Any prefixes and
    alternative index destinations are ignored.
    See the addentry method description for explanation of other method
    arguments.
    Return Values:
    -On Success:    see the addentry method for return values
    """
    method_name = "addfileabs"
    result = exec_nsdchat([
        module_name, archiveselection_name, method_name, path, key_value_list
    ], p5_connection)
    if not as_object:
        return result
    else:
        return resourcelist(result, ArchiveEntry, p5_connection)
def adddirectory(archiveselection_name,
                 path,
                 key_value_list=None,
                 as_object=False,
                 p5_connection=None):
    """
    Syntax: ArchiveSelection <name> adddirectory <path>
            [<key> <value> [<key> <value>].. ]
    Description: Adds a new directory <path> to the archive selection <name>.
    It expects the absolute path to the directory to be archived. The directory
    must be located on the client <client> given at the resource creation time
    (see the create method).
    The path will be stripped of the leading directory part and the name will
    be inserted into the index at the indexroot destination as defined in
    create.
    Note that this method will only add the directory node to the archive
    selection and that only a directory node itself will be archived. If you
    want to archive both the directory and its contents recursively, use the
    ArchiveSelection addentry method.
    See the addentry method description for explanation of other method
    arguments.
    Return Values:
    -On Success:    see the addentry description for return values
    """
    method_name = "adddirectory"
    result = exec_nsdchat([
        module_name, archiveselection_name, method_name, path, key_value_list
    ], p5_connection)
    if not as_object:
        return result
    else:
        return resourcelist(result, ArchiveEntry, p5_connection)
 def submit(self, now=True, as_object=True):
     """
     Syntax: BackupPlan <name> submit [<now>]
     Description: Submits the backup plan for execution. You can optionally
     override plan execution times by using the verbatim string now or the
     integer value zero for the <now> argument.
     The returned job ID can be used to query the status of the job by using
     the Job resource. Please see the Job resource description for more
     details.
     Note: In order to run a backup plan, a backup event must be selected.
     The start method implicitly selects the next planned backup event to
     start the backup plan.
     Return Values:
     -On Success:    the backup job ID
     """
     method_name = "submit"
     now_option = ""
     if now is True:
         now_option = "now"
     result = self.p5_connection.nsdchat_call(
         [module_name, self.name, method_name, now_option])
     if not as_object:
         return result
     else:
         return resourcelist(result, Job, self.p5_connection)
Exemple #9
0
 def submit(self, now=True, as_object=True):
     """
     Syntax: SyncPlan <name> submit [<now>]
     Description: Submits the sync plan for execution. You can optionally
     override plan execution times by using the verbatim string now or the
     integer value zero for the <now> argument.
     Plan must be configured for auto-start since CLI just overrides the
     scheduled starting time. This command cannot be used to start a plan
     which is not set to auto-start or which does not have any events
     configured.
     Return Values:
     -On Success:    the sync job ID. Use this job ID to query the
                     status of the job by using Job resource.
                     Please see the Job Resource description for details.
     """
     method_name = "submit"
     now_option = ""
     if now is True:
         now_option = "now"
     result = self.p5_connection.nsdchat_call(
         [module_name, self.name, method_name, now_option])
     if not as_object:
         return result
     else:
         return resourcelist(result, Job, self.p5_connection)
Exemple #10
0
 def names(as_object=True, p5_connection=None):
     """
     Syntax: Server names
     Description: Returns the list of names of all configured servers
     Return Values:
     -On Success:    the list of names
     """
     method_name = "names"
     result = exec_nsdchat([module_name, method_name], p5_connection)
     if not as_object:
         return result
     else:
         return resourcelist(result, Server, p5_connection)
Exemple #11
0
 def names(as_object=True, p5_connection=None):
     """
     Syntax: License resources
     Description: Returns the list of names of all License resources
     Return Values:
     -On Success:    the list of names
     """
     method_name = "resources"
     str_list = exec_nsdchat([module_name, method_name], p5_connection)
     if not as_object:
         return str_list
     else:
         return resourcelist(str_list, LicenseResource, p5_connection)
Exemple #12
0
def names(as_object=False, p5_connection=None):
    """
    Syntax: Backup2Go names
    Description: Returns the list of names of all the Backup2Go templates
    Return Values:
    -On Success:    the list of names
    """
    method_name = "names"
    result = exec_nsdchat([module_name, method_name], p5_connection)
    if not as_object:
        return result
    else:
        return resourcelist(result, Backup2Go, p5_connection)
Exemple #13
0
def names(as_object=False, p5_connection=None):
    """
    Syntax: Workstation names
    Description: Returns the list of names of all workstations
    Return Values:
    -On Success:    the list of names
    """
    method_name = "names"
    result = exec_nsdchat([module_name, method_name], p5_connection)
    if not as_object:
        return result
    else:
        return resourcelist(result, Workstation, p5_connection)
Exemple #14
0
 def create(as_object=True, p5_connection=None):
     """
     Syntax: Server create
     Description: Creates a new server resource
     Return Values:
     -On Success:    the name/ID of the new server resource
     """
     method_name = "create"
     result = exec_nsdchat([module_name, method_name], p5_connection)
     if not as_object:
         return result
     else:
         return resourcelist(result, Server, p5_connection)
Exemple #15
0
def names(as_object=False, p5_connection=None):
    """
    Syntax: Jukebox names
    Description: Returns a list of names of all jukebox resources
    Return Values:
    -On Success:    list of jukebox names
                    the string "<empty>" If no jukeboxes are configured
    """
    method_name = "names"
    result = exec_nsdchat([module_name, method_name], p5_connection)
    if not as_object:
        return result
    else:
        return resourcelist(result, Jukebox, p5_connection)
Exemple #16
0
 def running(as_object=True, p5_connection=None):
     """
     Syntax: Job running
     Description: Returns the names of all currently running jobs.
     Return Values:
     -On Success:    the names of currently running jobs
                     the string "<empty>" if no jobs are running
     """
     method_name = "running"
     result = exec_nsdchat([module_name, method_name], p5_connection)
     if not as_object:
         return result
     else:
         return resourcelist(result, Job, p5_connection)
Exemple #17
0
 def names(as_object=True, p5_connection=None):
     """
     Syntax: BackupPlan names
     Description: Returns a list of names of all the BackupPlan resources
     Return Values:
     -On Success:    a list of names. If no backup plans have been
                     configured, the command returns the string
                     "<empty>"
     """
     method_name = "names"
     if not as_object:
         return result
     else:
         return resourcelist(result, BackupPlan, p5_connection)
Exemple #18
0
 def names(p5_connection=None, as_object=True):
     """
     Syntax: SyncPlan names
     Description: Returns a list of names of all sync plans
     Return Values:
     -On Success:    a list of names. If no sync plans have been configured
                     the command returns the string "<empty>"
     """
     method_name = "names"
     result = exec_nsdchat([module_name, method_name], p5_connection)
     if not as_object:
         return result
     else:
         return resourcelist(result, SyncPlan, p5_connection)
Exemple #19
0
 def names(as_object=True, p5_connection=None):
     """
     Syntax: Volume names
     Description: Returns a list of names of all volume resources
     Return Values:
     -On Success:    the list of volume names
                     the string "<empty>" if no volumes were configured
     """
     method_name = "names"
     str_list = exec_nsdchat([module_name, method_name], p5_connection)
     if not as_object:
         return str_list
     else:
         return resourcelist(str_list, Volume, p5_connection)
 def names(as_object=True, p5_connection=None):
     """
     Syntax: ArchiveIndex names
     Description: Returns the list of names of archive indexes.
     Return Values:
     -On Success:    a list of names. If no archive indexes are configured,
                     the command returns the string "<empty>"
     """
     method_name = "names"
     result = exec_nsdchat([module_name, method_name], p5_connection)
     if not as_object:
         return result
     else:
         return resourcelist(result, ArchiveIndex, p5_connection)
Exemple #21
0
def names(as_object=False, p5_connection=None):
    """
    Syntax: Job names
    Description: Returns a list of all currently scheduled or running jobs
    Return Values:
    -On Success:    the names of currently scheduled or running jobs
                    the string "<empty>" if no jobs are scheduled
    """
    method_name = "names"
    result = exec_nsdchat([module_name, method_name], p5_connection)
    if not as_object:
        return result
    else:
        return resourcelist(result, Job, p5_connection)
Exemple #22
0
 def names(as_object=True, p5_connection=None):
     """
     Syntax: Device names
     Description: Returns a list of single tape device resources.
     Return Values:
     -On Success:    the list of device names
                     the string "<empty>" if no devices are configured
     """
     method_name = "names"
     result = exec_nsdchat([module_name, method_name], p5_connection)
     if not as_object:
         return result
     else:
         return resourcelist(result, Device, p5_connection)
Exemple #23
0
def sourcehost(syncplan_name, as_object=False, p5_connection=None):
    """
    Syntax: SyncPlan <name> sourcehost
    Description: Returns the name of the client where the source data is
    located.
    Return Values:
    -On Success:    the name of the client
    """
    method_name = "sourcehost"
    result = exec_nsdchat([module_name, syncplan_name, method_name],
                          p5_connection)
    if not as_object:
        return result
    else:
        return resourcelist(result, Client, p5_connection)
Exemple #24
0
 def targethost(self, as_object=True):
     """
     Syntax: SyncPlan <name> targethost
     Description: Returns the name of the client where the data should be
     synced to
     Return Values:
     -On Success:    the name of the client
     """
     method_name = "targethost"
     result = self.p5_connection.nsdchat_call(
         [module_name, self.name, method_name])
     if not as_object:
         return result
     else:
         return resourcelist(result, Client, self.p5_connection)
 def names(as_object=True, p5_connection=None):
     """
     Syntax: ArchivePlan names
     Description: Returns the list of names of all configured archive plans
     Return Values:
     -On Success:    the list of plan names. If no plans have been
                     configured,  the command returns the string
                     "<empty>"
     """
     method_name = "names"
     str_list = exec_nsdchat([module_name, method_name], p5_connection)
     if not as_object:
         return str_list
     else:
         return resourcelist(str_list, ArchivePlan, p5_connection)
Exemple #26
0
 def pending(as_object=True, p5_connection=None):
     """
     Syntax: Job pending
     Description: Returns the names of all the jobs waiting to be executed,
     i.e. jobs that are still in the queue waiting to be scheduled and jobs
     that are already scheduled but wait for the next free worker thread.
     Return Values:
     -On Success:    the names of currently waiting jobs
                     the string "<empty>" if no jobs are waiting
     """
     method_name = "pending"
     result = exec_nsdchat([module_name, method_name], p5_connection)
     if not as_object:
         return result
     else:
         return resourcelist(result, Job, p5_connection)
Exemple #27
0
 def volumes(self, slot_id=[], as_object=True):
     """
     Syntax: Jukebox <name> volumes
     Description: Returns a list of all volumes currently loaded in the
     <name> jukebox. To update the list of the volumes in the jukebox, use
     the inventory method.
     Return Values:
     -On Success:    the list of volume names
     """
     method_name = "volumes"
     result = self.p5_connection.nsdchat_call(
         [module_name, self.name, method_name, slot_id])
     if not as_object:
         return result
     else:
         return resourcelist(result, Volume, self.p5_connection)
Exemple #28
0
def volumes(jukebox_name, slot_id=[], as_object=False, p5_connection=None):
    """
    Syntax: Jukebox <name> volumes
    Description: Returns a list of all volumes currently loaded in the <name>
    jukebox. To update the list of the volumes in the jukebox, use the
    inventory method.
    Return Values:
    -On Success:    the list of volume names
    """
    method_name = "volumes"
    result = exec_nsdchat([module_name, jukebox_name, method_name, slot_id],
                          p5_connection)
    if not as_object:
        return result
    else:
        return resourcelist(result, Volume, p5connection)
Exemple #29
0
def inventory(device_name, as_object=False, p5_connection=None):
    """
    Syntax: Device <name> inventory
    Description: Performs an inventory for the device <name>, effectively
    updating the internal volume database. Note that this is always a mount
    inventory, not a bar code inventory.
    Returns the name of the currently loaded volume
    Return Values:
    -On Success:    the volume name
    """
    method_name = "inventory"
    result = exec_nsdchat([module_name, device_name, method_name],
                          p5_connection)
    if not as_object:
        return result
    else:
        return resourcelist(result, Volume, p5_connection)
Exemple #30
0
def create(syncplan, as_object=False, p5_connection=None):
    """
    Syntax: SyncSelection create <plan>
    Description: Creates new temporary sync selection resource. The resource
    will be automatically deleted after the associated sync job has been
    submitted.
    The <plan> must be one of the registered synchronize plans. You can get the
    list of synchronize plans with the SyncPlan names CLI command
    Return Values:
    -On Success:    the name of the new resource. Use this name to
                    address the resource in all the other methods
    """
    method_name = "create"
    result = exec_nsdchat([module_name, method_name, syncplan], p5_connection)
    if not as_object:
        return result
    else:
        return resourcelist(result, SyncSelection, p5_connection)