github.com/mmcquillan/packer@v1.1.1-0.20171009221028-c85cf0483a5d/builder/azure/arm/step_set_certificate.go (about)

     1  package arm
     2  
     3  import (
     4  	"github.com/hashicorp/packer/builder/azure/common/constants"
     5  	"github.com/hashicorp/packer/packer"
     6  	"github.com/mitchellh/multistep"
     7  )
     8  
     9  type StepSetCertificate struct {
    10  	config *Config
    11  	say    func(message string)
    12  	error  func(e error)
    13  }
    14  
    15  func NewStepSetCertificate(config *Config, ui packer.Ui) *StepSetCertificate {
    16  	var step = &StepSetCertificate{
    17  		config: config,
    18  		say:    func(message string) { ui.Say(message) },
    19  		error:  func(e error) { ui.Error(e.Error()) },
    20  	}
    21  
    22  	return step
    23  }
    24  
    25  func (s *StepSetCertificate) Run(state multistep.StateBag) multistep.StepAction {
    26  	s.say("Setting the certificate's URL ...")
    27  
    28  	var winRMCertificateUrl = state.Get(constants.ArmCertificateUrl).(string)
    29  	s.config.tmpWinRMCertificateUrl = winRMCertificateUrl
    30  
    31  	return multistep.ActionContinue
    32  }
    33  
    34  func (*StepSetCertificate) Cleanup(multistep.StateBag) {
    35  }