vmmanagers

package
v0.0.0-...-2af88e8 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultCPU = "1"
View Source
const DefaultDiskSize = "160"
View Source
const DefaultMemory = "8"

Variables

This section is empty.

Functions

func ValidateOpsManConfig

func ValidateOpsManConfig(config *OpsmanConfigFilePayload) error

Types

type AWSConfig

type AWSConfig struct {
	AWSCredential             `yaml:",inline"`
	VPCSubnetId               string            `yaml:"vpc_subnet_id" validate:"required"`
	SecurityGroupIdDEPRECATED string            `yaml:"security_group_id,omitempty"`
	SecurityGroupIds          []string          `yaml:"security_group_ids"`
	KeyPairName               string            `yaml:"key_pair_name" validate:"required"`
	IAMInstanceProfileName    string            `yaml:"iam_instance_profile_name" validate:"required"`
	PublicIP                  string            `yaml:"public_ip" validate:"omitempty,ip"`
	PrivateIP                 string            `yaml:"private_ip" validate:"omitempty,ip"`
	VMName                    string            `yaml:"vm_name"`
	BootDiskSize              string            `yaml:"boot_disk_size"`
	InstanceType              string            `yaml:"instance_type"`
	Tags                      map[string]string `yaml:"tags"`
	AuthenticationType        string            `yaml:"authentication_type"`
}

func (*AWSConfig) ValidateConfig

func (a *AWSConfig) ValidateConfig() error

type AWSCredential

type AWSCredential struct {
	AWSInstanceProfile `yaml:",inline"`
	AccessKeyId        string `yaml:"access_key_id,omitempty"`
	SecretAccessKey    string `yaml:"secret_access_key,omitempty"`
	Region             string `yaml:"region" validate:"required"`
}

type AWSInstanceProfile

type AWSInstanceProfile struct {
	UseInstanceProfileDEPRECATED bool   `yaml:"use_instance_profile,omitempty"`
	AssumeRole                   string `yaml:"assume_role,omitempty"`
}

type AWSVMManager

type AWSVMManager struct {
	Config    *OpsmanConfigFilePayload
	ImageYaml string
	State     StateInfo
	// contains filtered or unexported fields
}

func NewAWSVMManager

func NewAWSVMManager(stdout, stderr io.Writer, config *OpsmanConfigFilePayload, imageYaml string, stateInfo StateInfo, awsRunner awsRunner, t time.Duration) *AWSVMManager

func (*AWSVMManager) AddEnvVars

func (a *AWSVMManager) AddEnvVars() []string

func (*AWSVMManager) CreateVM

func (a *AWSVMManager) CreateVM() (Status, StateInfo, error)

func (*AWSVMManager) DeleteVM

func (a *AWSVMManager) DeleteVM() error

func (*AWSVMManager) ExecuteWithInstanceProfile

func (a *AWSVMManager) ExecuteWithInstanceProfile(env []string, args []interface{}) (*bytes.Buffer, *bytes.Buffer, error)

type AzureConfig

type AzureConfig struct {
	AzureCredential            `yaml:",inline"`
	CloudName                  string `yaml:"cloud_name"`
	Container                  string `yaml:"container"`
	VPCSubnetDEPRECATED        string `yaml:"vpc_subnet,omitempty"`
	SubnetID                   string `yaml:"subnet_id" validate:"required"`
	NSG                        string `yaml:"network_security_group"`
	VMName                     string `yaml:"vm_name"`
	SSHPublicKey               string `yaml:"ssh_public_key" validate:"required"`
	BootDiskSize               string `yaml:"boot_disk_size"`
	PrivateIP                  string `yaml:"private_ip" validate:"omitempty,ip"`
	PublicIP                   string `yaml:"public_ip" validate:"omitempty,ip" `
	UseUnmanagedDiskDEPRECATED string `yaml:"use_unmanaged_disk,omitempty"`
	UseManagedDisk             string `yaml:"use_managed_disk"`
	StorageSKU                 string `yaml:"storage_sku,omitempty"`
	VMSize                     string `yaml:"vm_size"`
	Tags                       string `yaml:"tags"`
}

type AzureCredential

type AzureCredential struct {
	TenantID       string `yaml:"tenant_id"       validate:"required"`
	SubscriptionID string `yaml:"subscription_id" validate:"required"`
	ClientID       string `yaml:"client_id"       validate:"required"`
	ClientSecret   string `yaml:"client_secret"   validate:"required"`
	Location       string `yaml:"location"        validate:"required"`
	ResourceGroup  string `yaml:"resource_group"  validate:"required"`
	StorageAccount string `yaml:"storage_account" validate:"required"`
	StorageKey     string `yaml:"storage_key"`
}

