forked from kubeflow/model-registry
-
Notifications
You must be signed in to change notification settings - Fork 8
/
api_model_registry_service_service.go
528 lines (482 loc) · 23.1 KB
/
api_model_registry_service_service.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
/*
* Model Registry REST API
*
* REST API for Model Registry to create and manage ML model metadata
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package openapi
import (
"context"
"github.com/opendatahub-io/model-registry/internal/apiutils"
"github.com/opendatahub-io/model-registry/internal/converter"
"github.com/opendatahub-io/model-registry/internal/converter/generated"
"github.com/opendatahub-io/model-registry/pkg/api"
model "github.com/opendatahub-io/model-registry/pkg/openapi"
)
// ModelRegistryServiceAPIService is a service that implements the logic for the ModelRegistryServiceAPIServicer
// This service should implement the business logic for every endpoint for the ModelRegistryServiceAPI s.coreApi.
// Include any external packages or services that will be required by this service.
type ModelRegistryServiceAPIService struct {
coreApi api.ModelRegistryApi
converter converter.OpenAPIConverter
}
// NewModelRegistryServiceAPIService creates a default api service
func NewModelRegistryServiceAPIService(coreApi api.ModelRegistryApi) ModelRegistryServiceAPIServicer {
return &ModelRegistryServiceAPIService{
coreApi: coreApi,
converter: &generated.OpenAPIConverterImpl{},
}
}
// CreateEnvironmentInferenceService - Create a InferenceService in ServingEnvironment
func (s *ModelRegistryServiceAPIService) CreateEnvironmentInferenceService(ctx context.Context, servingenvironmentId string, inferenceServiceCreate model.InferenceServiceCreate) (ImplResponse, error) {
inferenceServiceCreate.ServingEnvironmentId = servingenvironmentId
return s.CreateInferenceService(ctx, inferenceServiceCreate)
// TODO: return Response(404, Error{}), nil
}
// CreateInferenceService - Create a InferenceService
func (s *ModelRegistryServiceAPIService) CreateInferenceService(ctx context.Context, inferenceServiceCreate model.InferenceServiceCreate) (ImplResponse, error) {
entity, err := s.converter.ConvertInferenceServiceCreate(&inferenceServiceCreate)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
result, err := s.coreApi.UpsertInferenceService(entity)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
return Response(201, result), nil
// TODO: return Response(400, Error{}), nil
// TODO: return Response(401, Error{}), nil
}
// CreateInferenceServiceServe - Create a ServeModel action in a InferenceService
func (s *ModelRegistryServiceAPIService) CreateInferenceServiceServe(ctx context.Context, inferenceserviceId string, serveModelCreate model.ServeModelCreate) (ImplResponse, error) {
entity, err := s.converter.ConvertServeModelCreate(&serveModelCreate)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
result, err := s.coreApi.UpsertServeModel(entity, &inferenceserviceId)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
return Response(201, result), nil
// TODO: return Response(400, Error{}), nil
// TODO: return Response(401, Error{}), nil
// TODO: return Response(404, Error{}), nil
}
// CreateModelArtifact - Create a ModelArtifact
func (s *ModelRegistryServiceAPIService) CreateModelArtifact(ctx context.Context, modelArtifactCreate model.ModelArtifactCreate) (ImplResponse, error) {
entity, err := s.converter.ConvertModelArtifactCreate(&modelArtifactCreate)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
result, err := s.coreApi.UpsertModelArtifact(entity, nil)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
return Response(201, result), nil
// TODO: return Response(400, Error{}), nil
// TODO: return Response(401, Error{}), nil
}
// CreateModelVersion - Create a ModelVersion
func (s *ModelRegistryServiceAPIService) CreateModelVersion(ctx context.Context, modelVersionCreate model.ModelVersionCreate) (ImplResponse, error) {
modelVersion, err := s.converter.ConvertModelVersionCreate(&modelVersionCreate)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
result, err := s.coreApi.UpsertModelVersion(modelVersion, &modelVersionCreate.RegisteredModelID)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
return Response(201, result), nil
// TODO: return Response(400, Error{}), nil
// TODO: return Response(401, Error{}), nil
}
// CreateModelVersionArtifact - Create an Artifact in a ModelVersion
func (s *ModelRegistryServiceAPIService) CreateModelVersionArtifact(ctx context.Context, modelversionId string, artifact model.Artifact) (ImplResponse, error) {
result, err := s.coreApi.UpsertArtifact(&artifact, &modelversionId)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
return Response(201, result), nil
// return Response(http.StatusNotImplemented, nil), errors.New("unsupported artifactType")
// TODO return Response(200, Artifact{}), nil
// TODO return Response(401, Error{}), nil
// TODO return Response(404, Error{}), nil
}
// CreateRegisteredModel - Create a RegisteredModel
func (s *ModelRegistryServiceAPIService) CreateRegisteredModel(ctx context.Context, registeredModelCreate model.RegisteredModelCreate) (ImplResponse, error) {
registeredModel, err := s.converter.ConvertRegisteredModelCreate(®isteredModelCreate)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
result, err := s.coreApi.UpsertRegisteredModel(registeredModel)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
return Response(201, result), nil
// TODO: return Response(400, Error{}), nil
// TODO: return Response(401, Error{}), nil
}
// CreateRegisteredModelVersion - Create a ModelVersion in RegisteredModel
func (s *ModelRegistryServiceAPIService) CreateRegisteredModelVersion(ctx context.Context, registeredmodelId string, modelVersion model.ModelVersion) (ImplResponse, error) {
result, err := s.coreApi.UpsertModelVersion(&modelVersion, ®isteredmodelId)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
return Response(201, result), nil
// TODO return Response(400, Error{}), nil
// TODO return Response(401, Error{}), nil
// TODO return Response(404, Error{}), nil
}
// CreateServingEnvironment - Create a ServingEnvironment
func (s *ModelRegistryServiceAPIService) CreateServingEnvironment(ctx context.Context, servingEnvironmentCreate model.ServingEnvironmentCreate) (ImplResponse, error) {
entity, err := s.converter.ConvertServingEnvironmentCreate(&servingEnvironmentCreate)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
result, err := s.coreApi.UpsertServingEnvironment(entity)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
return Response(201, result), nil
// TODO: return Response(400, Error{}), nil
// TODO: return Response(401, Error{}), nil
}
// FindInferenceService - Get an InferenceServices that matches search parameters.
func (s *ModelRegistryServiceAPIService) FindInferenceService(ctx context.Context, name string, externalID string) (ImplResponse, error) {
result, err := s.coreApi.GetInferenceServiceByParams(&name, nil, &externalID)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
return Response(200, result), nil
// TODO return esponse(400, Error{}), nil
// TODO return Response(401, Error{}), nil
// TODO return Response(404, Error{}), nil
}
// FindModelArtifact - Get a ModelArtifact that matches search parameters.
func (s *ModelRegistryServiceAPIService) FindModelArtifact(ctx context.Context, name string, externalID string, parentResourceID string) (ImplResponse, error) {
result, err := s.coreApi.GetModelArtifactByParams(&name, &parentResourceID, &externalID)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
return Response(200, result), nil
// TODO return esponse(400, Error{}), nil
// TODO return Response(401, Error{}), nil
// TODO return Response(404, Error{}), nil
}
// FindModelVersion - Get a ModelVersion that matches search parameters.
func (s *ModelRegistryServiceAPIService) FindModelVersion(ctx context.Context, name string, externalID string, registeredModelID string) (ImplResponse, error) {
result, err := s.coreApi.GetModelVersionByParams(&name, ®isteredModelID, &externalID)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
return Response(200, result), nil
// TODO return esponse(400, Error{}), nil
// TODO return Response(401, Error{}), nil
// TODO return Response(404, Error{}), nil
}
// FindRegisteredModel - Get a RegisteredModel that matches search parameters.
func (s *ModelRegistryServiceAPIService) FindRegisteredModel(ctx context.Context, name string, externalID string) (ImplResponse, error) {
result, err := s.coreApi.GetRegisteredModelByParams(&name, &externalID)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
return Response(200, result), nil
// TODO return esponse(400, Error{}), nil
// TODO return Response(401, Error{}), nil
// TODO return Response(404, Error{}), nil
}
// FindServingEnvironment - Find ServingEnvironment
func (s *ModelRegistryServiceAPIService) FindServingEnvironment(ctx context.Context, name string, externalID string) (ImplResponse, error) {
result, err := s.coreApi.GetServingEnvironmentByParams(&name, &externalID)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
return Response(200, result), nil
// TODO return Response(401, Error{}), nil
// TODO return Response(404, Error{}), nil
}
// GetEnvironmentInferenceServices - List All ServingEnvironment's InferenceServices
func (s *ModelRegistryServiceAPIService) GetEnvironmentInferenceServices(ctx context.Context, servingenvironmentId string, name string, externalID string, pageSize string, orderBy model.OrderByField, sortOrder model.SortOrder, nextPageToken string) (ImplResponse, error) {
listOpts, err := apiutils.BuildListOption(pageSize, orderBy, sortOrder, nextPageToken)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
result, err := s.coreApi.GetInferenceServices(listOpts, &servingenvironmentId, nil)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
return Response(200, result), nil
// TODO return Response(401, Error{}), nil
// TODO return Response(404, Error{}), nil
}
// GetInferenceService - Get a InferenceService
func (s *ModelRegistryServiceAPIService) GetInferenceService(ctx context.Context, inferenceserviceId string) (ImplResponse, error) {
result, err := s.coreApi.GetInferenceServiceById(inferenceserviceId)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
return Response(200, result), nil
// TODO: return Response(401, Error{}), nil
// TODO: return Response(404, Error{}), nil
}
// GetInferenceServiceModel - Get InferenceService's RegisteredModel
func (s *ModelRegistryServiceAPIService) GetInferenceServiceModel(ctx context.Context, inferenceserviceId string) (ImplResponse, error) {
result, err := s.coreApi.GetRegisteredModelByInferenceService(inferenceserviceId)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
return Response(200, result), nil
// TODO: return Response(401, Error{}), nil
// TODO: return Response(404, Error{}), nil
}
// GetInferenceServiceServes - List All InferenceService's ServeModel actions
func (s *ModelRegistryServiceAPIService) GetInferenceServiceServes(ctx context.Context, inferenceserviceId string, name string, externalID string, pageSize string, orderBy model.OrderByField, sortOrder model.SortOrder, nextPageToken string) (ImplResponse, error) {
listOpts, err := apiutils.BuildListOption(pageSize, orderBy, sortOrder, nextPageToken)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
result, err := s.coreApi.GetServeModels(listOpts, &inferenceserviceId)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
return Response(200, result), nil
// TODO return Response(401, Error{}), nil
// TODO return Response(404, Error{}), nil
}
// GetInferenceServiceVersion - Get InferenceService's ModelVersion
func (s *ModelRegistryServiceAPIService) GetInferenceServiceVersion(ctx context.Context, inferenceserviceId string) (ImplResponse, error) {
result, err := s.coreApi.GetModelVersionByInferenceService(inferenceserviceId)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
return Response(200, result), nil
// TODO: return Response(401, Error{}), nil
// TODO: return Response(404, Error{}), nil
}
// GetInferenceServices - List All InferenceServices
func (s *ModelRegistryServiceAPIService) GetInferenceServices(ctx context.Context, pageSize string, orderBy model.OrderByField, sortOrder model.SortOrder, nextPageToken string) (ImplResponse, error) {
listOpts, err := apiutils.BuildListOption(pageSize, orderBy, sortOrder, nextPageToken)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
result, err := s.coreApi.GetInferenceServices(listOpts, nil, nil)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
return Response(200, result), nil
// TODO return Response(401, Error{}), nil
// TODO return Response(404, Error{}), nil
}
// GetModelArtifact - Get a ModelArtifact
func (s *ModelRegistryServiceAPIService) GetModelArtifact(ctx context.Context, modelartifactId string) (ImplResponse, error) {
result, err := s.coreApi.GetModelArtifactById(modelartifactId)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
return Response(200, result), nil
// TODO: return Response(401, Error{}), nil
// TODO: return Response(404, Error{}), nil
}
// GetModelArtifacts - List All ModelArtifacts
func (s *ModelRegistryServiceAPIService) GetModelArtifacts(ctx context.Context, pageSize string, orderBy model.OrderByField, sortOrder model.SortOrder, nextPageToken string) (ImplResponse, error) {
listOpts, err := apiutils.BuildListOption(pageSize, orderBy, sortOrder, nextPageToken)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
result, err := s.coreApi.GetModelArtifacts(listOpts, nil)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
return Response(200, result), nil
// TODO return Response(400, Error{}), nil
// TODO return Response(401, Error{}), nil
// TODO return Response(404, Error{}), nil
}
// GetModelVersion - Get a ModelVersion
func (s *ModelRegistryServiceAPIService) GetModelVersion(ctx context.Context, modelversionId string) (ImplResponse, error) {
result, err := s.coreApi.GetModelVersionById(modelversionId)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
return Response(200, result), nil
// TODO: return Response(401, Error{}), nil
// TODO: return Response(404, Error{}), nil
}
// GetModelVersionArtifacts - List All ModelVersion's artifacts
func (s *ModelRegistryServiceAPIService) GetModelVersionArtifacts(ctx context.Context, modelversionId string, name string, externalID string, pageSize string, orderBy model.OrderByField, sortOrder model.SortOrder, nextPageToken string) (ImplResponse, error) {
// TODO name unused
// TODO externalID unused
listOpts, err := apiutils.BuildListOption(pageSize, orderBy, sortOrder, nextPageToken)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
result, err := s.coreApi.GetArtifacts(listOpts, &modelversionId)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
return Response(200, result), nil
// TODO return Response(401, Error{}), nil
// TODO return Response(404, Error{}), nil
}
// GetModelVersions - List All ModelVersions
func (s *ModelRegistryServiceAPIService) GetModelVersions(ctx context.Context, pageSize string, orderBy model.OrderByField, sortOrder model.SortOrder, nextPageToken string) (ImplResponse, error) {
listOpts, err := apiutils.BuildListOption(pageSize, orderBy, sortOrder, nextPageToken)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
result, err := s.coreApi.GetModelVersions(listOpts, nil)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
return Response(200, result), nil
// TODO return Response(400, Error{}), nil
// TODO return Response(401, Error{}), nil
// TODO return Response(404, Error{}), nil
}
// GetRegisteredModel - Get a RegisteredModel
func (s *ModelRegistryServiceAPIService) GetRegisteredModel(ctx context.Context, registeredmodelId string) (ImplResponse, error) {
result, err := s.coreApi.GetRegisteredModelById(registeredmodelId)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
return Response(200, result), nil
// TODO: return Response(401, Error{}), nil
// TODO: return Response(404, Error{}), nil
}
// GetRegisteredModelVersions - List All RegisteredModel's ModelVersions
func (s *ModelRegistryServiceAPIService) GetRegisteredModelVersions(ctx context.Context, registeredmodelId string, name string, externalID string, pageSize string, orderBy model.OrderByField, sortOrder model.SortOrder, nextPageToken string) (ImplResponse, error) {
// TODO name unused
// TODO externalID unused
listOpts, err := apiutils.BuildListOption(pageSize, orderBy, sortOrder, nextPageToken)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
result, err := s.coreApi.GetModelVersions(listOpts, ®isteredmodelId)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
return Response(200, result), nil
// TODO return Response(401, Error{}), nil
// TODO return Response(404, Error{}), nil
}
// GetRegisteredModels - List All RegisteredModels
func (s *ModelRegistryServiceAPIService) GetRegisteredModels(ctx context.Context, pageSize string, orderBy model.OrderByField, sortOrder model.SortOrder, nextPageToken string) (ImplResponse, error) {
listOpts, err := apiutils.BuildListOption(pageSize, orderBy, sortOrder, nextPageToken)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
result, err := s.coreApi.GetRegisteredModels(listOpts)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
return Response(200, result), nil
// TODO return Response(400, Error{}), nil
// TODO return Response(401, Error{}), nil
// TODO return Response(404, Error{}), nil
}
// GetServingEnvironment - Get a ServingEnvironment
func (s *ModelRegistryServiceAPIService) GetServingEnvironment(ctx context.Context, servingenvironmentId string) (ImplResponse, error) {
result, err := s.coreApi.GetServingEnvironmentById(servingenvironmentId)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
return Response(200, result), nil
// TODO: return Response(401, Error{}), nil
// TODO: return Response(404, Error{}), nil
}
// GetServingEnvironments - List All ServingEnvironments
func (s *ModelRegistryServiceAPIService) GetServingEnvironments(ctx context.Context, pageSize string, orderBy model.OrderByField, sortOrder model.SortOrder, nextPageToken string) (ImplResponse, error) {
listOpts, err := apiutils.BuildListOption(pageSize, orderBy, sortOrder, nextPageToken)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
result, err := s.coreApi.GetServingEnvironments(listOpts)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
return Response(200, result), nil
// TODO return Response(401, Error{}), nil
}
// UpdateInferenceService - Update a InferenceService
func (s *ModelRegistryServiceAPIService) UpdateInferenceService(ctx context.Context, inferenceserviceId string, inferenceServiceUpdate model.InferenceServiceUpdate) (ImplResponse, error) {
entity, err := s.converter.ConvertInferenceServiceUpdate(&inferenceServiceUpdate)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
entity.Id = &inferenceserviceId
result, err := s.coreApi.UpsertInferenceService(entity)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
return Response(200, result), nil
// TODO return Response(400, Error{}), nil
// TODO return Response(401, Error{}), nil
// TODO return Response(404, Error{}), nil
}
// UpdateModelArtifact - Update a ModelArtifact
func (s *ModelRegistryServiceAPIService) UpdateModelArtifact(ctx context.Context, modelartifactId string, modelArtifactUpdate model.ModelArtifactUpdate) (ImplResponse, error) {
modelArtifact, err := s.converter.ConvertModelArtifactUpdate(&modelArtifactUpdate)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
modelArtifact.Id = &modelartifactId
result, err := s.coreApi.UpsertModelArtifact(modelArtifact, nil)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
return Response(200, result), nil
// TODO return Response(400, Error{}), nil
// TODO return Response(401, Error{}), nil
// TODO return Response(404, Error{}), nil
}
// UpdateModelVersion - Update a ModelVersion
func (s *ModelRegistryServiceAPIService) UpdateModelVersion(ctx context.Context, modelversionId string, modelVersion model.ModelVersion) (ImplResponse, error) {
// TODO: this API is getting model.ModelVersion instead of model.ModelVersionUpdate.
// c, err := s.converter.ConvertModelVersionUpdate(&modelVersion)
// if err != nil {
// return Response(500, model.Error{Message: err.Error()}), nil
// }
// modelVersion.Id = &modelversionId
result, err := s.coreApi.UpsertModelVersion(&modelVersion, nil)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
return Response(200, result), nil
// TODO return Response(400, Error{}), nil
// TODO return Response(401, Error{}), nil
// TODO return Response(404, Error{}), nil
}
// UpdateRegisteredModel - Update a RegisteredModel
func (s *ModelRegistryServiceAPIService) UpdateRegisteredModel(ctx context.Context, registeredmodelId string, registeredModelUpdate model.RegisteredModelUpdate) (ImplResponse, error) {
registeredModel, err := s.converter.ConvertRegisteredModelUpdate(®isteredModelUpdate)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
registeredModel.Id = ®isteredmodelId
result, err := s.coreApi.UpsertRegisteredModel(registeredModel)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
return Response(200, result), nil
// TODO return Response(400, Error{}), nil
// TODO return Response(401, Error{}), nil
// TODO return Response(404, Error{}), nil
}
// UpdateServingEnvironment - Update a ServingEnvironment
func (s *ModelRegistryServiceAPIService) UpdateServingEnvironment(ctx context.Context, servingenvironmentId string, servingEnvironmentUpdate model.ServingEnvironmentUpdate) (ImplResponse, error) {
entity, err := s.converter.ConvertServingEnvironmentUpdate(&servingEnvironmentUpdate)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
entity.Id = &servingenvironmentId
result, err := s.coreApi.UpsertServingEnvironment(entity)
if err != nil {
return Response(500, model.Error{Message: err.Error()}), nil
}
return Response(200, result), nil
// TODO return Response(400, Error{}), nil
// TODO return Response(401, Error{}), nil
// TODO return Response(404, Error{}), nil
}