Asset APIs
The Acceldata Java SDK provides a variety of methods to fetch detailed asset information, ensuring the efficiency of your data management processes.
Obtaining Asset Details Using Asset ID or Asset UID
With the SDK, you can effortlessly obtain specific asset details by providing an asset identifier, be it the Asset ID or Asset UID.
// Retrieve an Asset by its ID
String assetId = "965138";
Asset assetById = adocClient.getAsset(assetId);
// Retrieve an Asset by its UID
String assetUid = "java_sdk_snowflake_ds.CUSTOMERS_DATABASE.JAVA_SDK.DEPT_INFO";
Asset assetByUid = adocClient.getAsset(assetUid);
Discovering all Asset Types within ADOC
One of the key functionalities of the ADOC (Acceldata Operations Console) is the ability to discover all asset types within your data environment.
List<AssetType> assetTypes = adocClient.getAllAssetTypes();
Exploring Asset Attributes: Tags, Labels, Metadata, and Sample Data
You have the capability to retrieve asset metadata, asset tags, labels, and sample metadata for a comprehensive understanding of your data assets.
// Retrieve the asset object using its unique identifier (Asset UID)
String assetUid = "java_sdk_snowflake_ds.CUSTOMERS_DATABASE.JAVA_SDK.DEPT_INFO";
Asset asset = adocClient.getAsset(assetUid);
// Get metadata of the asset
Metadata metadata = asset.getMetadata();
// Retrieve all tags associated with the asset
List<AssetTag> assetTags = asset.getTags();
// Retrieve asset labels
List<AssetLabel> assetLabels = asset.getLabels();
// Retrieve sample data for the asset
Map<String, Object> sampleData = asset.sampleData();
You can also add tags, labels, and custom metadata using the SDK, facilitating asset filtering and organization.
// Add a new tag to the asset
AssetTag assetTag = asset.addTag("sdk-tag-3");
// Add asset labels
List<AssetLabel> assetLabels = new ArrayList<>();
// Define and add the first asset label
assetLabels.add(AssetLabel.builder().key("test12").value("shubh12").build());
// Define and add the second asset label
assetLabels.add(AssetLabel.builder().key("test22").value("shubh32").build());
// Perform the operation to add asset labels and capture the response
List<AssetLabel> addAssetLabelsResponse = asset.addLabels(assetLabels);
// Add custom metadata
List<CustomAssetMetadata> customAssetMetadataList = new ArrayList<>();
// Define and add the first custom metadata
CustomAssetMetadata customAssetMetadata1 = CustomAssetMetadata.builder().key("testcm1").value("shubhcm1").build();
// Define and add the second custom metadata
CustomAssetMetadata customAssetMetadata2 = CustomAssetMetadata.builder().key("testcm2").value("shubhcm2").build();
// Add both custom metadata entries to the list
customAssetMetadataList.add(customAssetMetadata1);
customAssetMetadataList.add(customAssetMetadata2);
// Perform the operation to add custom metadata and capture the response in the 'metadata' variable
Metadata metadata = asset.addCustomMetadata(customAssetMetadataList);
Initiating Asset Profiling and Sampling
Spark jobs executed on Livy enable the profiling and sampling of crawled assets.
//profile an asset, get profile request details, cancel the profile
// assetProfile is the return object received on startProfile call
Profile assetProfile = asset.startProfile(ProfilingType.FULL);
//Get asset profiling status
assetProfile.getStatus();
//Cancel profiling
ProfileCancellationResult cancelResponse = assetProfile.cancel();
//Latest profile status
ProfileRequest latestProfileStatus = asset.getLatestProfileStatus();
// Latest profile status using adocclient
adocClient.getProfileStatus(assetIdentifier, profileId);
In summary, the Acceldata Java SDK equips you with a diverse range of capabilities to streamline and enhance your data asset management. Whether you're retrieving asset details via IDs or UIDs, exploring different asset types, examining attributes such as tags, labels, and metadata, or initiating profiling and sampling tasks, the SDK simplifies your data management journey.
With the Acceldata Java SDK, you can seamlessly fetch specific asset information, add tags, labels, and custom metadata, and delve into asset profiling and sampling. This versatile toolkit enables you to unlock the full potential of your data assets, ensuring that your data management tasks are optimized, and enhancing your overall data-driven operations.