mirror of
https://github.com/portainer/portainer.git
synced 2025-07-22 14:59:41 +02:00
* feat(jobs): adding the ability to run scripts on endpoints fix(job): click on containerId in JobsDatatable redirects to container's logs refactor(job): remove the jobs datatable settings + texts changes on JobCreation view fix(jobs): jobs payloads are now following API rules and case feat(jobs): adding the capability to run scripts on hosts * feat(jobs): adding the ability to purge jobs containers * refactor(job): apply review changes * feat(job-creation): store image name in local storage * feat(host): disable job exec link in non-agent Swarm setup * feat(host): only display execute job in agent setups or standalone * feat(job): job execution overhaul * docs(swagger): update EndpointJob documentation
28 lines
685 B
Go
28 lines
685 B
Go
package docker
|
|
|
|
import (
|
|
"github.com/portainer/portainer"
|
|
)
|
|
|
|
// Snapshotter represents a service used to create endpoint snapshots
|
|
type Snapshotter struct {
|
|
clientFactory *ClientFactory
|
|
}
|
|
|
|
// NewSnapshotter returns a new Snapshotter instance
|
|
func NewSnapshotter(clientFactory *ClientFactory) *Snapshotter {
|
|
return &Snapshotter{
|
|
clientFactory: clientFactory,
|
|
}
|
|
}
|
|
|
|
// CreateSnapshot creates a snapshot of a specific endpoint
|
|
func (snapshotter *Snapshotter) CreateSnapshot(endpoint *portainer.Endpoint) (*portainer.Snapshot, error) {
|
|
cli, err := snapshotter.clientFactory.CreateClient(endpoint, "")
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer cli.Close()
|
|
|
|
return snapshot(cli)
|
|
}
|