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();
}
}
Get a List of Policies
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();
}
}
Get a Policy
This Data Centric Service API code sample gets a specific policy.
/**
* Gets a single policy object.
101
Copyright © 2010, Juniper Networks, Inc.
Chapter 10: Using APIs for Policy Management
Summary of Contents for NETWORK AND SECURITY MANAGER 2010.4 - API GUIDE REV 1
Page 6: ...Copyright 2010 Juniper Networks Inc vi...
Page 10: ...Copyright 2010 Juniper Networks Inc x Network and Security Manager 2010 4 API Guide...
Page 12: ...Copyright 2010 Juniper Networks Inc xii Network and Security Manager 2010 4 API Guide...
Page 20: ...Copyright 2010 Juniper Networks Inc 2 Network and Security Manager 2010 4 API Guide...
Page 24: ...Copyright 2010 Juniper Networks Inc 6 Network and Security Manager 2010 4 API Guide...
Page 34: ...Copyright 2010 Juniper Networks Inc 16 Network and Security Manager 2010 4 API Guide...
Page 92: ...Copyright 2010 Juniper Networks Inc 74 Network and Security Manager 2010 4 API Guide...
Page 98: ...Copyright 2010 Juniper Networks Inc 80 Network and Security Manager 2010 4 API Guide...
Page 100: ...Copyright 2010 Juniper Networks Inc 82 Network and Security Manager 2010 4 API Guide...
Page 112: ...Copyright 2010 Juniper Networks Inc 94 Network and Security Manager 2010 4 API Guide...
Page 128: ...Copyright 2010 Juniper Networks Inc 110 Network and Security Manager 2010 4 API Guide...
Page 138: ...Copyright 2010 Juniper Networks Inc 120 Network and Security Manager 2010 4 API Guide...
Page 152: ...Copyright 2010 Juniper Networks Inc 134 Network and Security Manager 2010 4 API Guide...
Page 165: ...PART 6 Index Index on page 149 147 Copyright 2010 Juniper Networks Inc...
Page 166: ...Copyright 2010 Juniper Networks Inc 148 Network and Security Manager 2010 4 API Guide...