2023-04-20 21:42:52 +00:00
|
|
|
package registry
|
|
|
|
|
|
|
|
import (
|
|
|
|
portainer "github.com/portainer/portainer/api"
|
2023-06-20 20:51:34 +00:00
|
|
|
"github.com/portainer/portainer/api/dataservices"
|
2023-04-20 21:42:52 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type ServiceTx struct {
|
2023-06-22 21:28:07 +00:00
|
|
|
dataservices.BaseDataServiceTx[portainer.Registry, portainer.RegistryID]
|
2023-04-20 21:42:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Create creates a new registry.
|
|
|
|
func (service ServiceTx) Create(registry *portainer.Registry) error {
|
2023-06-22 21:28:07 +00:00
|
|
|
return service.Tx.CreateObject(
|
2023-04-20 21:42:52 +00:00
|
|
|
BucketName,
|
|
|
|
func(id uint64) (int, interface{}) {
|
|
|
|
registry.ID = portainer.RegistryID(id)
|
|
|
|
return int(registry.ID), registry
|
|
|
|
},
|
|
|
|
)
|
|
|
|
}
|