Skip to content
Prev Previous commit
Next Next commit
description changes
  • Loading branch information
suruchimalewar committed Apr 24, 2019
commit f6a7c2565533ce99a0708724079694dd3383310a
6 changes: 6 additions & 0 deletions recipes/perl/storageAPI/configure_storage_unit_end_to_end.pl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
use Getopt::Long qw(GetOptions);
use storage;

# This script consists of the helper functions to excute NetBackup APIs to create storage unit.
# 1) Login to Netbackup
# 2) Create storage server
# 3) Create disk Pool
# 4) Create storage unit

#
# The token is the key to the NetBackup AuthN/AuthZ scheme. You must login and get a token
# and use this token in your Authorization header for all subsequent requests. Token validity
Expand Down
2 changes: 1 addition & 1 deletion recipes/python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ These scripts are only meant to be used as a reference. If you intend to use the
#### Executing the recipes in Python

Pre-requisites:
- NetBackup 8.2 or higher
- NetBackup 8.1.2 or higher
- python 3.5 or higher
- python modules: `requests`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
import json
import texttable as tt

# This script consists of the helper functions to excute NetBackup APIs to create storage unit.
# 1) Login to Netbackup
# 2) Create storage server
# 3) Create disk Pool
# 4) Create storage unit

protocol = "https"
nbmaster = ""
username = ""
Expand Down
65 changes: 1 addition & 64 deletions snippets/perl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ These scripts are only meant to be used as a reference. If you intend to use the
#### Pre-requisites:

- NetBackup 8.1.1 or higher
- NetBackup 8.2 or higher is required for configuring storage API
- Perl v5.18.2
- Perl modules Text::Table, JSON and LWP

Expand Down Expand Up @@ -80,66 +79,4 @@ ISO 8601 formatted UTC timestamp.
no a subscription associated with this asset.

- Example: perl post_nb_asset_cleanup.pl -nbmaster <master_server> -username <username> -password <pass> -filter "workloadType eq 'VMware'" -cleanuptime 2018-06-29T15:58:45.678Z

Create Storage Server:

Use the following command to create the storage server on NetBackup Master server:
- perl storageAPI/post_storage_server.pl -nbmaster <master_server> -username <username> -password <password> -payload <payload file path> [-domainname <domain_name>] [-domaintype <domain_type>]

Update Storage Server:

Use the following command to create the storage server on NetBackup Master server:
- perl storageAPI/patch_storage_server.pl -nbmaster <master_server> -username <username> -password <password> -payload <payload file path> -stsid <Storage server id> [-domainname <domain_name>] [-domaintype <domain_type>]

Get Storage Server:

Use the following command to create the storage server on NetBackup Master server:
- perl storageAPI/get_storage_server.pl -nbmaster <master_server> -username <username> -password <password> -payload <payload file path> [-domainname <domain_name>] [-domaintype <domain_type>]

Delete Storage Server:

Use the following command to create the storage server on NetBackup Master server:
- perl storageAPI/delete_storage_server.pl -nbmaster <master_server> -username <username> -password <password> -stsid <Storage server id> [-domainname <domain_name>] [-domaintype <domain_type>]

Create Storage unit:

Use the following command to create the storage unit on NetBackup Master server:
- perl storageAPI/post_storage_unit.pl -nbmaster <master_server> -username <username> -password <password> -payload <payload file path> [-domainname <domain_name>] [-domaintype <domain_type>]

Update Storage unit:

Use the following command to create the storage unit on NetBackup Master server:
- perl storageAPI/patch_storage_unit.pl -nbmaster <master_server> -username <username> -password <password> -payload <payload file path> -stuname <stu name>[-domainname <domain_name>] [-domaintype <domain_type>]

Get Storage unit:

Use the following command to create the storage unit on NetBackup Master server:
- perl storageAPI/get_storage_unit.pl -nbmaster <master_server> -username <username> -password <password> [-domainname <domain_name>] [-domaintype <domain_type>]

