All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.databricks.sdk.service.catalog.ModelVersionsAPI Maven / Gradle / Ivy

There is a newer version: 0.38.0
Show newest version
// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
package com.databricks.sdk.service.catalog;

import com.databricks.sdk.core.ApiClient;
import com.databricks.sdk.support.Generated;
import com.databricks.sdk.support.Paginator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Databricks provides a hosted version of MLflow Model Registry in Unity Catalog. Models in Unity
 * Catalog provide centralized access control, auditing, lineage, and discovery of ML models across
 * Databricks workspaces.
 *
 * 

This API reference documents the REST endpoints for managing model versions in Unity Catalog. * For more details, see the [registered models API docs](/api/workspace/registeredmodels). */ @Generated public class ModelVersionsAPI { private static final Logger LOG = LoggerFactory.getLogger(ModelVersionsAPI.class); private final ModelVersionsService impl; /** Regular-use constructor */ public ModelVersionsAPI(ApiClient apiClient) { impl = new ModelVersionsImpl(apiClient); } /** Constructor for mocks */ public ModelVersionsAPI(ModelVersionsService mock) { impl = mock; } public void delete(String fullName, long version) { delete(new DeleteModelVersionRequest().setFullName(fullName).setVersion(version)); } /** * Delete a Model Version. * *

Deletes a model version from the specified registered model. Any aliases assigned to the * model version will also be deleted. * *

The caller must be a metastore admin or an owner of the parent registered model. For the * latter case, the caller must also be the owner or have the **USE_CATALOG** privilege on the * parent catalog and the **USE_SCHEMA** privilege on the parent schema. */ public void delete(DeleteModelVersionRequest request) { impl.delete(request); } public ModelVersionInfo get(String fullName, long version) { return get(new GetModelVersionRequest().setFullName(fullName).setVersion(version)); } /** * Get a Model Version. * *

Get a model version. * *

The caller must be a metastore admin or an owner of (or have the **EXECUTE** privilege on) * the parent registered model. For the latter case, the caller must also be the owner or have the * **USE_CATALOG** privilege on the parent catalog and the **USE_SCHEMA** privilege on the parent * schema. */ public ModelVersionInfo get(GetModelVersionRequest request) { return impl.get(request); } public ModelVersionInfo getByAlias(String fullName, String alias) { return getByAlias(new GetByAliasRequest().setFullName(fullName).setAlias(alias)); } /** * Get Model Version By Alias. * *

Get a model version by alias. * *

The caller must be a metastore admin or an owner of (or have the **EXECUTE** privilege on) * the registered model. For the latter case, the caller must also be the owner or have the * **USE_CATALOG** privilege on the parent catalog and the **USE_SCHEMA** privilege on the parent * schema. */ public ModelVersionInfo getByAlias(GetByAliasRequest request) { return impl.getByAlias(request); } public Iterable list(String fullName) { return list(new ListModelVersionsRequest().setFullName(fullName)); } /** * List Model Versions. * *

List model versions. You can list model versions under a particular schema, or list all * model versions in the current metastore. * *

The returned models are filtered based on the privileges of the calling user. For example, * the metastore admin is able to list all the model versions. A regular user needs to be the * owner or have the **EXECUTE** privilege on the parent registered model to recieve the model * versions in the response. For the latter case, the caller must also be the owner or have the * **USE_CATALOG** privilege on the parent catalog and the **USE_SCHEMA** privilege on the parent * schema. * *

There is no guarantee of a specific ordering of the elements in the response. The elements * in the response will not contain any aliases or tags. */ public Iterable list(ListModelVersionsRequest request) { return new Paginator<>( request, impl::list, ListModelVersionsResponse::getModelVersions, response -> { String token = response.getNextPageToken(); if (token == null || token.isEmpty()) { return null; } return request.setPageToken(token); }); } public ModelVersionInfo update(String fullName, long version) { return update(new UpdateModelVersionRequest().setFullName(fullName).setVersion(version)); } /** * Update a Model Version. * *

Updates the specified model version. * *

The caller must be a metastore admin or an owner of the parent registered model. For the * latter case, the caller must also be the owner or have the **USE_CATALOG** privilege on the * parent catalog and the **USE_SCHEMA** privilege on the parent schema. * *

Currently only the comment of the model version can be updated. */ public ModelVersionInfo update(UpdateModelVersionRequest request) { return impl.update(request); } public ModelVersionsService impl() { return impl; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy