2020-11-30 05:27:45 -05:00
|
|
|
//go:generate struct-markdown
|
|
|
|
package yandexexport
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
2020-12-17 16:29:25 -05:00
|
|
|
packersdk "github.com/hashicorp/packer-plugin-sdk/packer"
|
2020-11-30 05:27:45 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
type ExchangeConfig struct {
|
|
|
|
// Service Account ID with proper permission to modify an instance, create and attach disk and
|
|
|
|
// make upload to specific Yandex Object Storage paths.
|
|
|
|
ServiceAccountID string `mapstructure:"service_account_id" required:"true"`
|
|
|
|
}
|
|
|
|
|
2020-12-03 04:27:13 -05:00
|
|
|
func (c *ExchangeConfig) Prepare(errs *packersdk.MultiError) *packersdk.MultiError {
|
2020-11-30 05:27:45 -05:00
|
|
|
if c.ServiceAccountID == "" {
|
2020-12-03 04:27:13 -05:00
|
|
|
errs = packersdk.MultiErrorAppend(
|
2020-11-30 05:27:45 -05:00
|
|
|
errs, fmt.Errorf("service_account_id must be specified"))
|
|
|
|
}
|
|
|
|
|
|
|
|
return errs
|
|
|
|
}
|