func validateAndPopulateParams(params *ovfexportdomain.OVFExportArgs,
	paramValidator ovfexportdomain.OvfExportParamValidator,
	paramPopulator ovfexportdomain.OvfExportParamPopulator) error {
	if err := paramValidator.ValidateAndParseParams(params); err != nil {
		return err
	}
	if err := paramPopulator.Populate(params); err != nil {
		return err
	}
	return nil
}
validateAndPopulateParams validate and populate OVF export params
package ovfexporter
import (
	"context"
	"fmt"
	"strings"
	"google.golang.org/api/compute/v1"
	"google.golang.org/api/option"
	commondisk "github.com/GoogleCloudPlatform/compute-image-tools/cli_tools/common/disk"
	"github.com/GoogleCloudPlatform/compute-image-tools/cli_tools/common/domain"
	computeutils "github.com/GoogleCloudPlatform/compute-image-tools/cli_tools/common/utils/compute"
	"github.com/GoogleCloudPlatform/compute-image-tools/cli_tools/common/utils/logging"
	"github.com/GoogleCloudPlatform/compute-image-tools/cli_tools/common/utils/logging/service"
	storageutils "github.com/GoogleCloudPlatform/compute-image-tools/cli_tools/common/utils/storage"
	"github.com/GoogleCloudPlatform/compute-image-tools/cli_tools/gce_ovf_export/domain"
	"github.com/GoogleCloudPlatform/compute-image-tools/daisy"
	daisycompute "github.com/GoogleCloudPlatform/compute-image-tools/daisy/compute"
	"github.com/GoogleCloudPlatform/compute-image-tools/proto/go/pb"
)
const (
	LogPrefix  = "[ovf-export]"
	bytesPerGB = int64(1024 * 1024 * 1024)
)
type OVFExporter struct {
	storageClient          domain.StorageClientInterface
	computeClient          daisycompute.Client
	mgce                   domain.MetadataGCEInterface
	bucketIteratorCreator  domain.BucketIteratorCreatorInterface
	Logger                 logging.Logger
	instanceDisksExporter  ovfexportdomain.InstanceDisksExporter
	instanceExportPreparer ovfexportdomain.InstanceExportPreparer
	instanceExportCleaner  ovfexportdomain.InstanceExportCleaner
	params                 *ovfexportdomain.OVFExportArgs
	BuildID string
	inspector                 commondisk.Inspector
	ovfDescriptorGenerator    ovfexportdomain.OvfDescriptorGenerator
	manifestFileGenerator     ovfexportdomain.OvfManifestGenerator
	exportedDisks             []*ovfexportdomain.ExportedDisk
	bootDiskInspectionResults *pb.InspectionResults
	loggableBuilder           *service.OvfExportLoggableBuilder
}
func NewOVFExporter(params *ovfexportdomain.OVFExportArgs, logger logging.ToolLogger) (*OVFExporter, error) {
	ctx := context.Background()
	storageClient, err := storageutils.NewStorageClient(ctx, logger)
	if err != nil {
		return nil, err
	}
	computeClient, err := createComputeClient(&ctx, params)
	if err != nil {
		return nil, err
	}
	metadataGCE := &computeutils.MetadataGCE{}
	paramValidator := NewOvfExportParamValidator(computeClient)
	paramPopulator := NewPopulator(computeClient, metadataGCE, storageClient,
		storageutils.NewResourceLocationRetriever(metadataGCE, computeClient),
		storageutils.NewScratchBucketCreator(ctx, storageClient),
	)
	if err := validateAndPopulateParams(params, paramValidator, paramPopulator); err != nil {
		return nil, err
	}
	inspector, err := commondisk.NewInspector(params.EnvironmentSettings("ovf-export-disk-inspect"), logger)
	if err != nil {
		return nil, daisy.Errf("Error creating disk inspector: %v", err)
	}
	return &OVFExporter{
		storageClient:          storageClient,
		computeClient:          computeClient,
		mgce:                   metadataGCE,
		bucketIteratorCreator:  &storageutils.BucketIteratorCreator{},
		Logger:                 logger,
		params:                 params,
		loggableBuilder:        service.NewOvfExportLoggableBuilder(),
		ovfDescriptorGenerator: NewOvfDescriptorGenerator(computeClient, storageClient, params.Project, params.Zone),
		manifestFileGenerator:  NewManifestFileGenerator(storageClient),
		inspector:              inspector,
		instanceDisksExporter:  NewInstanceDisksExporter(computeClient, storageClient, logger),
		instanceExportPreparer: NewInstanceExportPreparer(logger),
		instanceExportCleaner:  NewInstanceExportCleaner(logger),
	}, nil
}