Package org.filestack

Class Policy.Builder

java.lang.Object
org.filestack.Policy.Builder
Enclosing class:
Policy

public static class Policy.Builder extends Object
Builds new Policy.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • expiry

      public Policy.Builder expiry(Long expiry)
      Set when the policy will expire.
      Parameters:
      expiry - in UNIX time
    • calls

      public Policy.Builder calls(String... calls)
      Add a call that this policy is allowed to make. A policy without any call permissions specified is permitted to make all calls except for exif, which needs to be explicitly included in a policy in order to be allowed.
      Parameters:
      calls - can be pick, read, stat, write, writeUrl, store, convert, remove, or exif
    • handle

      public Policy.Builder handle(String handle)
      Restrict access to a single file handle for all calls that act on a specific handle.
    • url

      public Policy.Builder url(String regex)
      Restrict external transformations to certain URLs.
      Parameters:
      regex - regular expression matching allowed urls
    • maxSize

      public Policy.Builder maxSize(Integer maxSize)
      Set the max file size in bytes that can be uploaded. Default is no limit.
    • minSize

      public Policy.Builder minSize(Integer minSize)
      Set the min file size in bytes that can be uploaded. Defaults to 0.
    • path

      public Policy.Builder path(String path)
      Restrict paths a file can be uploaded to. Prevents a user from storing files to different paths. Does not prevent a user from reading content from different paths. Defaults to allowing any path ('.*').
      Parameters:
      path - regular expression matching allowed paths
    • container

      public Policy.Builder container(String container)
      Restrict containers a file can be uploaded to. Prevents a user from storing files to different containers. Does not prevent a user from reading content from different containers. Defaults to allowing any path ('.*').
      Parameters:
      container - regular expression matching allowed paths
    • giveFullAccess

      public Policy.Builder giveFullAccess()
      Give the policy full access and a one year expiry.
    • build

      public Policy build(String appSecret)
      Encodes the json policy and signs it using the app secret. Do not include the app secret in client-side code.