Skip to end of metadata
Go to start of metadata

The following example demonstrates how to create a volume, a Power-User account assigned to this volume, and a server assigned to this user. In this case, Power-Users are allowed to create Sub-Users.

A PHP file called Volumes_With_Limits_Power_User_With_Sub_User_Allowed.php can be found here:

  • for Windows: <installdir>\apisamples
  • for Linux: <installdir>/apisamples

Read more in Access example API functions.

The PHP script creates objects with the defined options in the system and prints the following messages on the screen:

  • "Successfully created volume" or "Failed to create volume"
  • "Successfully created power user" or "Failed to create power user"
  • "Successfully created agent" or "Failed to create agent"

Sequence of automated actions

The following steps can be accomplished by using this script:

  1. Create a Volume.
  2. Create a Power User with attributes. Assign the Volume to the newly created Power User.
  3. Create a Server. Make the newly created Power User its owner.

How to fulfill the appropriate actions in the Server Backup Manager user interface

Below, you can find the steps to perform these actions using the program user interface. Screen shots are provided to illustrate the scripts for each step.



Defining server configuration variables

########====CDP Server Configuration Start====######## #set CDP server host name $HOST="127.0.0.1"; #set CDP server to access API $PORT="9443"; #set CDP user $USER="admin"; #set CDP user password $PASS="admin"; ########====CDP Server Configuration End====########

Log in to the Backup Manager user interface using your username and password.

Creating a volume

########====Create Volume Start====######## $volume->name = "volumeName"; $volume->description = "volumeDescription"; $volume->path = "C:/volumePath"; $volume->quotaType = "ON_DISK_SIZE"; // If Quota is NONE then unset soft and hard quota $volume->softQuota = "1000000"; $volume->hardQuota = "2000000"; $MAP = array( array( key => "FILE_EXCLUDES_ENABLED", value => "true"), array( key => "ARCHIVING_ENABLED", value => "false"), array( key => "CONTROLPANELS_ENABLED", value => "true"), array( key => "REPLICATION_FREQUENCY_LIMIT", value => "HOURLY"), # RECOVERY_POINT_LIMIT set the value to "-1" to disable recovery point limit array( key => "RECOVERY_POINT_LIMIT", value => "-1"), # ARCHIVE_POINT_LIMIT set the value to "-1" to disable archive point limit array( key => "ARCHIVE_POINT_LIMIT", value => "-1"), array( key => "CREATE_DIRECTORY", value => "true") ); $volume->volumeAttributeMap = $MAP; try{ $volumeClient = new soapclient("https://$HOST:$PORT/Volume?wsdl", array('login'=>"$USER", 'password'=>"$PASS", 'trace'=>1, 'cache_wsdl' => WSDL_CACHE_NONE, 'features' => SOAP_SINGLE_ELEMENT_ARRAYS) ); $createdVolume = $volumeClient->createVolumeWithObject(array('volume'=>$volume)); echo "Successfully created volume\n"; } catch (SoapFault $exception) { echo "Failed to create volume \n"; echo $exception; exit(1); } ########====Create Volume End====########

1. In the Main menu, click Volumes.

2. Then click "Create New Volume" in the Volumes menu, located in the top left area of the interface.

3. Define the following Identification options:

  • Name - Volume name used to identify the Volume in the system. For example, to assign a Volume to the Disk Safe, you need to select a Volume name from the drop-down menu.
  • Description - Additional information describing the Volume. The Description is displayed in the Volumes list.
  • Volume Path - New or existing folder. The assigned Disk Safes will be placed in this folder.

4. Define the "Replication Limit" as "Hourly," and specify the "Soft Quota" and "Hard Quota." Set the "Allow File Excludes" option to "True" and click "Save."

5. Click "OK" in the "Warning" window to create a directory.

6. Click "OK" in the "Success" window to complete the process.

Creating a Power-User account

