JVM - bucket()

Create a new bucket for storing and retrieving files.

import io.nitric.Nitric;
import io.nitric.resources.BucketPermission;

public class Application {
  public static void main(String[] args) {
    var bucket = Nitric.INSTANCE.bucket("images").with(BucketPermission.Read, BucketPermission.Write, BucketPermission.Delete);

    Nitric.INSTANCE.run();
  }
}

Parameters

  • Name
    name
    Required
    Required
    Type
    String
    Description

    The unique name of this bucket within the app. Subsequent calls to bucket() with the same name will return the same object.

Access

All Nitric resources provide access permissions you can use to specify the level of access your code needs to the resource. See here for details Access Control documentation.

Available permissions:


BucketPermission.Read

This permission allows your function to read files from the bucket


BucketPermission.Write

This permission allows your function to write files to the bucket


BucketPermission.Delete

This permission allows your function to delete files from the bucket


Working with files

See the following for examples on working with files in a bucket: