inventory

package
v0.0.0-...-e560ebb Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const MachineLSEDeploymentKind string = "MachineLSEDeployment"

MachineLSEDeploymentKind is the datastore entity kind for host deployment info.

View Source
const MachineLSEKind string = "MachineLSE"

MachineLSEKind is the datastore entity kind MachineLSE.

View Source
const RackLSEKind string = "RackLSE"

RackLSEKind is the datastore entity kind RackLSE.

View Source
const SchedulingUnitKind string = "SchedulingUnit"

SchedulingUnitKind is the datastore entity kind for SchedulingUnit.

View Source
const VMKind string = "ChromeVM"

VMKind is the datastore entity kind for vm.

Variables

This section is empty.

Functions

func BatchDeleteVMs

func BatchDeleteVMs(ctx context.Context, ids []string) error

BatchDeleteVMs deletes vms in datastore.

This is a non-atomic operation. Must be used within a transaction. Will lead to partial deletes if not used in a transaction.

func BatchGetMachineLSEDeployments

func BatchGetMachineLSEDeployments(ctx context.Context, ids []string) ([]*ufspb.MachineLSEDeployment, error)

BatchGetMachineLSEDeployments returns a batch of deployment records from datastore.

func BatchGetMachineLSEs

func BatchGetMachineLSEs(ctx context.Context, ids []string) ([]*ufspb.MachineLSE, error)

BatchGetMachineLSEs returns a batch of machine lses from datastore.

func BatchGetVMs

func BatchGetVMs(ctx context.Context, ids []string) ([]*ufspb.VM, error)

BatchGetVMs returns a batch of vms from datastore.

func BatchUpdateMachineLSEs

func BatchUpdateMachineLSEs(ctx context.Context, machineLSEs []*ufspb.MachineLSE) ([]*ufspb.MachineLSE, error)

BatchUpdateMachineLSEs updates machineLSEs in datastore. This is a non-atomic operation and doesnt check if the object already exists before update. Must be used within a Transaction where objects are checked before update. Will lead to partial updates if not used in a transaction.

func BatchUpdateRackLSEs

func BatchUpdateRackLSEs(ctx context.Context, rackLSEs []*ufspb.RackLSE) ([]*ufspb.RackLSE, error)

BatchUpdateRackLSEs updates rackLSEs in datastore.

This is a non-atomic operation and doesnt check if the object already exists before update. Must be used within a Transaction where objects are checked before update. Will lead to partial updates if not used in a transaction.

func BatchUpdateSchedulingUnits

func BatchUpdateSchedulingUnits(ctx context.Context, schedulingUnits []*ufspb.SchedulingUnit) ([]*ufspb.SchedulingUnit, error)

BatchUpdateSchedulingUnits updates SchedulingUnits in datastore.

This is a non-atomic operation and doesnt check if the object already exists before update. Must be used within a transaction where objects are checked before update. Will lead to partial updates if not used in a transaction.

func BatchUpdateVMs

func BatchUpdateVMs(ctx context.Context, vms []*ufspb.VM) ([]*ufspb.VM, error)

BatchUpdateVMs updates vms in datastore.

This is a non-atomic operation and doesnt check if the object already exists before update. Must be used within a Transaction where objects are checked before update. Will lead to partial updates if not used in a transaction.

func CreateMachineLSE

func CreateMachineLSE(ctx context.Context, machineLSE *ufspb.MachineLSE) (*ufspb.MachineLSE, error)

CreateMachineLSE creates a new machineLSE in datastore.

func CreateRackLSE

func CreateRackLSE(ctx context.Context, rackLSE *ufspb.RackLSE) (*ufspb.RackLSE, error)

CreateRackLSE creates a new rackLSE in datastore.

func CreateSchedulingUnit

func CreateSchedulingUnit(ctx context.Context, su *ufspb.SchedulingUnit) (*ufspb.SchedulingUnit, error)

CreateSchedulingUnit creates a new SchedulingUnit in datastore.

func DeleteDeployment

func DeleteDeployment(ctx context.Context, id string) error

DeleteDeployment deletes a deployment record

func DeleteMachineLSE

func DeleteMachineLSE(ctx context.Context, id string) error

DeleteMachineLSE deletes the machineLSE in datastore

func DeleteMachineLSEs

func DeleteMachineLSEs(ctx context.Context, resourceNames []string) *ufsds.OpResults

DeleteMachineLSEs deletes a batch of machine LSEs

func DeleteRackLSE

func DeleteRackLSE(ctx context.Context, id string) error

