Previous Topic: Where to Run Your Scripts

Next Topic: CLI Example: View and Set Individual Properties

CLI Example: Create a Policy Store Object

Suppose you are an administrator for the domain engineering. You want to create the realm documentation in that domain. Using the Administrative UI, you might take the following steps:

  1. Log into the SiteMinder Administration software.
  2. Right-click the domain engineering where you are adding the realm.
  3. Click Create Realm and provide the following configuration information for the fields on the Resource tab:

    You are accepting all other defaults for the realm (including resource protection, which is enabled by default).

  4. Click OK to confirm the creation of the new realm.

If you write a script to perform the same operation, it might look like this:

#Initialize the Policy Management API
use Netegrity::PolicyMgtAPI;

$policyapi = Netegrity::PolicyMgtAPI‑>New();

print "Step 1. Log in the admin and create an API session.\n";
$session = $policyapi‑>CreateSession("adminid", "adminpwd");

print "Step 2. Select the domain for the new realm.\n";
$domain=$session‑>GetDomain("engineering");

#Get the realm's agent and authorization scheme info.\n";
$agent=$session‑>GetAgent("agent1");
$authscheme=$session‑>GetAuthScheme("Basic");
print "Step 3. Create and configure the realm.\n";
$realm=$domain‑>CreateRealm("documentation",
                            $agent,
                            $authscheme,
                            "Source files for manuals",
                            "/mysite/docs/*" );

print "Step 4. Confirm the creation of the realm.\n";
if ($realm == undef) {
         print "Realm creation failed.\n";
   }
   else {
         print "Realm creation succeeded.\n";
}

Note: Generally, policy store object names are case-sensitive. In the above example, the Basic authentication scheme and the engineering domain are case-sensitive. Further, agent names are always written to the policy store in lowercase. Existing agents must be referenced in lowercase in your scripts.


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