Documentation
¶
Index ¶
- Constants
- func Hash(s string) string
- func RunWithServerLogging(action string, params InputParams, projectPointer *string, ...) error
- type CommonParams
- type ComputeImageToolsLogExtension
- type ImageExportParams
- type ImageImportParams
- type InputParams
- type InstanceExportParams
- type InstanceImportParams
- type Loggable
- type Logger
- type MachineImageExportParams
- type MachineImageImportParams
- type OnestepImageImportParams
- type OutputInfo
- type OvfExportLoggableBuilder
- func (b *OvfExportLoggableBuilder) AppendTraceLogs(traceLogs []string) *OvfExportLoggableBuilder
- func (b *OvfExportLoggableBuilder) Build() Loggable
- func (w OvfExportLoggableBuilder) GetInspectionResults() *pb.InspectionResults
- func (w OvfExportLoggableBuilder) GetValue(key string) string
- func (w OvfExportLoggableBuilder) GetValueAsBool(key string) bool
- func (w OvfExportLoggableBuilder) GetValueAsInt64Slice(key string) []int64
- func (w OvfExportLoggableBuilder) ReadSerialPortLogs() []string
- func (b *OvfExportLoggableBuilder) SetDiskSizes(sourceSizes []int64, targetSizes []int64) *OvfExportLoggableBuilder
- type SingleImageImportLoggableBuilder
- func (b *SingleImageImportLoggableBuilder) AppendTraceLogs(traceLogs []string) *SingleImageImportLoggableBuilder
- func (b *SingleImageImportLoggableBuilder) Build() Loggable
- func (w SingleImageImportLoggableBuilder) GetInspectionResults() *pb.InspectionResults
- func (w SingleImageImportLoggableBuilder) GetValue(key string) string
- func (w SingleImageImportLoggableBuilder) GetValueAsBool(key string) bool
- func (w SingleImageImportLoggableBuilder) GetValueAsInt64Slice(key string) []int64
- func (w SingleImageImportLoggableBuilder) ReadSerialPortLogs() []string
- func (b *SingleImageImportLoggableBuilder) SetDiskAttributes(fileFormat string, sourceSize int64, targetSize int64) *SingleImageImportLoggableBuilder
- func (b *SingleImageImportLoggableBuilder) SetInflationAttributes(matchResult string, inflationTypeStr string, inflationTimeInt64 int64, ...) *SingleImageImportLoggableBuilder
- func (b *SingleImageImportLoggableBuilder) SetInspectionResults(inspectionResults *pb.InspectionResults) *SingleImageImportLoggableBuilder
- func (b *SingleImageImportLoggableBuilder) SetUEFIMetrics(isUEFICompatibleImageBool bool, isUEFIDetectedBool bool, biosBootableBool bool, ...) *SingleImageImportLoggableBuilder
- type WindowsUpgradeParams
Constants ¶
const ( ImageImportAction = "ImageImport" ImageExportAction = "ImageExport" InstanceImportAction = "InstanceImport" MachineImageImportAction = "MachineImageImport" OneStepImageImportAction = "OneStepImageImport" WindowsUpgrade = "WindowsUpgrade" InstanceExportAction = "InstanceExport" MachineImageExportAction = "MachineImageExport" )
constants used by logging
Variables ¶
This section is empty.
Functions ¶
func RunWithServerLogging ¶
func RunWithServerLogging(action string, params InputParams, projectPointer *string, function func() (Loggable, error)) error
RunWithServerLogging runs the function with server logging
Types ¶
type CommonParams ¶
type CommonParams struct {
ClientID string `json:"client_id,omitempty"`
ClientVersion string `json:"client_version,omitempty"`
Network string `json:"network,omitempty"`
Subnet string `json:"subnet,omitempty"`
Zone string `json:"zone,omitempty"`
Timeout string `json:"timeout,omitempty"`
Project string `json:"project,omitempty"`
ObfuscatedProject string `json:"obfuscated_project,omitempty"`
Labels string `json:"labels,omitempty"`
ScratchBucketGcsPath string `json:"scratch_bucket_gcs_path,omitempty"`
Oauth string `json:"oauth,omitempty"`
ComputeEndpointOverride string `json:"compute_endpoint_override,omitempty"`
DisableGcsLogging bool `json:"disable_gcs_logging"`
DisableCloudLogging bool `json:"disable_cloud_logging"`
DisableStdoutLogging bool `json:"disable_stdout_logging"`
}
CommonParams is only used to organize the code without impacting hierarchy of data
type ComputeImageToolsLogExtension ¶
type ComputeImageToolsLogExtension struct {
// This id is a random guid for correlation among multiple log lines of a single call
ID string `json:"id"`
CloudBuildID string `json:"cloud_build_id"`
ToolAction string `json:"tool_action"`
Status string `json:"status"`
ElapsedTimeMs int64 `json:"elapsed_time_ms"`
EventTimeMs int64 `json:"event_time_ms"`
InputParams *InputParams `json:"input_params,omitempty"`
OutputInfo *OutputInfo `json:"output_info,omitempty"`
}
ComputeImageToolsLogExtension contains all log info, which should be align with sawmill server side configuration.
type ImageExportParams ¶
type ImageExportParams struct {
*CommonParams
DestinationURI string `json:"destination_uri,omitempty"`
SourceImage string `json:"source_image,omitempty"`
Format string `json:"format,omitempty"`
ComputeServiceAccount string `json:"compute_service_account,omitempty"`
SourceDiskSnapshot string `json:"source_disk_snapshot,omitempty"`
}
ImageExportParams contains all input params for image export
type ImageImportParams ¶
type ImageImportParams struct {
*CommonParams
ImageName string `json:"image_name,omitempty"`
DataDisk bool `json:"data_disk"`
OS string `json:"os,omitempty"`
SourceFile string `json:"source_file,omitempty"`
SourceImage string `json:"source_image,omitempty"`
NoGuestEnvironment bool `json:"no_guest_environment"`
Family string `json:"family,omitempty"`
Description string `json:"description,omitempty"`
NoExternalIP bool `json:"no_external_ip"`
HasKmsKey bool `json:"has_kms_key"`
HasKmsKeyring bool `json:"has_kms_keyring"`
HasKmsLocation bool `json:"has_kms_location"`
HasKmsProject bool `json:"has_kms_project"`
StorageLocation string `json:"storage_location,omitempty"`
InspectionResults *pb.InspectionResults `json:"inspection_results,omitempty"`
ComputeServiceAccount string `json:"compute_service_account,omitempty"`
}
ImageImportParams contains all input params for image import
type InputParams ¶
type InputParams struct {
ImageImportParams *ImageImportParams `json:"image_import_input_params,omitempty"`
ImageExportParams *ImageExportParams `json:"image_export_input_params,omitempty"`
InstanceImportParams *InstanceImportParams `json:"instance_import_input_params,omitempty"`
MachineImageImportParams *MachineImageImportParams `json:"machine_image_import_input_params,omitempty"`
WindowsUpgradeParams *WindowsUpgradeParams `json:"windows_upgrade_input_params,omitempty"`
OnestepImageImportParams *OnestepImageImportParams `json:"onestep_image_import_input_params,omitempty"`
InstanceExportParams *InstanceExportParams `json:"instance_export_input_params,omitempty"`
MachineImageExportParams *MachineImageExportParams `json:"machine_image_export_input_params,omitempty"`
}
InputParams contains the union of all APIs' param info. To simplify logging service, we avoid defining different schemas for each API.
type InstanceExportParams ¶
type InstanceExportParams struct {
*CommonParams
DestinationURI string `json:"destination_uri,omitempty"`
InstanceName string `json:"instance_name,omitempty"`
OvfFormat string `json:"ovf_format,omitempty"`
DiskExportFormat string `json:"disk_export_format,omitempty"`
NoExternalIP bool `json:"no_external_ip,omitempty"`
OS string `json:"os,omitempty"`
}
InstanceExportParams contains all input params for instance export
type InstanceImportParams ¶
type InstanceImportParams struct {
*CommonParams
InstanceName string `json:"instance_name,omitempty"`
OvfGcsPath string `json:"ovf_gcs_path,omitempty"`
CanIPForward bool `json:"can_ip_forward"`
DeletionProtection bool `json:"deletion_protection"`
MachineType string `json:"machine_type,omitempty"`
NetworkInterface string `json:"network_interface,omitempty"`
NetworkTier string `json:"network_tier,omitempty"`
PrivateNetworkIP string `json:"private_network_ip,omitempty"`
NoExternalIP bool `json:"no_external_ip,omitempty"`
NoRestartOnFailure bool `json:"no_restart_on_failure"`
OS string `json:"os,omitempty"`
ShieldedIntegrityMonitoring bool `json:"shielded_integrity_monitoring"`
ShieldedSecureBoot bool `json:"shielded_secure_boot"`
ShieldedVtpm bool `json:"shielded_vtpm"`
Tags string `json:"tags,omitempty"`
HasBootDiskKmsKey bool `json:"has_boot_disk_kms_key"`
HasBootDiskKmsKeyring bool `json:"has_boot_disk_kms_keyring"`
HasBootDiskKmsLocation bool `json:"has_boot_disk_kms_location"`
HasBootDiskKmsProject bool `json:"has_boot_disk_kms_project"`
NoGuestEnvironment bool `json:"no_guest_environment"`
NodeAffinityLabel string `json:"node_affinity_label,omitempty"`
ComputeServiceAccount string `json:"compute_service_account,omitempty"`
}
InstanceImportParams contains all input params for instance import
type Loggable ¶
type Loggable interface {
GetValue(key string) string
GetValueAsBool(key string) bool
GetValueAsInt64Slice(key string) []int64
GetInspectionResults() *pb.InspectionResults
ReadSerialPortLogs() []string
}
Loggable contains fields relevant to import and export logging.
func NewOutputInfoLoggable ¶
func NewOutputInfoLoggable(outputInfo *pb.OutputInfo) Loggable
NewOutputInfoLoggable returns a Loggable that is bacaked by a concrete instance of pb.OutputInfo. It's intended as a temporary shim while we transition tools to use the ToolLogger type.
type Logger ¶
type Logger struct {
ServerURL string
ID string
Action string
TimeStart time.Time
Params InputParams
// contains filtered or unexported fields
}
Logger is responsible for logging to firelog server
func NewLoggingServiceLogger ¶
func NewLoggingServiceLogger(action string, params InputParams) *Logger
NewLoggingServiceLogger creates a new server logger
type MachineImageExportParams ¶
type MachineImageExportParams struct {
*CommonParams
DestinationURI string `json:"destination_uri,omitempty"`
MachineImageName string `json:"machine_image_name,omitempty"`
OvfFormat string `json:"ovf_format,omitempty"`
DiskExportFormat string `json:"disk_export_format,omitempty"`
NoExternalIP bool `json:"no_external_ip,omitempty"`
OS string `json:"os,omitempty"`
}
MachineImageExportParams contains all input params for instance export
type MachineImageImportParams ¶
type MachineImageImportParams struct {
*CommonParams
MachineImageName string `json:"machine_image_name,omitempty"`
OvfGcsPath string `json:"ovf_gcs_path,omitempty"`
CanIPForward bool `json:"can_ip_forward"`
DeletionProtection bool `json:"deletion_protection"`
MachineType string `json:"machine_type,omitempty"`
NetworkInterface string `json:"network_interface,omitempty"`
NetworkTier string `json:"network_tier,omitempty"`
PrivateNetworkIP string `json:"private_network_ip,omitempty"`
NoExternalIP bool `json:"no_external_ip,omitempty"`
NoRestartOnFailure bool `json:"no_restart_on_failure"`
OS string `json:"os,omitempty"`
ShieldedIntegrityMonitoring bool `json:"shielded_integrity_monitoring"`
ShieldedSecureBoot bool `json:"shielded_secure_boot"`
ShieldedVtpm bool `json:"shielded_vtpm"`
Tags string `json:"tags,omitempty"`
HasBootDiskKmsKey bool `json:"has_boot_disk_kms_key"`
HasBootDiskKmsKeyring bool `json:"has_boot_disk_kms_keyring"`
HasBootDiskKmsLocation bool `json:"has_boot_disk_kms_location"`
HasBootDiskKmsProject bool `json:"has_boot_disk_kms_project"`
NoGuestEnvironment bool `json:"no_guest_environment"`
NodeAffinityLabel string `json:"node_affinity_label,omitempty"`
Hostname string `json:"hostname,omitempty"`
MachineImageStorageLocation string `json:"machine_image_storage_location,omitempty"`
ComputeServiceAccount string `json:"compute_service_account,omitempty"`
}
MachineImageImportParams contains all input params for machine image import
type OnestepImageImportParams ¶
type OnestepImageImportParams struct {
*CommonParams
// Image import params
ImageName string `json:"image_name,omitempty"`
OS string `json:"os,omitempty"`
NoGuestEnvironment bool `json:"no_guest_environment"`
Family string `json:"family,omitempty"`
Description string `json:"description,omitempty"`
NoExternalIP bool `json:"no_external_ip"`
HasKmsKey bool `json:"has_kms_key"`
HasKmsKeyring bool `json:"has_kms_keyring"`
HasKmsLocation bool `json:"has_kms_location"`
HasKmsProject bool `json:"has_kms_project"`
StorageLocation string `json:"storage_location,omitempty"`
ComputeServiceAccount string `json:"compute_service_account,omitempty"`
// AWS related params
AWSAMIID string `json:"aws_ami_id,omitempty"`
AWSAMIExportLocation string `json:"aws_ami_export_location,omitempty"`
AWSSourceAMIFilePath string `json:"aws_source_ami_file_path,omitempty"`
}
OnestepImageImportParams contains all input params for onestep image import
type OutputInfo ¶
type OutputInfo struct {
// Size of import/export sources (image or file)
SourcesSizeGb []int64 `json:"sources_size_gb,omitempty"`
// Size of import/export targets (image or file)
TargetsSizeGb []int64 `json:"targets_size_gb,omitempty"`
// Failure message of the command
FailureMessage string `json:"failure_message,omitempty"`
// Failure message of the command without privacy info
FailureMessageWithoutPrivacyInfo string `json:"failure_message_without_privacy_info,omitempty"`
// ImportFileFormat shows what is the actual image format of the imported file
ImportFileFormat string `json:"import_file_format,omitempty"`
// Serial output from worker instances; only populated
// if workflow failed.
SerialOutputs []string `json:"serial_outputs,omitempty"`
// Inflation type (qemu, API, etc)
InflationType string `json:"inflation_type,omitempty"`
// Inflation time (seconds)
InflationTime []int64 `json:"inflation_time_ms,omitempty"`
// Inflation time (seconds) of the shadow disk
ShadowInflationTime []int64 `json:"shadow_inflation_time_ms,omitempty"`
// Shadow disk match result for shadow disk inflater
ShadowDiskMatchResult string `json:"shadow_disk_match_result,omitempty"`
// Indicates whether UEFI_COMPATIBLE was added to the image's guestOSFeatures, either due to inspection or user request
IsUEFICompatibleImage bool `json:"is_uefi_compatible_image,omitempty"`
// Indicates whether the image is auto-detected to be UEFI compatible
IsUEFIDetected bool `json:"is_uefi_detected,omitempty"`
// Inspection results. Ref to the def of `InspectionResults` for details
InspectionResults *pb.InspectionResults `json:"inspection_results,omitempty"`
// Inflation fallback reason
InflationFallbackReason string `json:"inflation_fallback_reason,omitempty"`
}
OutputInfo contains output values from the tools execution
type OvfExportLoggableBuilder ¶
type OvfExportLoggableBuilder struct {
// contains filtered or unexported fields
}
OvfExportLoggableBuilder initializes and builds a Loggable with the metadata fields that are relevant when exporting OVF.
func NewOvfExportLoggableBuilder ¶
func NewOvfExportLoggableBuilder() *OvfExportLoggableBuilder
NewOvfExportLoggableBuilder creates and initializes a OvfExportLoggableBuilder.
func (*OvfExportLoggableBuilder) AppendTraceLogs ¶
func (b *OvfExportLoggableBuilder) AppendTraceLogs(traceLogs []string) *OvfExportLoggableBuilder
AppendTraceLogs sets trace logs during OVF export.
func (*OvfExportLoggableBuilder) Build ¶
func (b *OvfExportLoggableBuilder) Build() Loggable
Build builds the actual Loggable object.
func (OvfExportLoggableBuilder) GetInspectionResults ¶
func (w OvfExportLoggableBuilder) GetInspectionResults() *pb.InspectionResults
func (OvfExportLoggableBuilder) GetValueAsBool ¶
func (OvfExportLoggableBuilder) GetValueAsInt64Slice ¶
func (OvfExportLoggableBuilder) ReadSerialPortLogs ¶
func (w OvfExportLoggableBuilder) ReadSerialPortLogs() []string
func (*OvfExportLoggableBuilder) SetDiskSizes ¶
func (b *OvfExportLoggableBuilder) SetDiskSizes(sourceSizes []int64, targetSizes []int64) *OvfExportLoggableBuilder
SetDiskSizes sets disk sizes for OVF exported disks
type SingleImageImportLoggableBuilder ¶
type SingleImageImportLoggableBuilder struct {
// contains filtered or unexported fields
}
SingleImageImportLoggableBuilder initializes and builds a Loggable with the metadata fields that are relevant when importing a single image.
func NewSingleImageImportLoggableBuilder ¶
func NewSingleImageImportLoggableBuilder() *SingleImageImportLoggableBuilder
NewSingleImageImportLoggableBuilder creates and initializes a SingleImageImportLoggableBuilder.
func (*SingleImageImportLoggableBuilder) AppendTraceLogs ¶
func (b *SingleImageImportLoggableBuilder) AppendTraceLogs(traceLogs []string) *SingleImageImportLoggableBuilder
AppendTraceLogs sets trace logs during the import.
func (*SingleImageImportLoggableBuilder) Build ¶
func (b *SingleImageImportLoggableBuilder) Build() Loggable
Build builds the actual Loggable object.
func (SingleImageImportLoggableBuilder) GetInspectionResults ¶
func (w SingleImageImportLoggableBuilder) GetInspectionResults() *pb.InspectionResults
func (SingleImageImportLoggableBuilder) GetValueAsBool ¶
func (SingleImageImportLoggableBuilder) GetValueAsInt64Slice ¶
func (SingleImageImportLoggableBuilder) ReadSerialPortLogs ¶
func (w SingleImageImportLoggableBuilder) ReadSerialPortLogs() []string
func (*SingleImageImportLoggableBuilder) SetDiskAttributes ¶
func (b *SingleImageImportLoggableBuilder) SetDiskAttributes(fileFormat string, sourceSize int64, targetSize int64) *SingleImageImportLoggableBuilder
SetDiskAttributes sets disk related attributes.
func (*SingleImageImportLoggableBuilder) SetInflationAttributes ¶
func (b *SingleImageImportLoggableBuilder) SetInflationAttributes(matchResult string, inflationTypeStr string, inflationTimeInt64 int64, shadowInflationTimeInt64 int64) *SingleImageImportLoggableBuilder
SetInflationAttributes sets inflation related attributes.
func (*SingleImageImportLoggableBuilder) SetInspectionResults ¶
func (b *SingleImageImportLoggableBuilder) SetInspectionResults(inspectionResults *pb.InspectionResults) *SingleImageImportLoggableBuilder
SetInspectionResults sets inspection results.
func (*SingleImageImportLoggableBuilder) SetUEFIMetrics ¶
func (b *SingleImageImportLoggableBuilder) SetUEFIMetrics(isUEFICompatibleImageBool bool, isUEFIDetectedBool bool, biosBootableBool bool, rootFSString string) *SingleImageImportLoggableBuilder
SetUEFIMetrics sets UEFI related metrics.
type WindowsUpgradeParams ¶
type WindowsUpgradeParams struct {
*CommonParams
SourceOS string `json:"source_os,omitempty"`
TargetOS string `json:"target_os,omitempty"`
Instance string `json:"instance,omitempty"`
CreateMachineBackup bool `json:"create_machine_backup"`
AutoRollback bool `json:"auto_rollback"`
UseStagingInstallMedia bool `json:"use_staging_install_media"`
}
WindowsUpgradeParams contains all input params for windows upgrade