Get a List of Policies
Get a Policy
Copyright © 2010, Juniper Networks, Inc.
objectId.setObjectIdOrName(objIdOrName);
//specifies the policy to be deleted
ObjectIdentifierType nsmpolicyId = new ObjectIdentifierType();
nsmpolicyId.setCategory("nsmpolicy");
nsmpolicyId.setDomainId(new UnsignedShort("1"));
ObjectIdOrNameType nsmpolicyIdOrName = new ObjectIdOrNameType();
nsmpolicyIdOrName.setObjectName("test100");
nsmpolicyId.setObjectIdOrName(nsmpolicyIdOrName);
deleteObject.addObjectIdentifier(nsmpolicyId);
deleteObject.addObjectIdentifier(objectId);
modifyCmd.setDeleteObject(deleteObject);
request.addCommand(modifyCmd);
//invokes the service
ModifyObjectViewResponse response =
DataCentricServiceTest.stub.ModifyObjectViewRequest(request);
assertTrue(response.getStatus() == StatusCodeType.Success);
} catch (Exception e) {
e.printStackTrace();
}
}
This Data Centric Service API code sample gets a list of all policies in one domain.
/**
* Gets all the policy objects in one domain.
* <p/>
*/
public void testGetAllPolicyObject() {
try {
System.out.println("Running testGetAllPolicyObject()");
GetObjectViewByCategoryRequest request = new
GetObjectViewByCategoryRequest();
request.setAuthToken(DataCentricServiceTest.authToken);
request.setDomainId(new UnsignedShort(1));
request.setCategory("nsmpolicy");
GetObjectViewByCategoryResponse response =
DataCentricServiceTest.stub.GetObjectViewByCategoryRequest(request);
DataCentricServiceTest.print(response.getObject());
assertTrue(response.getStatus() == StatusCodeType.Success);
} catch (Exception e) {
e.printStackTrace();
}
}
This Data Centric Service API code sample gets a specific policy.
/**
* Gets a single policy object.
Chapter 10: Using APIs for Policy Management
101
Need help?
Do you have a question about the NETWORK AND SECURITY MANAGER 2010.4 - API GUIDE REV 1 and is the answer not in the manual?
Questions and answers