Delete Storage Unit:

Use the following command to create the storage unit on NetBackup Master server:
- perl storageAPI/delete_storage_unit.pl -nbmaster <master_server> -username <username> -password <password> -stu_name <Storage unit name> [-domainname <domain_name>] [-domaintype <domain_type>]


Create Disk Pool:

Use the following command to create the disk pool on NetBackup Master server:
- perl storageAPI/post_disk_pool.pl -nbmaster <master_server> -username <username> -password <password> -payload <payload file path> -dpid <disk pool id> [-domainname <domain_name>] [-domaintype <domain_type>]

Update Disk pool:

Use the following command to create the disk pool on NetBackup Master server:
- perl storageAPI/patch_disk_pool.pl -nbmaster <master_server> -username <username> -password <password> -payload <payload file path> -dpid <disk pool id> [-domainname <domain_name>] [-domaintype <domain_type>]

Get Disk Pool:

Use the following command to create the disk pool on NetBackup Master server:
- perl storageAPI/get_disk_pool.pl -nbmaster <master_server> -username <username> -password <password> [-domainname <domain_name>] [-domaintype <domain_type>]

Delete Disk Pool:

Use the following command to create the disk pool on NetBackup Master server:
- perl storageAPI/delete_storage_unit.pl -nbmaster <master_server> -username <username> -password <password> -dpid <disk pool id> [-domainname <domain_name>] [-domaintype <domain_type>]



78 changes: 78 additions & 0 deletions snippets/perl/storageAPI/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
### NetBackup API Code Samples for Perl

This directory contains code samples to invoke NetBackup REST APIs using Perl.

#### Disclaimer

These scripts are only meant to be used as a reference. If you intend to use them in production, use it at your own risk.

#### Pre-requisites:

- NetBackup 8.2 or higher is required for configuring storage API
- Perl v5.18.2
- Perl modules Text::Table, JSON and LWP

#### Executing the snippets in Perl

Create Storage Server:

Use the following command to create the storage server on NetBackup Master server:
- perl post_storage_server.pl -nbmaster <master_server> -username <username> -password <password> -payload <payload file path> [-domainname <domain_name>] [-domaintype <domain_type>]

Update Storage Server:

Use the following command to create the storage server on NetBackup Master server:
- perl patch_storage_server.pl -nbmaster <master_server> -username <username> -password <password> -payload <payload file path> -stsid <Storage server id> [-domainname <domain_name>] [-domaintype <domain_type>]

Get Storage Server:

Use the following command to create the storage server on NetBackup Master server:
- perl get_storage_server.pl -nbmaster <master_server> -username <username> -password <password> -payload <payload file path> [-domainname <domain_name>] [-domaintype <domain_type>]

Delete Storage Server:

Use the following command to create the storage server on NetBackup Master server:
- perl delete_storage_server.pl -nbmaster <master_server> -username <username> -password <password> -stsid <Storage server id> [-domainname <domain_name>] [-domaintype <domain_type>]

Create Storage unit:

Use the following command to create the storage unit on NetBackup Master server:
- perl post_storage_unit.pl -nbmaster <master_server> -username <username> -password <password> -payload <payload file path> [-domainname <domain_name>] [-domaintype <domain_type>]

Update Storage unit:

Use the following command to create the storage unit on NetBackup Master server:
- perl patch_storage_unit.pl -nbmaster <master_server> -username <username> -password <password> -payload <payload file path> -stuname <stu name>[-domainname <domain_name>] [-domaintype <domain_type>]

Get Storage unit:

Use the following command to create the storage unit on NetBackup Master server:
- perl get_storage_unit.pl -nbmaster <master_server> -username <username> -password <password> [-domainname <domain_name>] [-domaintype <domain_type>]

Delete Storage Unit:

Use the following command to create the storage unit on NetBackup Master server:
- perl delete_storage_unit.pl -nbmaster <master_server> -username <username> -password <password> -stu_name <Storage unit name> [-domainname <domain_name>] [-domaintype <domain_type>]


Create Disk Pool:

Use the following command to create the disk pool on NetBackup Master server:
- perl post_disk_pool.pl -nbmaster <master_server> -username <username> -password <password> -payload <payload file path> -dpid <disk pool id> [-domainname <domain_name>] [-domaintype <domain_type>]

Update Disk pool:

Use the following command to create the disk pool on NetBackup Master server:
- perl patch_disk_pool.pl -nbmaster <master_server> -username <username> -password <password> -payload <payload file path> -dpid <disk pool id> [-domainname <domain_name>] [-domaintype <domain_type>]

Get Disk Pool:

Use the following command to create the disk pool on NetBackup Master server:
- perl get_disk_pool.pl -nbmaster <master_server> -username <username> -password <password> [-domainname <domain_name>] [-domaintype <domain_type>]

Delete Disk Pool:

Use the following command to create the disk pool on NetBackup Master server:
- perl delete_storage_unit.pl -nbmaster <master_server> -username <username> -password <password> -dpid <disk pool id> [-domainname <domain_name>] [-domaintype <domain_type>]


4 changes: 2 additions & 2 deletions snippets/perl/storageAPI/delete_disk_pool.pl
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#Load module netbackup.pm from current directory
use lib".";
use lib"../.";

use gateway;
use storage;
use Getopt::Long qw(GetOptions);
sub printUsage {
print "\nUsage : perl storageAPI/delete_disk_pool.pl -nbmaster <master_server> -username <username> -password <password> -dpid <disk pool id> [-domainname <domain_name>] [-domaintype <domain_type>]\n\n";
print "\nUsage : perl delete_disk_pool.pl -nbmaster <master_server> -username <username> -password <password> -dpid <disk pool id> [-domainname <domain_name>] [-domaintype <domain_type>]\n\n";
die;
}

Expand Down
4 changes: 2 additions & 2 deletions snippets/perl/storageAPI/delete_storage_server.pl
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#Load module netbackup.pm from current directory
use lib".";
use lib"../.";

use gateway;
use storage;
use Getopt::Long qw(GetOptions);
sub printUsage {
print "\nUsage : perl storageAPI/delete_storage_server.pl -nbmaster <master_server> -username <username> -password <password> -stsid <Storage server id> [-domainname <domain_name>] [-domaintype <domain_type>]\n\n";
print "\nUsage : perl delete_storage_server.pl -nbmaster <master_server> -username <username> -password <password> -stsid <Storage server id> [-domainname <domain_name>] [-domaintype <domain_type>]\n\n";
die;
}

Expand Down
4 changes: 2 additions & 2 deletions snippets/perl/storageAPI/delete_storage_unit.pl
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#Load module netbackup.pm from current directory
use lib".";
use lib"../.";

use gateway;
use storage;
use Getopt::Long qw(GetOptions);
sub printUsage {
print "\nUsage : perl storageAPI/delete_storage_unit.pl -nbmaster <master_server> -username <username> -password <password> -stu_name <Storage unit name> [-domainname <domain_name>] [-domaintype <domain_type>]\n\n";
print "\nUsage : perl delete_storage_unit.pl -nbmaster <master_server> -username <username> -password <password> -stu_name <Storage unit name> [-domainname <domain_name>] [-domaintype <domain_type>]\n\n";
die;
}

Expand Down
4 changes: 2 additions & 2 deletions snippets/perl/storageAPI/get_disk_pool.pl
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#Load module netbackup.pm from current directory
use lib".";
use lib"../.";

use gateway;
use storage;
use Getopt::Long qw(GetOptions);
sub printUsage {
print "\nUsage : perl storageAPI/get_disk_pool.pl -nbmaster <master_server> -username <username> -password <password> [-domainname <domain_name>] [-domaintype <domain_type>]\n\n";
print "\nUsage : perl get_disk_pool.pl -nbmaster <master_server> -username <username> -password <password> [-domainname <domain_name>] [-domaintype <domain_type>]\n\n";
die;
}

