forked from kubeflow/model-registry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.go
130 lines (90 loc) · 7.17 KB
/
api.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
package api
import "github.com/kubeflow/model-registry/pkg/openapi"
// ListOptions provides options for listing entities with pagination and sorting.
// It includes parameters such as PageSize, OrderBy, SortOrder, and NextPageToken.
type ListOptions struct {
PageSize *int32 // The maximum number of entities to be returned per page.
OrderBy *string // The field by which entities are ordered.
SortOrder *string // The sorting order, which can be "ASC" (ascending) or "DESC" (descending).
NextPageToken *string // A token to retrieve the next page of entities in a paginated result set.
}
// ModelRegistryApi defines the external API for the Model Registry library
type ModelRegistryApi interface {
// REGISTERED MODEL
// UpsertRegisteredModel create or update a registered model, the behavior follows the same
// approach used by MLMD gRPC api. If Id is provided update the entity otherwise create a new one.
UpsertRegisteredModel(registeredModel *openapi.RegisteredModel) (*openapi.RegisteredModel, error)
// GetRegisteredModelById retrieve RegisteredModel by id
GetRegisteredModelById(id string) (*openapi.RegisteredModel, error)
// GetRegisteredModelByInferenceService retrieve a RegisteredModel by inference service id
GetRegisteredModelByInferenceService(inferenceServiceId string) (*openapi.RegisteredModel, error)
// GetRegisteredModelByParams find RegisteredModel instances that match the provided optional params
GetRegisteredModelByParams(name *string, externalId *string) (*openapi.RegisteredModel, error)
// GetRegisteredModels return all ModelArtifact properly ordered and sized based on listOptions param.
GetRegisteredModels(listOptions ListOptions) (*openapi.RegisteredModelList, error)
// MODEL VERSION
// UpsertModelVersion create a new Model Version or update a Model Version associated to a
// specific RegisteredModel identified by registeredModelId parameter
UpsertModelVersion(modelVersion *openapi.ModelVersion, registeredModelId *string) (*openapi.ModelVersion, error)
// GetModelVersionById retrieve ModelVersion by id
GetModelVersionById(id string) (*openapi.ModelVersion, error)
// GetModelVersionByInferenceService retrieve a ModelVersion by inference service id
GetModelVersionByInferenceService(inferenceServiceId string) (*openapi.ModelVersion, error)
// GetModelVersionByParams find ModelVersion instances that match the provided optional params
GetModelVersionByParams(versionName *string, registeredModelId *string, externalId *string) (*openapi.ModelVersion, error)
// GetModelVersions return all ModelArtifact properly ordered and sized based on listOptions param.
// if registeredModelId is provided, return all ModelVersion instances belonging to a specific RegisteredModel
GetModelVersions(listOptions ListOptions, registeredModelId *string) (*openapi.ModelVersionList, error)
// ARTIFACT
UpsertModelVersionArtifact(artifact *openapi.Artifact, modelVersionId string) (*openapi.Artifact, error)
UpsertArtifact(artifact *openapi.Artifact) (*openapi.Artifact, error)
GetArtifactById(id string) (*openapi.Artifact, error)
GetArtifactByParams(artifactName *string, modelVersionId *string, externalId *string) (*openapi.Artifact, error)
GetArtifacts(listOptions ListOptions, modelVersionId *string) (*openapi.ArtifactList, error)
// MODEL ARTIFACT
// UpsertModelArtifact creates or inserts an Artifact
UpsertModelArtifact(modelArtifact *openapi.ModelArtifact) (*openapi.ModelArtifact, error)
// GetModelArtifactById retrieve ModelArtifact by id
GetModelArtifactById(id string) (*openapi.ModelArtifact, error)
// GetModelArtifactByInferenceService retrieve a ModelArtifact by inference service id
GetModelArtifactByInferenceService(inferenceServiceId string) (*openapi.ModelArtifact, error)
// GetModelArtifactByParams find ModelArtifact instances that match the provided optional params
GetModelArtifactByParams(artifactName *string, modelVersionId *string, externalId *string) (*openapi.ModelArtifact, error)
// GetModelArtifacts return all ModelArtifact properly ordered and sized based on listOptions param.
// if modelVersionId is provided, return all ModelArtifact instances belonging to a specific ModelVersion
GetModelArtifacts(listOptions ListOptions, modelVersionId *string) (*openapi.ModelArtifactList, error)
// SERVING ENVIRONMENT
// UpsertServingEnvironment create or update a serving environmet, the behavior follows the same
// approach used by MLMD gRPC api. If Id is provided update the entity otherwise create a new one.
UpsertServingEnvironment(registeredModel *openapi.ServingEnvironment) (*openapi.ServingEnvironment, error)
// GetInferenceServiceById retrieve ServingEnvironment by id
GetServingEnvironmentById(id string) (*openapi.ServingEnvironment, error)
// GetServingEnvironmentByParams find ServingEnvironment instances that match the provided optional params
GetServingEnvironmentByParams(name *string, externalId *string) (*openapi.ServingEnvironment, error)
// GetServingEnvironments return all ServingEnvironment properly ordered and sized based on listOptions param
GetServingEnvironments(listOptions ListOptions) (*openapi.ServingEnvironmentList, error)
// INFERENCE SERVICE
// UpsertInferenceService create or update an inference service, the behavior follows the same
// approach used by MLMD gRPC api. If Id is provided update the entity otherwise create a new one.
// inferenceService.servingEnvironmentId defines the ServingEnvironment to be associated as parent ownership
// to the newly created InferenceService.
UpsertInferenceService(inferenceService *openapi.InferenceService) (*openapi.InferenceService, error)
// GetInferenceServiceById retrieve InferenceService by id
GetInferenceServiceById(id string) (*openapi.InferenceService, error)
// GetInferenceServiceByParams find InferenceService instances that match the provided optional params
GetInferenceServiceByParams(name *string, parentResourceId *string, externalId *string) (*openapi.InferenceService, error)
// GetInferenceServices return all InferenceService properly ordered and sized based on listOptions param
// if servingEnvironmentId is provided, return all InferenceService instances belonging to a specific ServingEnvironment
// if runtime is provided, filter those InferenceService having that runtime
GetInferenceServices(listOptions ListOptions, servingEnvironmentId *string, runtime *string) (*openapi.InferenceServiceList, error)
// SERVE MODEL
// UpsertServeModel create or update a serve model, the behavior follows the same
// approach used by MLMD gRPC api. If Id is provided update the entity otherwise create a new one.
// inferenceServiceId defines the InferenceService to be linked to the newly created ServeModel.
UpsertServeModel(serveModel *openapi.ServeModel, inferenceServiceId *string) (*openapi.ServeModel, error)
// GetServeModelById retrieve ServeModel by id
GetServeModelById(id string) (*openapi.ServeModel, error)
// GetServeModels get all ServeModel objects properly ordered and sized based on listOptions param.
// if inferenceServiceId is provided, return all ServeModel instances belonging to a specific InferenceService
GetServeModels(listOptions ListOptions, inferenceServiceId *string) (*openapi.ServeModelList, error)
}