github.com/jfrog/jfrog-cli-go@v1.22.1-0.20200318093948-4826ef344ffd/artifactory/commands/generic/setprops.go (about) 1 package generic 2 3 import ( 4 "github.com/jfrog/jfrog-client-go/utils/errorutils" 5 ) 6 7 type SetPropsCommand struct { 8 PropsCommand 9 } 10 11 func NewSetPropsCommand() *SetPropsCommand { 12 return &SetPropsCommand{} 13 } 14 15 func (setProps *SetPropsCommand) SetPropsCommand(command PropsCommand) *SetPropsCommand { 16 setProps.PropsCommand = command 17 return setProps 18 } 19 20 func (setProps *SetPropsCommand) CommandName() string { 21 return "rt_set_properties" 22 } 23 24 func (setProps *SetPropsCommand) Run() error { 25 rtDetails, err := setProps.RtDetails() 26 if errorutils.CheckError(err) != nil { 27 return err 28 } 29 servicesManager, err := createPropsServiceManager(setProps.threads, rtDetails) 30 if err != nil { 31 return err 32 } 33 34 resultItems, searchErr := searchItems(setProps.Spec(), servicesManager) 35 36 propsParams := GetPropsParams(resultItems, setProps.props) 37 success, err := servicesManager.SetProps(propsParams) 38 39 result := setProps.Result() 40 result.SetSuccessCount(success) 41 result.SetFailCount(len(resultItems) - success) 42 if err == nil { 43 return searchErr 44 } 45 return err 46 }