DeleteRackLSE deletes the rackLSE in datastore

func DeleteSchedulingUnit

func DeleteSchedulingUnit(ctx context.Context, name string) error

DeleteSchedulingUnit deletes the SchedulingUnit in datastore.

func DeleteVM

func DeleteVM(ctx context.Context, id string) error

DeleteVM deletes the vm in datastore

func DeleteVMs

func DeleteVMs(ctx context.Context, resourceNames []string) *ufsds.OpResults

DeleteVMs deletes a batch of vms

Can be used in a transaction

func GetAllMachineLSEs

func GetAllMachineLSEs(ctx context.Context) (*ufsds.OpResults, error)

GetAllMachineLSEs returns all machine lses in datastore.

func GetAllVMs

func GetAllVMs(ctx context.Context) (*ufsds.OpResults, error)

GetAllVMs returns all vms in datastore.

func GetDeploymentIndexedFieldName

func GetDeploymentIndexedFieldName(input string) (string, error)

GetDeploymentIndexedFieldName returns the index name

func GetMachineLSE

func GetMachineLSE(ctx context.Context, id string) (*ufspb.MachineLSE, error)

GetMachineLSE returns machine for the given id from datastore.

func GetMachineLSEDeployment

func GetMachineLSEDeployment(ctx context.Context, id string) (*ufspb.MachineLSEDeployment, error)

GetMachineLSEDeployment returns the deployment record for a given serial number

func GetMachineLSEIndexedFieldName

func GetMachineLSEIndexedFieldName(input string) (string, error)

GetMachineLSEIndexedFieldName returns the index name

func GetRackLSE

func GetRackLSE(ctx context.Context, id string) (*ufspb.RackLSE, error)

GetRackLSE returns rack for the given id from datastore.

func GetRackLSEIndexedFieldName

func GetRackLSEIndexedFieldName(input string) (string, error)

GetRackLSEIndexedFieldName returns the index name

func GetSchedulingUnit

func GetSchedulingUnit(ctx context.Context, name string) (*ufspb.SchedulingUnit, error)

GetSchedulingUnit returns SchedulingUnit for the given name from datastore.

func GetSchedulingUnitIndexedFieldName

func GetSchedulingUnitIndexedFieldName(input string) (string, error)

GetSchedulingUnitIndexedFieldName returns the index name

func GetVM

func GetVM(ctx context.Context, id string) (*ufspb.VM, error)

GetVM returns vms for the given id from datastore.

func GetVMIndexedFieldName

func GetVMIndexedFieldName(input string) (string, error)

GetVMIndexedFieldName returns the index name

func ImportMachineLSEs

func ImportMachineLSEs(ctx context.Context, lses []*ufspb.MachineLSE) (*ufsds.OpResults, error)

ImportMachineLSEs creates or updates a batch of machine lses in datastore

func ImportRackLSEs

func ImportRackLSEs(ctx context.Context, lses []*ufspb.RackLSE) (*ufsds.OpResults, error)

ImportRackLSEs creates or updates a batch of rack LSEs in datastore

func ImportVMs

func ImportVMs(ctx context.Context, vms []*ufspb.VM) (*ufsds.OpResults, error)

ImportVMs creates or updates a batch of vms in datastore

func ListAllMachineLSEs

func ListAllMachineLSEs(ctx context.Context, keysOnly bool) (res []*ufspb.MachineLSE, err error)

ListAllMachineLSEs returns all machine lses in datastore.

func ListFreeMachineLSEs

func ListFreeMachineLSEs(ctx context.Context, requiredSize int32, filterMap map[string][]interface{}, capacityMap map[string]int) (res []*ufspb.MachineLSE, nextPageToken string, err error)

ListFreeMachineLSEs lists the machine lses with vm capacity

func ListMachineLSEDeployments

func ListMachineLSEDeployments(ctx context.Context, pageSize int32, pageToken string, filterMap map[string][]interface{}, keysOnly bool) (res []*ufspb.MachineLSEDeployment, nextPageToken string, err error)

ListMachineLSEDeployments lists the deployment records

Does a query over MachineLSEDeploymentEntity. Returns up to pageSize entities, plus non-nil cursor (if there are more results). pageSize must be positive.

func ListMachineLSEs

func ListMachineLSEs(ctx context.Context, pageSize int32, pageToken string, filterMap map[string][]interface{}, keysOnly bool) (res []*ufspb.MachineLSE, nextPageToken string, err error)