Expand Down
4 changes: 2 additions & 2 deletions snippets/perl/storageAPI/get_disk_pool_by_id.pl
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#Load module netbackup.pm from current directory
use lib".";
use lib"../.";

use gateway;
use storage;
use Getopt::Long qw(GetOptions);
sub printUsage {
print "\nUsage : perl storageAPI/get_disk_pool_by_id.pl -nbmaster <master_server> -username <username> -password <password> -dpid <disk pool id> [-domainname <domain_name>] [-domaintype <domain_type>]\n\n";
print "\nUsage : perl get_disk_pool_by_id.pl -nbmaster <master_server> -username <username> -password <password> -dpid <disk pool id> [-domainname <domain_name>] [-domaintype <domain_type>]\n\n";
die;
}

Expand Down
4 changes: 2 additions & 2 deletions snippets/perl/storageAPI/get_storage_server.pl
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#Load module netbackup.pm from current directory
use lib".";
use lib"../.";

use gateway;
use storage;
use Getopt::Long qw(GetOptions);
sub printUsage {
print "\nUsage : perl storageAPI/get_storage_server.pl -nbmaster <master_server> -username <username> -password <password> -payload <payload file path> [-domainname <domain_name>] [-domaintype <domain_type>]\n\n";
print "\nUsage : perl get_storage_server.pl -nbmaster <master_server> -username <username> -password <password> -payload <payload file path> [-domainname <domain_name>] [-domaintype <domain_type>]\n\n";
die;
}

Expand Down
4 changes: 2 additions & 2 deletions snippets/perl/storageAPI/get_storage_server_by_id.pl
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#Load module netbackup.pm from current directory
use lib".";
use lib"../.";

use gateway;
use storage;
use Getopt::Long qw(GetOptions);
sub printUsage {
print "\nUsage : perl storageAPI/get_storage_server_by_id.pl -nbmaster <master_server> -username <username> -password <password> -stsid <Storage server id> [-domainname <domain_name>] [-domaintype <domain_type>]\n\n";
print "\nUsage : perl get_storage_server_by_id.pl -nbmaster <master_server> -username <username> -password <password> -stsid <Storage server id> [-domainname <domain_name>] [-domaintype <domain_type>]\n\n";
die;
}

Expand Down
4 changes: 2 additions & 2 deletions snippets/perl/storageAPI/get_storage_unit.pl
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#Load module netbackup.pm from current directory
use lib".";
use lib"../.";

use gateway;
use storage;
use Getopt::Long qw(GetOptions);
sub printUsage {
print "\nUsage : perl storageAPI/get_storage_unit.pl -nbmaster <master_server> -username <username> -password <password> [-domainname <domain_name>] [-domaintype <domain_type>]\n\n";
print "\nUsage : perl get_storage_unit.pl -nbmaster <master_server> -username <username> -password <password> [-domainname <domain_name>] [-domaintype <domain_type>]\n\n";
die;
}

Expand Down
4 changes: 2 additions & 2 deletions snippets/perl/storageAPI/get_storage_unit_by_id.pl
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#Load module netbackup.pm from current directory
use lib".";
use lib"../.";

use gateway;
use storage;
use Getopt::Long qw(GetOptions);
sub printUsage {
print "\nUsage : perl storageAPI/get_storage_unit_by_id.pl -nbmaster <master_server> -username <username> -password <password> -stu_name <Storage unit name> [-domainname <domain_name>] [-domaintype <domain_type>]\n\n";
print "\nUsage : perl get_storage_unit_by_id.pl -nbmaster <master_server> -username <username> -password <password> -stu_name <Storage unit name> [-domainname <domain_name>] [-domaintype <domain_type>]\n\n";
die;
}

