beautypg.com

Adding a gsa unification node, Retrieving a node configuration, Retrieving all node configurations – Google Search Appliance Administrative API Developers Guide: .NET User Manual

Page 48

background image

Google Search Appliance: Administrative API Developer’s Guide: .NET

48

Adding a GSA Unification Node

Add a GSA Unification node as follows:

// Create an entry to hold properties to insert
GsaEntry insertEntry = new GsaEntry();

// In the following example code, add a secondary
// node with arbitrary values for the various settings.
// Add properties to insertEntry
insertEntry.AddGsaContent("entryID", "node_appliance_id");
insertEntry.AddGsaContent("nodeType", "SECONDARY");
insertEntry.AddGsaContent("federationNetworkIP", "10.0.0.2");
insertEntry.AddGsaContent("secretToken", "token");
insertEntry.AddGsaContent("hostname", "corp.domain.x.com");
insertEntry.AddGsaContent("scoringBias", "20");

// Send the request
myService.InsertEntry("federation", insertEntry);

Retrieving a Node Configuration

Retrieve the configuration information about a GSA Unification node as follows:

// Send a request and print the response
GsaEntry myEntry = myService.GetEntry("federation", "applianceId");
string type = myEntry.GetGsaContent("nodeType");
Console.WriteLine("Node Type: " + type);
Console.WriteLine("GSA Unification Network IP: " + myEntry.GetGsaContent

("federationNetworkIP"));

Console.WriteLine("Host Name: " + myEntry.GetGsaContent("hostname"));
Console.WriteLine("Secret Token: " + myEntry.GetGsaContent("secretToken"));
Console.WriteLine("Scoring Bias: " + myEntry.GetGsaContent("scoringBias"));

if (type.Equals("SECONDARY")) {

Console.WriteLine("Remote Front End: " + myEntry.GetGsaContent

("remoteFrontend"));

Console.WriteLine("Node Timeout: " + myEntry.GetGsaContent("slaveTimeout"));

}

if (type.Equals("PRIMARY") || type.Equals("PRIMARY_AND_SECONDARY")) {

Console.WriteLine("Secondary Nodes: " + myEntry.GetGsaContent

("secondaryNodes"));

}

Retrieving All Node Configurations

Retrieve information on all GSA Unification nodes as follows:

// Send the request and print the response
GsaFeed myFeed = myService.GetFeed("federation");

foreach(GsaEntry gsaEntry in myFeed.Entries) {

// Process each entry

}