model

package
v0.0.0-...-f557d2e Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: Apache-2.0 Imports: 8 Imported by: 6

Documentation

Overview

Package model contains datastore model definitions.

Index

Constants

View Source
const ConfigKind = "Config"

ConfigKind is a config entity's kind in the datastore.

View Source
const ProjectKind = "Project"

ProjectKind is a project entity's kind in the datastore.

View Source
const VMKind = "VM"

VMKind is a VM entity's kind in the datastore.

Variables

This section is empty.

Functions

This section is empty.

Types

type ComputeInstance

type ComputeInstance struct {
	Stable *compute.Instance
	Alpha  *computealpha.Instance
}

A ComputeInstance is a struct containing either a Stable or an Alpha compute instance. Certain features require the use of the alpha GCP APIs.

In a valid ComputeInstance instance, exactly one of the fields will be non-nil.

type Config

type Config struct {

	// ID is the unique identifier for this config.
	ID string `gae:"$id"`
	// Config is the config.Config representation of this entity.
	// Indexing is not useful here since this field contains textproto.
	// Additionally, indexed string fields are limited to 1500 bytes.
	// https://cloud.google.com/datastore/docs/concepts/limits.
	// noindex is not respected here. See config.Config.ToProperty.
	Config *config.Config `gae:"binary_config,legacy"`
	// contains filtered or unexported fields
}

Config is a root entity representing a config for one type of VMs. VM entities should be created for each config entity.

type NetworkInterface

type NetworkInterface struct {
	// ExternalIP is an external network address assigned to a GCE instance.
	// GCE currently supports at most one external IP address per network
	// interface.
	ExternalIP string
	// Internal is an internal network address assigned to a GCE instance.
	InternalIP string
}

NetworkInterface is a network interface attached to a GCE instance.

type Project

type Project struct {

	// ID is the unique identifier for this project.
	ID string `gae:"$id"`
	// Config is the projects.Config representation of this entity.
	// noindex is not respected here. See projects.Config.ToProperty.
	Config *projects.Config `gae:"binary_config,legacy"`
	// contains filtered or unexported fields
}

Project is a root entity representing a GCP project. GCE quota utilization is reported for each metric in each region.

type VM

type VM struct {

	// ID is the unique identifier for this VM.
	ID string `gae:"$id"`
	// Attributes is the config.VM describing the GCE instance to create.
	// Indexing is not useful here since this field contains textproto.
	// noindex is not respected here. See config.VM.ToProperty.
	Attributes config.VM `gae:"binary_attributes,noindex"`
	// AttributesIndexed is a slice of strings in "key:value" form where the key is
	// the path to a field in Attributes and the value is its associated value.
	// Allows fields from Attributes to be indexed.
	AttributesIndexed []string `gae:"attributes_indexed"`
	// Config is the ID of the config this VM was created from.
	Config string `gae:"config"`
	// ConfigExpanded is the Unix time when the GCE instance was configured, i.e.
	// the time we expand user config and decide to create the VM.
	ConfigExpanded int64 `gae:"configured"`
	// Connected is the Unix time when the GCE instance connected to Swarming.
	Connected int64 `gae:"connected"`
	// Created is the Unix time when the GCE instance was created.
	Created int64 `gae:"created"`
	// Drained indicates whether or not this VM is drained.
	// A GCE instance should not be created for a drained VM.
	// Any existing GCE instance should be deleted regardless of deadline.
	Drained bool `gae:"drained"`
	// DUT is the name of the matched lab DUT.
	// Optional if the VM is not linked to a DUT.
	DUT string `gae:"dut"`
	// Hostname is the short hostname of the GCE instance to create.
	Hostname string `gae:"hostname"`
	// Image is the source image for the boot disk of the GCE instance.
	Image string `gae:"image"`
	// Index is this VM's number with respect to its config.
	Index int32 `gae:"index"`
	// Lifetime is the number of seconds the GCE instance should live for.
	Lifetime int64 `gae:"lifetime"`
	// NetworkInterfaces is a slice of network interfaces attached to this created
	// GCE instance. Empty if the instance is not yet created.
	NetworkInterfaces []NetworkInterface `gae:"network_interfaces"`
	// Prefix is the prefix to use when naming the GCE instance.
	Prefix string `gae:"prefix"`
	// ScalingType is how the pool size is scaled.
	ScalingType string `gae:"scaling_type"`
	// Revision is the config revision this VM was created from.
	Revision string `gae:"revision"`
	// Swarming is hostname of the Swarming server the GCE instance connects to.
	Swarming string `gae:"swarming"`
	// Timeout is the number of seconds the GCE instance has to connect to Swarming.
	Timeout int64 `gae:"timeout"`
	// URL is the URL of the created GCE instance.
	URL string `gae:"url"`
	// contains filtered or unexported fields
}

VM is a root entity representing a configured VM. GCE instances should be created for each VM entity.

func (*VM) GetInstance

func (vm *VM) GetInstance() ComputeInstance

GetInstance returns a ComputeInstance representation of this VM.

func (*VM) IndexAttributes

func (vm *VM) IndexAttributes()

IndexAttributes sets indexable fields of vm.Attributes in AttributesIndexed.

Jump to

Keyboard shortcuts

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