ListMachineLSEs lists the machine lses Does a query over MachineLSE entities. Returns up to pageSize entities, plus non-nil cursor (if there are more results). pageSize must be positive.

func ListRackLSEs

func ListRackLSEs(ctx context.Context, pageSize int32, pageToken string, filterMap map[string][]interface{}, keysOnly bool) (res []*ufspb.RackLSE, nextPageToken string, err error)

ListRackLSEs lists the racks

Does a query over RackLSE entities. Returns up to pageSize entities, plus non-nil cursor (if there are more results). pageSize must be positive.

func ListSchedulingUnits

func ListSchedulingUnits(ctx context.Context, pageSize int32, pageToken string, filterMap map[string][]interface{}, keysOnly bool) (res []*ufspb.SchedulingUnit, nextPageToken string, err error)

ListSchedulingUnits lists the SchedulingUnits.

Does a query over SchedulingUnit entities. Returns up to pageSize entities, plus non-nil cursor (if there are more results). pageSize must be positive.

func ListVMs

func ListVMs(ctx context.Context, pageSize int32, requiredSize int32, pageToken string, filterMap map[string][]interface{}, keysOnly bool, validFunc func(*ufspb.VM) bool) (res []*ufspb.VM, nextPageToken string, err error)

ListVMs lists the vms

Does a query over vm entities. Returns up to pageSize entities, plus non-nil cursor (if there are more results). pageSize must be positive.

func QueryMachineLSEByPropertyName

func QueryMachineLSEByPropertyName(ctx context.Context, propertyName, id string, keysOnly bool) ([]*ufspb.MachineLSE, error)

QueryMachineLSEByPropertyName queries MachineLSE Entity in the datastore If keysOnly is true, then only key field is populated in returned machinelses

func QueryMachineLSEByPropertyNames

func QueryMachineLSEByPropertyNames(ctx context.Context, propertyMap map[string]string, keysOnly bool) ([]*ufspb.MachineLSE, error)

QueryMachineLSEByPropertyNames queries MachineLSE Entity in the datastore If keysOnly is true, then only key field is populated in returned machinelses

func QueryRackLSEByPropertyName

func QueryRackLSEByPropertyName(ctx context.Context, propertyName, id string, keysOnly bool) ([]*ufspb.RackLSE, error)

QueryRackLSEByPropertyName queries RackLSE Entity in the datastore

If keysOnly is true, then only key field is populated in returned racklses

func QuerySchedulingUnitByPropertyNames

func QuerySchedulingUnitByPropertyNames(ctx context.Context, propertyMap map[string]string, keysOnly bool) ([]*ufspb.SchedulingUnit, error)

QuerySchedulingUnitByPropertyNames queries SchedulingUnit Entity in the datastore If keysOnly is true, then only key field is populated in returned SchedulingUnits

func QueryVMByPropertyName

func QueryVMByPropertyName(ctx context.Context, propertyName, id string, keysOnly bool) ([]*ufspb.VM, error)

QueryVMByPropertyName queries VM Entity in the datastore If keysOnly is true, then only key field is populated in returned machinelses

func RangedQueryMachineLSEByPropertyName

func RangedQueryMachineLSEByPropertyName(ctx context.Context, propertyName string, gtVal, ltVal interface{}, keysOnly bool) ([]*ufspb.MachineLSE, error)

RangedQueryMachineLSEByPropertyName queries MachineLSE entity in the datastore. The query run here is given by `SELECT * FROM MachineLSE WHERE propertyName >= gtVal AND propertyName <= ltVal`

func RangedQueryMachineLSEByPropertyNames

func RangedQueryMachineLSEByPropertyNames(ctx context.Context, propertyMap map[string][]interface{}, keysOnly bool) ([]*ufspb.MachineLSE, error)

func UpdateMachineLSE

func UpdateMachineLSE(ctx context.Context, machineLSE *ufspb.MachineLSE) (*ufspb.MachineLSE, error)

UpdateMachineLSE updates machineLSE in datastore.

func UpdateMachineLSEDeployments

func UpdateMachineLSEDeployments(ctx context.Context, dis []*ufspb.MachineLSEDeployment) ([]*ufspb.MachineLSEDeployment, error)

UpdateMachineLSEDeployments updates the deployment infos for a batch of hosts in datastore.

func UpdateRackLSE

func UpdateRackLSE(ctx context.Context, rackLSE *ufspb.RackLSE) (*ufspb.RackLSE, error)

UpdateRackLSE updates rackLSE in datastore.

Types

type MachineLSEDeploymentEntity

type MachineLSEDeploymentEntity struct {
	ID                   string `gae:"$id"`
	Hostname             string `gae:"hostname"`
	DeploymentIdentifier string `gae:"deployment_identifier"`
	DeploymentEnv        string `gae:"deployment_env"`
	// Follow others entities, store ufspb.MachineLSEDeployment bytes.
	DeploymentInfo []byte `gae:",noindex"`
	// contains filtered or unexported fields
}

MachineLSEDeploymentEntity is a datastore entity that tracks the deployment info for a host.

func (*MachineLSEDeploymentEntity) GetProto

func (e *MachineLSEDeploymentEntity) GetProto() (proto.Message, error)

GetProto returns the unmarshaled MachineLSEDeploymentEntity.

type MachineLSEEntity

type MachineLSEEntity struct {
	ID                    string   `gae:"$id"`
	MachineIDs            []string `gae:"machine_ids"`
	MachineLSEProtoTypeID string   `gae:"machinelse_prototype_id"`
	SwitchID              string   `gae:"switch_id"`
	RPMID                 string   `gae:"rpm_id"`
	RPMPort               string   `gae:"rpm_port"`
	VlanID                string   `gae:"vlan_id"`
	ServoID               string   `gae:"servo_id"`
	ServoType             string   `gae:"servo_type"`
	Rack                  string   `gae:"rack"`
	Lab                   string   `gae:"lab"` // deprecated
	Zone                  string   `gae:"zone"`
	Manufacturer          string   `gae:"manufacturer"`
	Tags                  []string `gae:"tags"`
	State                 string   `gae:"state"`
	OS                    []string `gae:"os"`
	VirtualDatacenter     string   `gae:"virtualdatacenter"`
	Nic                   string   `gae:"nic"`
	Pools                 []string `gae:"pools"`
	// ufspb.MachineLSE cannot be directly used as it contains pointer.
	MachineLSE []byte `gae:",noindex"`
	// contains filtered or unexported fields
}

MachineLSEEntity is a datastore entity that tracks MachineLSE.

func (*MachineLSEEntity) GetProto

func (e *MachineLSEEntity) GetProto() (proto.Message, error)

GetProto returns the unmarshaled MachineLSE.

type RackLSEEntity

type RackLSEEntity struct {
	ID                 string   `gae:"$id"`
	RackIDs            []string `gae:"rack_ids"`
	RackLSEProtoTypeID string   `gae:"racklse_prototype_id"`
	KVMIDs             []string `gae:"kvm_ids"`
	RPMIDs             []string `gae:"rpm_ids"`
	SwitchIDs          []string `gae:"switch_ids"`
	// ufspb.RackLSE cannot be directly used as it contains pointer.
	RackLSE []byte `gae:",noindex"`
	// contains filtered or unexported fields
}

RackLSEEntity is a datastore entity that tracks RackLSE.

func (*RackLSEEntity) GetProto

func (e *RackLSEEntity) GetProto() (proto.Message, error)

GetProto returns the unmarshaled RackLSE.

type SchedulingUnitEntity

type SchedulingUnitEntity struct {
	ID          string   `gae:"$id"`
	Type        string   `gae:"type"`
	Pools       []string `gae:"pools"`
	MachineLSEs []string `gae:"machinelses"`
	Tags        []string `gae:"tags"`
	// ufspb.SchedulingUnit cannot be directly used as it contains pointer.
	SchedulingUnit []byte `gae:",noindex"`
	// contains filtered or unexported fields
}

SchedulingUnitEntity is a datastore entity that tracks a SchedulingUnit.

func (*SchedulingUnitEntity) GetProto

func (e *SchedulingUnitEntity) GetProto() (proto.Message, error)

GetProto returns the unmarshaled SchedulingUnit.

type VMEntity

type VMEntity struct {
	ID        string   `gae:"$id"`
	OSVersion string   `gae:"os_version"`
	Vlan      string   `gae:"vlan_id"`
	HostID    string   `gae:"host_id"`
	State     string   `gae:"state"`
	Lab       string   `gae:"lab"` // deprecated
	Zone      string   `gae:"zone"`
	Tags      []string `gae:"tags"`
	OS        []string `gae:"os"`
	// Follow others entities, store ufspb.VM bytes.
	VM []byte `gae:",noindex"`
	// contains filtered or unexported fields
}

VMEntity is a datastore entity that tracks VM.

func (*VMEntity) GetProto

func (e *VMEntity) GetProto() (proto.Message, error)

GetProto returns the unmarshaled VM.

Jump to

Keyboard shortcuts

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