Previous Topic: Location of the Policy Management API

Next Topic: Script Execution Performance Enhancement

Write a Script against the Policy Management API

When you write a script against the Policy Management API, take the following basic steps:

  1. Reference the Policy Management API at the beginning of your script:
    use Netegrity::PolicyMgtAPI;
    
  2. Use the New() method to create a Policy Management API object:
    $policymgtapi = Netegrity::PolicyMgtAPI‑>New();
    
  3. Optionally, set one or more Policy Server initialization flags through PolicyMgtAPI methods such as DisableValidation(). By default, all initialization flags are set to 0.
  4. Create a session with the Policy Server:
    $session = $policymgtapi‑>CreateSession("userid", 
                                            "password", 
                                            "127.0.0.1" );
    

You can now perform operations against Policy Server objects. For example, you could retrieve and print out a list of configured agents in the Policy Server:

@agents = $session‑>GetAllAgents();
foreach $agent (@agents) {
   print "Agent Name = " . $agent‑>Name() . "\n";
}


Copyright © 2010 CA. All rights reserved. Email CA about this topic