ovfexportdomain

package
v0.0.0-...-a74b21b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// InstanceNameFlagKey is key for instance name CLI flag
	InstanceNameFlagKey = "instance-name"

	// MachineImageNameFlagKey is key for machine image name CLI flag
	MachineImageNameFlagKey = "machine-image-name"

	// ClientIDFlagKey is key for client ID CLI flag
	ClientIDFlagKey = "client-id"

	// DestinationURIFlagKey is key for OVF/OVA GCS path CLI flag
	DestinationURIFlagKey = "destination-uri"

	// ReleaseTrackFlagKey is key for release track flag
	ReleaseTrackFlagKey = "release-track"

	// OvfFormatFlagKey is key for OVF format flag
	OvfFormatFlagKey = "ovf-format"

	//Alpha represents alpha release track
	Alpha = "alpha"

	//Beta represents beta release track
	Beta = "beta"

	//GA represents GA release track
	GA = "ga"
)
View Source
const TestProject = "a-project"

TestProject is a test value for project flag

View Source
const TestRegion = "us-central1"

TestRegion is a test value for region

View Source
const TestZone = "us-central1-c"

TestZone is a test value for zone flag

Variables

View Source
var TestNetwork = fmt.Sprintf("projects/%v/global/networks/%v", TestProject, "a-network")

TestNetwork is a test value for network path

View Source
var TestSubnet = fmt.Sprintf("projects/%v/regions/%v/subnetworks/%v", TestProject, TestRegion, "a-subnet")

TestSubnet is a test value for subnet path

Functions

This section is empty.

Types

type ExportedDisk

type ExportedDisk struct {
	AttachedDisk *compute.AttachedDisk
	Disk         *compute.Disk
	GcsPath      string
	GcsFileAttrs *storage.ObjectAttrs
}

ExportedDisk represents GCE disks exported to GCS disk files.

type InstanceDisksExporter

type InstanceDisksExporter interface {
	Export(*compute.Instance, *OVFExportArgs) ([]*ExportedDisk, error)
	Cancel(reason string) bool
}

InstanceDisksExporter exports disks of an instance To rebuild the mock, run `go generate ./...`

type InstanceExportCleaner

type InstanceExportCleaner interface {
	Clean(instance *compute.Instance, params *OVFExportArgs) error
	Cancel(reason string) bool
}

InstanceExportCleaner cleans a Compute Engine instance after export into OVF by re-attaching disks and starting it up if it was already started. To rebuild the mock, run `go generate ./...`

type InstanceExportPreparer

type InstanceExportPreparer interface {
	Prepare(*compute.Instance, *OVFExportArgs) error
	Cancel(reason string) bool
}

InstanceExportPreparer prepares a Compute Engine instance for export into OVF by shutting it down and detaching disks To rebuild the mock, run `go generate ./...`

type OVFExportArgs

type OVFExportArgs struct {

	// Instance export specific args
	InstanceName string

	// Machine image specific args
	MachineImageName string

	// Common args
	ClientID                    string
	ClientVersion               string
	DestinationURI              string
	DiskExportFormat            string
	OsID                        string
	Network                     string
	Subnet                      string
	NoExternalIP                bool
	Zone                        string
	Timeout                     time.Duration
	Project                     string
	ScratchBucketGcsPath        string
	Oauth                       string
	Ce                          string
	GcsLogsDisabled             bool
	CloudLogsDisabled           bool
	StdoutLogsDisabled          bool
	ReleaseTrack                string
	BuildID                     string
	ComputeServiceAccount       string
	NestedVirtualizationEnabled bool
	WorkerMachineSeries         []string

	// Non-args
	WorkflowDir string
	Region      string
	Started     time.Time
	//DestinationDirectory holds a full path to GCS directory where OVF will be saved after export. E.g. `gs://my-bucket/my-folder/`
	DestinationDirectory string
	// OvfName is a name of OVF being exported. E.g. if DestinationURI is
	//`gs://my-bucket/my-folder/vm.ovf`, OvfName will be `vm`. If a directory is
	// provided for DestinationURI, instance name will be used for OVF name
	OvfName string
}

OVFExportArgs holds args for OVF export

func GetAllInstanceExportArgs

func GetAllInstanceExportArgs() *OVFExportArgs

GetAllInstanceExportArgs returns a new OVFExportArgs reference for instance export with default values

func GetAllMachineImageExportArgs

func GetAllMachineImageExportArgs() *OVFExportArgs

GetAllMachineImageExportArgs returns a new OVFExportArgs reference for machine image export with default values

func NewOVFExportArgs

func NewOVFExportArgs(args []string) (*OVFExportArgs, error)

NewOVFExportArgs parses args to create an NewOVFExportArgs instance. No validation is done here.

func (*OVFExportArgs) EnvironmentSettings

func (args *OVFExportArgs) EnvironmentSettings(daisyLogLinePrefix string) daisyutils.EnvironmentSettings

EnvironmentSettings creates an EnvironmentSettings instance from the fields in this struct.

func (*OVFExportArgs) GetResourceName

func (args *OVFExportArgs) GetResourceName() string

GetResourceName returns name of the resource to be exported, either instance name or machine image name

func (*OVFExportArgs) IsInstanceExport

func (args *OVFExportArgs) IsInstanceExport() bool

IsInstanceExport returns true if export represented by these args is instance export. False otherwise.

func (*OVFExportArgs) IsMachineImageExport

func (args *OVFExportArgs) IsMachineImageExport() bool

IsMachineImageExport returns true if export represented by these args is a machine image export. False otherwise.

func (*OVFExportArgs) String

func (args *OVFExportArgs) String() string

type OvfDescriptorGenerator

type OvfDescriptorGenerator interface {
	GenerateAndWriteOVFDescriptor(instance *compute.Instance, exportedDisks []*ExportedDisk, bucketName, gcsDirectoryPath, descriptorFileName string, diskInspectionResult *pb.InspectionResults) error
	Cancel(reason string) bool
}

OvfDescriptorGenerator is responsible for generating OVF descriptor based on GCE instance being exported. To rebuild the mock, run `go generate ./...`

type OvfExportParamPopulator

type OvfExportParamPopulator interface {
	Populate(*OVFExportArgs) error
}

OvfExportParamPopulator populates params for OVF export To rebuild the mock, run `go generate ./...`

type OvfExportParamValidator

type OvfExportParamValidator interface {
	ValidateAndParseParams(*OVFExportArgs) error
}

OvfExportParamValidator validate params for OVF export To rebuild the mock, run `go generate ./...`

type OvfManifestGenerator

type OvfManifestGenerator interface {
	GenerateAndWriteToGCS(gcsPath, manifestFileName string) error
	Cancel(reason string) bool
}

OvfManifestGenerator generates a manifest file for all files under a Cloud Storage path and writes it to a file under the same path To rebuild the mock, run `go generate ./...`

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL