Brocade Virtual ADX XML API Programmer’s Guide (Supporting ADX v03.1.00) User Manual

Page 875

Advertising
background image

Brocade Virtual ADX XML API Programmer’s Guide

865

53-1003248-01

Example: Unbinding a real server from a VIP

B

if (false == OpenRCloseLog(true))

return;

}

m_StreamWriter.Write("\r\n");

m_StreamWriter.WriteLine("{0}: --{1} {2}--", DateTime.Now,

sLogMessage, sLogMessage1);

//Update the underlying file.

m_StreamWriter.Flush();

}

}

/////////////////////////////////////////////////////////////////////////////

// Name: Unbind-RS cmdlet

//

// Description: This cmdlet will be called when the user executes Unbind-RS

// in powershell after loading the unbinding.dll. This cmdlet

// is used to real server from the selected virtual server

//

// Parameters: DeviceName - The IP Adress of the ADX Box

// UserName - The user name associated with the ADX Box

// Password - The password associated with the ADX Box

//

// How to call: PS> import-module .\unbinding.dll

// Unbind-RS -DeviceName <IP> -UserName <UserName> -Password <Password>

/////////////////////////////////////////////////////////////////////////////

[Cmdlet("Unbind", "RS")]

public class UnbindRSfromVIP : PSCmdlet

{

#region Parameters

[Parameter(Mandatory = true, ValueFromPipeline = true)]

[ValidateNotNullOrEmpty]//validates for empty value

public string DeviceName;

[Parameter(Mandatory = true, ValueFromPipeline = true)]

public string UserName;

[Parameter(Mandatory = true, ValueFromPipeline = true)]

public string Password;

#endregion

protected override void ProcessRecord()

{

//Get the utils class object

Utils objUtils = Unbinding.Utils.GetUtilsInstance();

try

{

//Open the log file to write

objUtils.OpenRCloseLog(true);

objUtils.WL("UnbindRSfromVIP START", "");

objUtils.WL("Establishing connection with ", DeviceName);

//Create the connection object and set the username and password

associated to it

objUtils.OpenConnection(ref DeviceName, ref UserName, ref

Password);

///Displays all the available virtual servers

ShowAllVirtualServers();

//Displays all the virtual server ports associated with the

selected virtual server

ServerPort objVirtualServerPort = ShowAllVirtualServerPorts();

//Display all the real servers binded to the virtual server port

if (1 == ShowBindedRealServers(objVirtualServerPort))

{

}

objUtils.WL("UnbindRSfromVIP END", "");

Advertising