########====Create Power User Start====######## $user->username = "powerWithLimit_UserName"; $user->password = "password"; $user->userType = "POWER_USER"; $user->emailAddress = "userName@domain.com"; # This give the user permission on the list of volumes $user->volumeIDs = array($createdVolume->return->id); $user->userAttributes = array( #Indicates whether or not the power-user has the ability to create and administrate agents on the CDP server. array( "key" => "CAN_ADMIN_AGENTS", "value" => "true"), #If the power-user can create agents, a limit on the maximum number of agents can be set. array( "key" => "MAX_AGENT_COUNT", "value" => 2), # Indicates whether or not the power-user has the ability to create and administrate sub-users on the CDP server. array( "key" => "CAN_ADMIN_SUBUSERS", "value" => "true"), #If the power-user can create sub-users, a limit on the maximum number of sub-users can be set. # This give the power user permission to create two sub users (for resellers) array( "key" => "MAX_SUB_USER_COUNT", "value" => 2), #If the power-user can create agents, a limit on the maximum number of MySQL add-ons the power-user array( "key" => "MAX_MYSQL_ADDON_COUNT", "value" => 2) ); try{ $client = new soapclient("https://$HOST:$PORT/User?wsdl", array('login'=>"$USER", 'password'=>"$PASS", 'trace'=>1, 'cache_wsdl' => WSDL_CACHE_NONE, 'features' => SOAP_SINGLE_ELEMENT_ARRAYS) ); $createdUser = $client->createUserWithObject(array( 'user' => $user)); echo "Successfully created power user\n"; } catch (SoapFault $exception) { echo "Failed to create power user \n"; echo $exception; exit(1); } ########====Create Power User End====########

1. In the Main menu, click Users.

2. In the "Users" menu, click on "Create New User."

3. Define the new User properties in this window:

  • Username - Enter User login name.
  • Password - Enter a password for the User account.
  • Confirm Password - Reenter the same password for the User account.
  • Email Address - Enter email address of the User.
  • User Type - Choose the type of User: Power-User. The Power-User has the option to assign Sub-Users.

Select the following check-boxes:

  • User can create and administrate sub-users
    • Restrict maximum sub-user count (Set to "2").
  • User can create and administrate servers
    • Restrict maximum server count (Set to "2").

4. Add the previously created Volume in the "Volumes" tab.

5. Click "Create"

6. Click "OK" in the "Success" window.

Creating a server

########====Create Agent Start====######## ##Add all the basic properties to the agent object # Description of agent $agentObj->description = "agentDescription"; # Host name of the agent ( It can be an IP or name ) $agentObj->hostname = "127.0.0.1"; # port number on whcih the agent will connect to the CDP server $agentObj->portNumber = 1167; # Set the agent OS type (ex: LINUX or WINDOWS) see Java Doc for more details $agentObj->osType = "WINDOWS"; #set database addon to true if you have a database addon license and you want to backup a database $agentObj->databaseAddOnEnabled = true; $agentObj->ownerId = $createdUser->return->id; $agentObj->ownerPermissions = array("FULL_CONTROL"); try{ $agentClient = new soapclient("https://$HOST:$PORT/Agent?wsdl", array('login'=>"$USER", 'password'=>"$PASS", 'trace'=>1, 'cache_wsdl' => WSDL_CACHE_NONE, 'features' => SOAP_SINGLE_ELEMENT_ARRAYS) ); $createdAgent=$agentClient->createAgentWithObject(array('agent'=>$agentObj)); echo "Successfully executed created Agent\n"; } catch (SoapFault $exception) { echo "Failed to create agent \n"; echo $exception; exit(1); } ########====Create Agent End====######## ?>

1. In the Main menu, click Servers.

2. Then click "Add Server" in the Agents menu, located in the top left area of the interface.

3. The "Add Server" window will appear. You will need to define the following options:

  • Server Name - Enter a name for the Server. It will be displayed in the "Servers" List. In this case, it is "agentDescription."
  • Host Name/IP - Enter the Host Name or IP address of the Server. In this case, it is 127.0.0.1.
  • Port Number - Define a Port to connect to the Server, if different from the default value (1167).

To assign an Server owner, choose the previously created Power User from the drop-down list and set permissions to "Full Control".

4. Click "Create".

5. Click "OK" in the "Success" window.

Labels:
api api Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.