github.com/osievert/jfrog-cli-core@v1.2.7/artifactory/commands/container/promote.go (about)

     1  package container
     2  
     3  import (
     4  	"github.com/jfrog/jfrog-cli-core/artifactory/utils"
     5  	"github.com/jfrog/jfrog-cli-core/utils/config"
     6  	"github.com/jfrog/jfrog-client-go/artifactory/services"
     7  )
     8  
     9  type DockerPromoteCommand struct {
    10  	rtDetails *config.ArtifactoryDetails
    11  	params    services.DockerPromoteParams
    12  }
    13  
    14  func NewDockerPromoteCommand() *DockerPromoteCommand {
    15  	return &DockerPromoteCommand{}
    16  }
    17  
    18  func (dp *DockerPromoteCommand) Run() error {
    19  	// Create Service Manager
    20  	servicesManager, err := utils.CreateServiceManager(dp.rtDetails, false)
    21  	if err != nil {
    22  		return err
    23  	}
    24  	// Promote docker
    25  	return servicesManager.PromoteDocker(dp.params)
    26  }
    27  
    28  func (dp *DockerPromoteCommand) CommandName() string {
    29  	return "rt_docker_promote"
    30  }
    31  
    32  func (dp *DockerPromoteCommand) RtDetails() (*config.ArtifactoryDetails, error) {
    33  	return dp.rtDetails, nil
    34  }
    35  
    36  func (dp *DockerPromoteCommand) SetRtDetails(rtDetails *config.ArtifactoryDetails) *DockerPromoteCommand {
    37  	dp.rtDetails = rtDetails
    38  	return dp
    39  }
    40  
    41  func (dp *DockerPromoteCommand) SetParams(params services.DockerPromoteParams) *DockerPromoteCommand {
    42  	dp.params = params
    43  	return dp
    44  }