Skip to main content

Manage file assets

Operations on file assets (connections, files).

In general, these should be:

  • Created in top-down order (connection, then files)
  • Deleted in bottom-up order (files, then connections)1

Asset structure

Connection

A file connection requires a name and qualifiedName. For creation, you can use any connector type you want, to give you a particular icon for the connection. In addition, at least one of adminRoles, adminGroups, or adminUsers must be provided.

Create a file connection
String adminRoleGuid = client.getRoleCache().getIdForName("$admin"); // (1)
Connection connection = Connection.creator( // (2)
"file-connection", // (3)
AtlanConnectorType.FILE, // (4)
List.of(adminRoleGuid), // (5)
List.of("group2"), // (6)
List.of("jsmith")) // (7)
.build();
AssetMutationResponse response = connection.save(client); // (8)
String connectionQualifiedName = response.getCreatedAssets().get(0).getQualifiedName(); // (9)
  1. Retrieve the GUID for the admin role, to use later for defining the roles that can administer the connection.
  2. Build up the minimum request to create a connection.
  3. Provide a human-readable name for your connection, such as production or development.
  4. Set the type of connection to FILE.
  5. List the workspace roles that should be able to administer the connection (or null if none). All users with that workspace role (current and future) will be administrators of the connection. Note that the values here need to be the GUIDs of the workspace roles. At least one of adminRoles, adminGroups, or adminUsers must be provided.
  6. List the group names that can administer this connection (or null if none). All users within that group (current and future) will be administrators of the connection. Note that the values here are the names of the groups. At least one of adminRoles, adminGroups, or adminUsers must be provided.
  7. List the user names that can administer this connection (or null if none). Note that the values here are the usernames of the users. At least one of adminRoles, adminGroups, or adminUsers must be provided.
  8. Actually call Atlan to create the connection. Because this operation will persist the asset in Atlan, you must provide it an AtlanClient through which to connect to the tenant.
  9. Retrieve the qualifiedName for use in subsequent creation calls. (You'd probably want to do some null checking first.)

File

A file asset requires a name and a qualifiedName. For creation, you also need to specify the connectionQualifiedName of the connection for the file.

Create a file
File file = File.creator( // (1)
"example-file.pdf", // (2)
connectionQualifiedName, // (3)
FileType.PDF) // (4)
.build();
AssetMutationResponse response = file.save(client); // (5)
  1. Build up the minimum request to create a file.
  2. Provide a human-readable name for your file asset.
  3. Provide the qualifiedName of the connection for this file asset.
  4. Specify the type of the file. This will control the icon that's used for the file.
  5. Actually call Atlan to create the file asset. Because this operation will persist the asset in Atlan, you must provide it an AtlanClient through which to connect to the tenant.

Available relationships

Each file is an Asset, and can therefore be related to the following other assets.

Footnotes

  1. Note that unlike other assets, the packaged connection delete utility in the UI will not remove files associated with the connection. So files must themselves be deleted, separately from the connection.

Was this page helpful?