type AzureNetworkProfile

type AzureNetworkProfile struct {
	NetworkInterfaces []ID `json:"networkInterfaces"`
}

type AzureOSDisk

type AzureOSDisk struct {
	ManagedDisk ID  `json:"managedDisk"`
	VHD         VHD `json:"vhd"`
}

type AzureStorageProfile

type AzureStorageProfile struct {
	ImageReference ID          `json:"imageReference"`
	OSDisk         AzureOSDisk `json:"osDisk"`
}

type AzureVMInfo

type AzureVMInfo struct {
	NetworkProfile AzureNetworkProfile `json:"networkProfile"`
	StorageProfile AzureStorageProfile `json:"storageProfile"`
}

type AzureVMManager

type AzureVMManager struct {
	Config    *OpsmanConfigFilePayload
	ImageYaml string
	State     StateInfo
	// contains filtered or unexported fields
}

func NewAzureVMManager

func NewAzureVMManager(stdout, stderr io.Writer, config *OpsmanConfigFilePayload, imageYaml string, state StateInfo, azureRunner azureRunner, t time.Duration) *AzureVMManager

func (*AzureVMManager) CreateVM

func (a *AzureVMManager) CreateVM() (Status, StateInfo, error)

func (*AzureVMManager) DeleteVM

func (a *AzureVMManager) DeleteVM() error

type CreateVMService

type CreateVMService interface {
	CreateVM() (Status, StateInfo, error)
}

func NewCreateVMManager

func NewCreateVMManager(config *OpsmanConfigFilePayload, image string, state StateInfo, outWriter, errWriter io.Writer) (CreateVMService, error)

type DeleteVMService

type DeleteVMService interface {
	DeleteVM() error
}

func NewDeleteVMManager

func NewDeleteVMManager(config *OpsmanConfigFilePayload, image string, state StateInfo, outWriter, errWriter io.Writer) (DeleteVMService, error)

type GCPConfig

type GCPConfig struct {
	GCPCredential `yaml:",inline"`
	VpcSubnet     string   `yaml:"vpc_subnet" validate:"required"`
	PublicIP      string   `yaml:"public_ip,omitempty"  validate:"omitempty,ip"`
	PrivateIP     string   `yaml:"private_ip" validate:"omitempty,ip"`
	VMName        string   `yaml:"vm_name"`
	Tags          string   `yaml:"tags,omitempty"`
	CPU           string   `yaml:"custom_cpu"`
	Memory        string   `yaml:"custom_memory"`
	BootDiskSize  string   `yaml:"boot_disk_size"`
	Scopes        []string `yaml:"scopes,omitempty"`
	SSHPublicKey  string   `yaml:"ssh_public_key"`
	Hostname      string   `yaml:"hostname"`
}

type GCPCredential

type GCPCredential struct {
	ServiceAccount     string `yaml:"gcp_service_account,omitempty"`
	ServiceAccountName string `yaml:"gcp_service_account_name,omitempty"`
	Project            string `yaml:"project" validate:"required"`
	Region             string `yaml:"region" validate:"required"`
	Zone               string `yaml:"zone" validate:"required"`
}

type GCPVMManager

type GCPVMManager struct {
	Config    *OpsmanConfigFilePayload
	ImageYaml string
	State     StateInfo
	// contains filtered or unexported fields
}

func NewGcpVMManager

func NewGcpVMManager(config *OpsmanConfigFilePayload, imageYaml string, state StateInfo, gcloudRunner gcloudRunner) *GCPVMManager

func (*GCPVMManager) CreateVM

func (g *GCPVMManager) CreateVM() (Status, StateInfo, error)

func (*GCPVMManager) DeleteVM

func (g *GCPVMManager) DeleteVM() error

type ID

type ID struct {
	ID string `json:"id"`
}

type OpenstackConfig

type OpenstackConfig struct {
	OpenstackCredential `yaml:",inline"`
	PublicIP            string `yaml:"public_ip" validate:"omitempty,ip"`
	PrivateIP           string `yaml:"private_ip" validate:"omitempty,ip"`
	VMName              string `yaml:"vm_name"`
	Flavor              string `yaml:"flavor"`
	NetID               string `yaml:"net_id" validate:"required"`
	SecurityGroup       string `yaml:"security_group_name" validate:"required"`
	KeyName             string `yaml:"key_pair_name" validate:"required"`
	AvailabilityZone    string `yaml:"availability_zone"`
}

