github.com/yoctocloud/packer@v0.6.2-0.20160520224004-e11a0a18423f/builder/azure/arm/step_set_certificate.go (about) 1 // Copyright (c) Microsoft Corporation. All rights reserved. 2 // Licensed under the MIT License. See the LICENSE file in builder/azure for license information. 3 4 package arm 5 6 import ( 7 "github.com/mitchellh/multistep" 8 "github.com/mitchellh/packer/builder/azure/common/constants" 9 "github.com/mitchellh/packer/packer" 10 ) 11 12 type StepSetCertificate struct { 13 config *Config 14 say func(message string) 15 error func(e error) 16 } 17 18 func NewStepSetCertificate(config *Config, ui packer.Ui) *StepSetCertificate { 19 var step = &StepSetCertificate{ 20 config: config, 21 say: func(message string) { ui.Say(message) }, 22 error: func(e error) { ui.Error(e.Error()) }, 23 } 24 25 return step 26 } 27 28 func (s *StepSetCertificate) Run(state multistep.StateBag) multistep.StepAction { 29 s.say("Setting the certificate's URL ...") 30 31 var winRMCertificateUrl = state.Get(constants.ArmCertificateUrl).(string) 32 s.config.tmpWinRMCertificateUrl = winRMCertificateUrl 33 34 state.Put(constants.ArmTemplateParameters, s.config.toTemplateParameters()) 35 return multistep.ActionContinue 36 } 37 38 func (*StepSetCertificate) Cleanup(multistep.StateBag) { 39 }