Allows the enterprise admin to manage the Storage Policies for users in their enterprise. Used for an enterprise to decide storage location for users based on where they work/reside.
- Get Storage Policy
- Get List of Storage Policies
- Create New Assignment
- Get Assignment
- Get Assignment For Target
- Update Existing Assignment
- Assign Storage Policy
- Delete Assignment
Calling getInfo(String fields ...)
will return BoxStoragePolicy.Info object
containing information about the storage policy. If necessary to retrieve
limited set of fields. It is possible to specify them using param.
BoxStoragePolicy storagePolicy = new BoxStoragePolicy(api, id);
BoxStoragePolicy.Info storagePolicyInfo = storagePolicy.getInfo();
Calling the static getAll(BoxAPIConnection api)
will return an iterable that will page through all of the storage policies.
It is possible to specify maximum number of items per response and fields to retrieve by
calling the static getAll(BoxAPIConnection api, int limit, String fields ...)
method.
Iterable<BoxStoragePolicy.Info> storagePolicies = BoxStoragePolicy.getAll(api);
for (BoxStoragePolicy.Info storagePolicyInfo : storagePolicies) {
//Do something with the storage policy.
}
To create new storage policy assignment call create(BoxAPIConnection api, String policyID, String userID)
method.
BoxStoragePolicyAssignment.Info assignmentInfo = BoxStoragePolicyAssignment.create(api, policyID, userID);
Updating a storage policy assignment information is done by calling
updateInfo(BoxStoragePolicyAssignment.Info updatedInfo)
.
BoxStoragePolicyAssignment storagePolicyAssignment = new BoxStoragePolicyAssignment(api, "ASSIGNMENT_ID");
BoxStoragePolicyAssignment.Info assignmentInfo = storagePolicyAssignment.new Info();
assignmentInfo.setStoragePolicyID("NEW_STORAGE_POLICY_ID");
storagePolicyAssignment.updateInfo(assignmentInfo);
Calling getInfo(String fields ...)
will return a BoxStoragePolicyAssignment.Info object containing information
about the storage policy assignment.
BoxStoragePolicyAssignment storagePolicyAssignment = new BoxStoragePolicyAssignment(api, id);
BoxStoragePolicyAssignment.Info assignmentInfo = storagePolicyAssignment.getInfo();
Calling getAssignmentForTarget(BoxAPIConnection api, String resolvedForType, String resolvedForID)
will return a BoxStorageAssignment.Info
object containing information about the storage policy assignment.
BoxStoragePolicyAssignment.Info assignmentInfo = BoxStoragePolicyAssignment.getAssignmentForTarget(api, "user", "1234")
Calling assign(BoxAPIConnection api, String storagePolicyID, String userID)
will check if this user already has storage policy assigned to them. If not then a new
this user will be assigned the specified storage policy.
BoxStoragePolicyAssignment.Info assignmentInfo = BoxStoragePolicyAssignment.assign(api, "1234", "5678");
Calling delete()
will remove the storage policy assignment from the user.
BoxStoragePolicyAssignment assignment = new BoxStoragePolicyAssignment(api, "dXNlcl8xMjM0");
assignment.delete();