Updating documentation & API endpoint for container copy
This commit is contained in:
@@ -18,6 +18,31 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func ContainerCopy(cbp *wwapiv1.ContainerCopyParameter) (err error) {
|
||||
if cbp == nil {
|
||||
return fmt.Errorf("ContainerCopyParameter is nil")
|
||||
}
|
||||
|
||||
if !container.DoesSourceExist(cbp.ContainerSource) {
|
||||
return fmt.Errorf("Container %s does not exists.", cbp.ContainerSource)
|
||||
}
|
||||
|
||||
if !container.ValidName(cbp.ContainerDestination) {
|
||||
return fmt.Errorf("Container name contains illegal characters : %s", cbp.ContainerDestination)
|
||||
}
|
||||
|
||||
if container.DoesSourceExist(cbp.ContainerDestination) {
|
||||
return fmt.Errorf("An other container with the name %s already exists", cbp.ContainerDestination)
|
||||
}
|
||||
|
||||
err = container.Duplicate(cbp.ContainerSource, cbp.ContainerDestination)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not duplicate image: %s", err.Error())
|
||||
}
|
||||
|
||||
return fmt.Errorf("Container %s has been succesfully duplicated as %s", cbp.ContainerSource, cbp.ContainerDestination)
|
||||
}
|
||||
|
||||
func ContainerBuild(cbp *wwapiv1.ContainerBuildParameter) (err error) {
|
||||
if cbp == nil {
|
||||
return fmt.Errorf("ContainerBuildParameter is nil")
|
||||
|
||||
Reference in New Issue
Block a user