1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-02 20:35:25 +02:00

feat(resourcecontrol): add support for transactions EE-5431 (#8901)

This commit is contained in:
andres-portainer 2023-05-04 13:24:04 -03:00 committed by GitHub
parent 706d66a76e
commit a062a0bfbe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 125 additions and 5 deletions

View file

@ -8,10 +8,8 @@ import (
"github.com/rs/zerolog/log"
)
const (
// BucketName represents the name of the bucket where this service stores data.
BucketName = "resource_control"
)
// BucketName represents the name of the bucket where this service stores data.
const BucketName = "resource_control"
// Service represents a service for managing environment(endpoint) data.
type Service struct {
@ -34,6 +32,13 @@ func NewService(connection portainer.Connection) (*Service, error) {
}, nil
}
func (service *Service) Tx(tx portainer.Transaction) ServiceTx {
return ServiceTx{
service: service,
tx: tx,
}
}
// ResourceControl returns a ResourceControl object by ID
func (service *Service) ResourceControl(ID portainer.ResourceControlID) (*portainer.ResourceControl, error) {
var resourceControl portainer.ResourceControl