github.com/jfrog/jfrog-cli-go@v1.22.1-0.20200318093948-4826ef344ffd/artifactory/commands/distribution/signBundle.go (about)

     1  package distribution
     2  
     3  import (
     4  	"github.com/jfrog/jfrog-cli-go/artifactory/utils"
     5  	"github.com/jfrog/jfrog-cli-go/utils/config"
     6  	"github.com/jfrog/jfrog-client-go/distribution/services"
     7  )
     8  
     9  type SignBundleCommand struct {
    10  	rtDetails         *config.ArtifactoryDetails
    11  	signBundlesParams services.SignBundleParams
    12  }
    13  
    14  func NewReleaseBundleSignCommand() *SignBundleCommand {
    15  	return &SignBundleCommand{}
    16  }
    17  
    18  func (sb *SignBundleCommand) SetRtDetails(rtDetails *config.ArtifactoryDetails) *SignBundleCommand {
    19  	sb.rtDetails = rtDetails
    20  	return sb
    21  }
    22  
    23  func (sb *SignBundleCommand) SetReleaseBundleSignParams(params services.SignBundleParams) *SignBundleCommand {
    24  	sb.signBundlesParams = params
    25  	return sb
    26  }
    27  
    28  func (sb *SignBundleCommand) Run() error {
    29  	servicesManager, err := utils.CreateDistributionServiceManager(sb.rtDetails, false)
    30  	if err != nil {
    31  		return err
    32  	}
    33  
    34  	return servicesManager.SignReleaseBundle(sb.signBundlesParams)
    35  }
    36  
    37  func (sb *SignBundleCommand) RtDetails() (*config.ArtifactoryDetails, error) {
    38  	return sb.rtDetails, nil
    39  }
    40  
    41  func (sb *SignBundleCommand) CommandName() string {
    42  	return "rt_sign_bundle"
    43  }