StoragePoliciesModule

public class StoragePoliciesModule

Provides management of Storage Policies

  • Get information about a storage policy.

    Declaration

    Swift

    public func get(
        storagePolicyId: String,
        fields: [String]? = nil,
        completion: @escaping Callback<StoragePolicy>
    )

    Parameters

    storagePolicyId

    Id for storage policy needed.

    fields

    String array of fields to include in the response. Any attribute in the full Storage Policy objects can be passed in the fields parameter to get specific attributes.

    completion

    Returns a StoragePolicy response object if successful otherwise a BoxSDKError.

  • Get all of the storage policies in an enterprise.

    Declaration

    Swift

    public func listForEnterprise(
        marker: String? = nil,
        limit: Int? = nil,
        fields: [String]? = nil
    ) -> PagingIterator<StoragePolicy>

    Parameters

    marker

    The position marker at which to begin the response. See marker-based paging for details. This parameter cannot be used simultaneously with the ‘offset’ parameter.

    limit

    The maximum number of items to return. The default is 100 and the maximum is 1,000.

    fields

    String array of fields to include in the response. Any attribute in the full StoragePolicy objects can be passed in the fields parameter to get specific attributes.

  • Get storage policy assignment information.

    Declaration

    Swift

    public func getAssignment(
        storagePolicyAssignmentId: String,
        fields: [String]? = nil,
        completion: @escaping Callback<StoragePolicyAssignment>
    )

    Parameters

    storagePolicyAssignmentId

    Id for storage policy assignment needed.

    fields

    String array of fields to include in the response. Any attribute in the full Storage Policy Assignment objects can be passed in the fields parameter to get specific attributes.

    completion

    Returns a StoragePolicyAssignment response object if successful otherwise a BoxSDKError.

  • Get the storage policy assignment assigned to a user or enterprise.

    Declaration

    Swift

    public func listAssignments(
        resolvedForType: String,
        resolvedForId: String,
        fields: [String]? = nil,
        completion: @escaping Callback<StoragePolicyAssignment>
    )

    Parameters

    resolvedForType

    Specify user or enterprise.

    resolverForId

    Specify Id of user or enterprise

    fields

    String array of fields to include in the response. Any attribute in the full StoragePolicy objects can be passed in the fields parameter to get specific attributes.

  • Create storage policy assignment.

    Declaration

    Swift

    public func assign(
        storagePolicyId: String,
        assignedToType: String,
        assignedToId: String,
        fields: [String]? = nil,
        completion: @escaping Callback<StoragePolicyAssignment>
    )

    Parameters

    storagePolicyId

    Id of the storage policy.

    assignedToType

    Set type to “user” or “enterprise”.

    assignedToId

    Id of the user or enterprise.

    fields

    String array of fields to include in the response. Any attribute in the full Storage Policy Assignment objects can be passed in the fields parameter to get specific attributes.

    completion

    Returns a StoragePolicyAssignment response object if successful otherwise a BoxSDKError.

  • Assign policy

    Declaration

    Swift

    public func forceAssign(
        storagePolicyId: String,
        assignedToType: String,
        assignedToId: String,
        fields: [String]? = nil,
        completion: @escaping Callback<StoragePolicyAssignment>
    )

    Parameters

    storagePolicyId

    Id of the storage policy.

    assignedToType

    Set type to “user” or “enterprise”.

    assignedToId

    Id of the user or enterprise.

    fields

    String array of fields to include in the response. Any attribute in the full Storage Policy Assignment objects can be passed in the fields parameter to get specific attributes.

    completion

    Returns a StoragePolicyAssignment response object if successful otherwise a BoxSDKError.

  • Update storage policy assignment.

    Declaration

    Swift

    public func updateAssignment(
        storagePolicyAssignmentId: String,
        storagePolicyId: String? = nil,
        fields: [String]? = nil,
        completion: @escaping Callback<StoragePolicyAssignment>
    )

    Parameters

    storagePolicyAssignmentId

    Id for storage policy assignment to update.

    storagePolicyId

    Id for the storage policy.

    fields

    String array of fields to include in the response. Any attribute in the full Storage Policy Assignment objects can be passed in the fields parameter to get specific attributes.

    completion

    Returns a Storage Policy Assignment response object if successful otherwise a BoxSDKError.

  • Deleting a storage policy assignment means the user will inherit the Enterprise’s default storage policy.

    Declaration

    Swift

    public func deleteAssignment(
        storagePolicyAssignmentId: String,
        completion: @escaping Callback<Void>
    )

    Parameters

    storagePolicyAssignmentId

    Id for storage policy assignment.

    completion

    Returns Void if the storage policy assignment is deleted.