type OpenstackCredential

type OpenstackCredential struct {
	Username           string `yaml:"username" validate:"required"`
	Password           string `yaml:"password" validate:"required"`
	AuthUrl            string `yaml:"auth_url" validate:"required"`
	Project            string `yaml:"project_name" validate:"required"`
	ProjectDomainName  string `yaml:"project_domain_name"`
	UserDomainName     string `yaml:"user_domain_name"`
	Insecure           bool   `yaml:"insecure"`
	IdentityAPIVersion int    `yaml:"identity_api_version"`
}

type OpenstackVMManager

type OpenstackVMManager struct {
	Config *OpenstackConfig
	Image  string
	State  StateInfo
	// contains filtered or unexported fields
}

func NewOpenstackVMManager

func NewOpenstackVMManager(config *OpsmanConfigFilePayload, image string, state StateInfo, openstackRunner openstackRunner) *OpenstackVMManager

func (*OpenstackVMManager) CreateVM

func (o *OpenstackVMManager) CreateVM() (Status, StateInfo, error)

func (*OpenstackVMManager) DeleteVM

func (o *OpenstackVMManager) DeleteVM() error

type OpsmanConfig

type OpsmanConfig struct {
	Vsphere   *VsphereConfig         `yaml:"vsphere,omitempty"`
	GCP       *GCPConfig             `yaml:"gcp,omitempty"`
	AWS       *AWSConfig             `yaml:"aws,omitempty"`
	Azure     *AzureConfig           `yaml:"azure,omitempty"`
	Openstack *OpenstackConfig       `yaml:"openstack,omitempty"`
	Unknown   map[string]interface{} `yaml:",inline"`
}

type OpsmanConfigFilePayload

type OpsmanConfigFilePayload struct {
	OpsmanConfig OpsmanConfig           `yaml:"opsman-configuration"`
	Fields       map[string]interface{} `yaml:",inline"`
}

type StateInfo

type StateInfo struct {
	IAAS string `yaml:"iaas"`
	ID   string `yaml:"vm_id"`
}

type Status

type Status int
const (
	Success Status = iota
	Exist
	StateMismatch
	Unknown
	Incomplete
)

type VHD

type VHD struct {
	URI string `json:"uri"`
}

type Vcenter

type Vcenter struct {
	VcenterCredential `yaml:",inline"`
	Datacenter        string `yaml:"datacenter" validate:"required"`
	Datastore         string `yaml:"datastore" validate:"required"`
	Insecure          string `yaml:"insecure"`
	CACert            string `yaml:"ca_cert,omitempty"`
	ResourcePool      string `yaml:"resource_pool" validate:"required"`
	HostDEPRECATED    string `yaml:"host,omitempty"`
	Folder            string `yaml:"folder"`
}

type VcenterCredential

type VcenterCredential struct {
	URL      string `yaml:"url" validate:"required"`
	Username string `yaml:"username" validate:"required"`
	Password string `yaml:"password" validate:"required"`
}

type VsphereConfig

type VsphereConfig struct {
	Vcenter      `yaml:"vcenter"`
	DiskType     string `yaml:"disk_type" validate:"required"`
	PrivateIP    string `yaml:"private_ip" validate:"required,ip"`
	DNS          string `yaml:"dns" validate:"required"`
	NTP          string `yaml:"ntp" validate:"required"`
	SSHPassword  string `yaml:"ssh_password,omitempty"`
	SSHPublicKey string `yaml:"ssh_public_key"`
	Hostname     string `yaml:"hostname" validate:"required"`
	Network      string `yaml:"network"  validate:"required"`
	Netmask      string `yaml:"netmask" validate:"required"`
	Gateway      string `yaml:"gateway" validate:"required"`
	VMName       string `yaml:"vm_name"`
	DiskSize     string `yaml:"disk_size"`
	Memory       string `yaml:"memory"`
	CPU          string `yaml:"cpu"`
}

type VsphereVMManager

type VsphereVMManager struct {
	ImageOVA string
	State    StateInfo
	Config   *OpsmanConfigFilePayload
	// contains filtered or unexported fields
}

func NewVsphereVMManager

func NewVsphereVMManager(config *OpsmanConfigFilePayload, imageFileName string, state StateInfo, govcRunner govcRunner) *VsphereVMManager

func (*VsphereVMManager) CreateVM

func (v *VsphereVMManager) CreateVM() (Status, StateInfo, error)

func (*VsphereVMManager) DeleteVM

func (v *VsphereVMManager) DeleteVM() error

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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