Expand Down
4 changes: 2 additions & 2 deletions snippets/perl/storageAPI/patch_disk_pool.pl
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#Load module netbackup.pm from current directory
use lib".";
use lib"../.";

use gateway;
use storage;
use Getopt::Long qw(GetOptions);
sub printUsage {
print "\nUsage : perl storageAPI/patch_disk_pool.pl -nbmaster <master_server> -username <username> -password <password> -payload <payload file path> -dpid <disk pool id> [-domainname <domain_name>] [-domaintype <domain_type>]\n\n";
print "\nUsage : perl patch_disk_pool.pl -nbmaster <master_server> -username <username> -password <password> -payload <payload file path> -dpid <disk pool id> [-domainname <domain_name>] [-domaintype <domain_type>]\n\n";
die;
}

Expand Down
4 changes: 2 additions & 2 deletions snippets/perl/storageAPI/patch_storage_server.pl
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#Load module netbackup.pm from current directory
use lib".";
use lib"../.";

use gateway;
use storage;
use Getopt::Long qw(GetOptions);
sub printUsage {
print "\nUsage : perl storageAPI/patch_storage_server.pl -nbmaster <master_server> -username <username> -password <password> -payload <payload file path> -stsid <Storage server id> [-domainname <domain_name>] [-domaintype <domain_type>]\n\n";
print "\nUsage : perl patch_storage_server.pl -nbmaster <master_server> -username <username> -password <password> -payload <payload file path> -stsid <Storage server id> [-domainname <domain_name>] [-domaintype <domain_type>]\n\n";
die;
}

Expand Down
4 changes: 2 additions & 2 deletions snippets/perl/storageAPI/patch_storage_unit.pl
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#Load module netbackup.pm from current directory
use lib".";
use lib"../.";

use gateway;
use storage;
use Getopt::Long qw(GetOptions);
sub printUsage {
print "\nUsage : perl storageAPI/patch_storage_unit.pl -nbmaster <master_server> -username <username> -password <password> -payload <payload file path> -stu_name <stu name>[-domainname <domain_name>] [-domaintype <domain_type>]\n\n";
print "\nUsage : perl patch_storage_unit.pl -nbmaster <master_server> -username <username> -password <password> -payload <payload file path> -stu_name <stu name>[-domainname <domain_name>] [-domaintype <domain_type>]\n\n";
die;
}

Expand Down
4 changes: 2 additions & 2 deletions snippets/perl/storageAPI/post_disk_pool.pl
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#Load module netbackup.pm from current directory
use lib".";
use lib"../.";

use gateway;
use storage;
use Getopt::Long qw(GetOptions);
sub printUsage {
print "\nUsage : perl storageAPI/post_disk_pool.pl -nbmaster <master_server> -username <username> -password <password> -payload <payload file path> -dpid <disk pool id> [-domainname <domain_name>] [-domaintype <domain_type>]\n\n";
print "\nUsage : perl post_disk_pool.pl -nbmaster <master_server> -username <username> -password <password> -payload <payload file path> -dpid <disk pool id> [-domainname <domain_name>] [-domaintype <domain_type>]\n\n";
die;
}

Expand Down
4 changes: 2 additions & 2 deletions snippets/perl/storageAPI/post_storage_server.pl
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#Load module netbackup.pm from current directory
use lib".";
use lib"../.";

use gateway;
use storage;
use Getopt::Long qw(GetOptions);
sub printUsage {
print "\nUsage : perl storageAPI/post_storage_server.pl -nbmaster <master_server> -username <username> -password <password> -payload <payload file path> [-domainname <domain_name>] [-domaintype <domain_type>]\n\n";
print "\nUsage : perl post_storage_server.pl -nbmaster <master_server> -username <username> -password <password> -payload <payload file path> [-domainname <domain_name>] [-domaintype <domain_type>]\n\n";
die;
}

Expand Down
Loading