Rename PortainerClient.UpdateStack() to StackUpdate()

This commit is contained in:
Juan Carlos Mejías Rodríguez 2019-08-26 01:19:41 -04:00
parent 00b7daae73
commit ea63f26ee0
2 changed files with 6 additions and 6 deletions

View File

@ -47,10 +47,10 @@ type PortainerClient interface {
StackCreateSwarm(stackName string, environmentVariables []portainer.Pair, stackFileContent string, swarmClusterID string, endpointID portainer.EndpointID) (stack portainer.Stack, err error) StackCreateSwarm(stackName string, environmentVariables []portainer.Pair, stackFileContent string, swarmClusterID string, endpointID portainer.EndpointID) (stack portainer.Stack, err error)
// Create compose stack // Create compose stack
CreateComposeStack(stackName string, environmentVariables []portainer.Pair, stackFileContent string, endpointID portainer.EndpointID) (stack portainer.Stack, err error) StackCreateCompose(stackName string, environmentVariables []portainer.Pair, stackFileContent string, endpointID portainer.EndpointID) (stack portainer.Stack, err error)
// Update stack // Update stack
UpdateStack(stack portainer.Stack, environmentVariables []portainer.Pair, stackFileContent string, prune bool, endpointID portainer.EndpointID) error StackUpdate(stack portainer.Stack, environmentVariables []portainer.Pair, stackFileContent string, prune bool, endpointID portainer.EndpointID) error
// Delete stack // Delete stack
DeleteStack(stackID portainer.StackID) error DeleteStack(stackID portainer.StackID) error
@ -256,7 +256,7 @@ func (n *portainerClientImp) StackCreateSwarm(stackName string, environmentVaria
return return
} }
func (n *portainerClientImp) CreateComposeStack(stackName string, environmentVariables []portainer.Pair, stackFileContent string, endpointID portainer.EndpointID) (stack portainer.Stack, err error) { func (n *portainerClientImp) StackCreateCompose(stackName string, environmentVariables []portainer.Pair, stackFileContent string, endpointID portainer.EndpointID) (stack portainer.Stack, err error) {
reqBody := StackCreateRequest{ reqBody := StackCreateRequest{
Name: stackName, Name: stackName,
Env: environmentVariables, Env: environmentVariables,
@ -267,7 +267,7 @@ func (n *portainerClientImp) CreateComposeStack(stackName string, environmentVar
return return
} }
func (n *portainerClientImp) UpdateStack(stack portainer.Stack, environmentVariables []portainer.Pair, stackFileContent string, prune bool, endpointID portainer.EndpointID) (err error) { func (n *portainerClientImp) StackUpdate(stack portainer.Stack, environmentVariables []portainer.Pair, stackFileContent string, prune bool, endpointID portainer.EndpointID) (err error) {
reqBody := StackUpdateRequest{ reqBody := StackUpdateRequest{
Env: environmentVariables, Env: environmentVariables,
StackFileContent: stackFileContent, StackFileContent: stackFileContent,

View File

@ -115,7 +115,7 @@ var stackDeployCmd = &cobra.Command{
logrus.WithFields(logrus.Fields{ logrus.WithFields(logrus.Fields{
"stack": retrievedStack.Name, "stack": retrievedStack.Name,
}).Info("Updating stack") }).Info("Updating stack")
err := portainerClient.UpdateStack(retrievedStack, newEnvironmentVariables, stackFileContent, viper.GetBool("stack.deploy.prune"), endpoint.ID) err := portainerClient.StackUpdate(retrievedStack, newEnvironmentVariables, stackFileContent, viper.GetBool("stack.deploy.prune"), endpoint.ID)
common.CheckError(err) common.CheckError(err)
} else if stackRetrievalErr == common.ErrStackNotFound { } else if stackRetrievalErr == common.ErrStackNotFound {
// We are deploying a new stack // We are deploying a new stack
@ -148,7 +148,7 @@ var stackDeployCmd = &cobra.Command{
"stack": stackName, "stack": stackName,
"endpoint": endpoint.Name, "endpoint": endpoint.Name,
}).Info("Creating stack") }).Info("Creating stack")
stack, deploymentErr := portainerClient.CreateComposeStack(stackName, loadedEnvironmentVariables, stackFileContent, endpoint.ID) stack, deploymentErr := portainerClient.StackCreateCompose(stackName, loadedEnvironmentVariables, stackFileContent, endpoint.ID)
common.CheckError(deploymentErr) common.CheckError(deploymentErr)
logrus.WithFields(logrus.Fields{ logrus.WithFields(logrus.Fields{
"stack": stack.Name, "stack": stack.Name,