inventory

package
v0.0.0-...-9994f1b Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2025 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Overview

Package inventory provides interfaces for managing DataStore entities that correspond to device lab setup environments

Index

Constants

View Source
const AssetTypeMachine string = "Machine"

AssetTypeMachine is the Machine asset type.

View Source
const AssetTypeMachineLSE string = "MachineLSE"

AssetTypeMachineLSE is the MachineLSE asset type

View Source
const AssetTypeVM string = "VM"

AssetTypeVM is the VM asset type.

View Source
const CommitSh string = "CommitSh"

CommitSh is the commit at which we need to pull the configs.

View Source
const DeviceLabelsKind string = "DeviceLabels"

DeviceLabelsKind is the datastore entity kind for labels.

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 MaintenanceConfigKind string = "MaintenanceConfig"

MaintenanceConfigKind is the datastore entity kind MaintenanceConfig.

View Source
const OwnershipDataKind string = "Ownership"

OwnershipDataKind is the datastore entity kind OwnershipData.

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 AddMaintenanceConfig

func AddMaintenanceConfig(ctx context.Context, name string) (*ufspb.MaintenanceConfig, error)

func BatchDeleteDeviceLabels

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

BatchDeleteDeviceLabels deletes labels 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 BatchDeleteOwnerships

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

BatchDeleteOwnerships deletes a batch of entities with the given ids

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 BatchGetDeviceLabels

func BatchGetDeviceLabels(ctx context.Context, ids []string) ([]*ufspb.DeviceLabels, error)

BatchGetDeviceLabels returns a batch of labels from datastore.

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 BatchGetMaintenanceConfigs

func BatchGetMaintenanceConfigs(ctx context.Context, names []string) ([]*ufspb.MaintenanceConfig, error)

BatchGetMaintenanceConfigs returns a batch of maintenance configurations from datastore.

func BatchGetVMs

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

BatchGetVMs returns a batch of vms from datastore.

func BatchUpdateDeviceLabels

func BatchUpdateDeviceLabels(ctx context.Context, labelsList []*ufspb.DeviceLabels) ([]*ufspb.DeviceLabels, error)

BatchUpdateDeviceLabels updates labels 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 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 DeleteDeviceLabels

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

DeleteDeviceLabels deletes the labels in datastore

func DeleteDeviceLabelsList

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

DeleteDeviceLabelsList deletes a batch of labels

Can be used in a transaction

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 DeleteMaintenanceConfig

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

DeleteMaintenanceConfig removes a maintenance configuration using its unique name.

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 GetAllDeviceLabels

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

GetAllDeviceLabels returns all labels in datastore.

func GetAllMachineLSEs

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

GetAllMachineLSEs returns all machine lses in datastore.

func GetAllMaintenanceConfigs

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

GetAllMaintenanceConfigs returns all maintenance configurations 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 GetDeviceLabels

func GetDeviceLabels(ctx context.Context, id string) (*ufspb.DeviceLabels, error)

GetDeviceLabels returns labels for the given id from datastore.

func GetDeviceLabelsIndexedFieldName

func GetDeviceLabelsIndexedFieldName(input string) (string, error)

GetDeviceLabelsIndexedFieldName 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 GetMachineLSEACL

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

GetMachineLSEACL returns the machineLSE for the requested id if the user has permissions to do so.

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 GetMaintenanceConfig

func GetMaintenanceConfig(ctx context.Context, name string) (*ufspb.MaintenanceConfig, error)

GetMaintenanceConfig retrieves a maintenance configuration from the datastore by its name if it exists.

func GetOwnershipIndexedFieldName

func GetOwnershipIndexedFieldName(input string) (string, error)

GetOwnershipIndexedFieldName 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 ListAllMachineLSEs

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

ListAllMachineLSEs returns all machine lses in datastore.

func ListAllMachineLSEsNameHive

func ListAllMachineLSEsNameHive(ctx context.Context) (res map[string]string, err error)

ListAllMachineLSEsNameHive return all machine lses name and hive in datastore.

func ListDeviceLabels

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

ListDeviceLabels lists the labels

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

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 ListMachineLSEsACL

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

ListMachineLSEsACL lists the machine lses that user has access to 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 ListMachineLSEsByIdPrefixSearch

func ListMachineLSEsByIdPrefixSearch(ctx context.Context, pageSize int32, pageToken string, prefix string, keysOnly bool) (res []*ufspb.MachineLSE, nextPageToken string, err error)

ListMachineLSEsByIdPrefixSearch lists the machineLSEs Does a query over MachineLSE entities using Name/ID prefix. 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 ListVMsByIdPrefixSearch

func ListVMsByIdPrefixSearch(ctx context.Context, pageSize int32, requiredSize int32, pageToken string, prefix string, keysOnly bool, validFunc func(*ufspb.VM) bool) (res []*ufspb.VM, nextPageToken string, err error)

ListVMsByIdPrefixSearch lists the VMs

Does a query over VM entities using Name/ID prefix. Returns up to pageSize entities, plus non-nil cursor (if there are more results). PageSize must be positive.

func QueryDeviceLabelsByPropertyName

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

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

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 UpdateMachineLSEOwnership

func UpdateMachineLSEOwnership(ctx context.Context, id string, ownership *ufspb.OwnershipData) (*ufspb.MachineLSE, error)

UpdateMachineLSEOwnership updates machineLSE ownership in datastore.

func UpdateMaintenanceConfigs

func UpdateMaintenanceConfigs(ctx context.Context, configs []*ufspb.MaintenanceConfig) ([]*ufspb.MaintenanceConfig, error)

UpdateMaintenanceConfigs updates the Maintenance Configuration in datastore.

func UpdateRackLSE

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

UpdateRackLSE updates rackLSE in datastore.

func UpdateVMOwnership

func UpdateVMOwnership(ctx context.Context, id string, ownership *ufspb.OwnershipData) (*ufspb.VM, error)

UpdateVMOwnership updates VM ownership in datastore.

Types

type DeviceLabelsEntity

type DeviceLabelsEntity struct {
	Extra        datastore.PropertyMap `gae:",extra"`
	ID           string                `gae:"$id"`
	ResourceType string                `gae:"resource_type"`
	// ufspb.DeviceLabels cannot be directly used as it contains pointer.
	DeviceLabels []byte `gae:",noindex"`
	// contains filtered or unexported fields
}

DeviceLabelsEntity is a datastore entity that tracks DeviceLabels.

func (*DeviceLabelsEntity) GetProto

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

GetProto returns the unmarshaled DeviceLabels.

func (*DeviceLabelsEntity) Validate

func (e *DeviceLabelsEntity) Validate() error

Validate returns whether a DeviceLabelsEntity is valid

type MachineLSEDeploymentEntity

type MachineLSEDeploymentEntity struct {
	Extra                datastore.PropertyMap `gae:",extra"`
	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.

func (*MachineLSEDeploymentEntity) Validate

func (e *MachineLSEDeploymentEntity) Validate() error

Validate returns whether a MachineLSEDeploymentEntity is valid

type MachineLSEEntity

type MachineLSEEntity struct {
	Extra                 datastore.PropertyMap `gae:",extra"`
	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"`
	RPMType               string                `gae:"rpm_type"`
	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"`
	AssociatedHostname    string                `gae:"associated_hostname"`
	AssociatedHostPort    string                `gae:"associated_host_port"`
	Pool                  string                `gae:"pool"`
	SwarmingServer        string                `gae:"swarming_server"`
	Customer              string                `gae:"customer"`
	SecurityLevel         string                `gae:"security_level"`
	MibaRealm             string                `gae:"miba_realm,noindex"` // deprecated
	LogicalZone           string                `gae:"logical_zone"`
	Realm                 string                `gae:"realm"`
	Hive                  string                `gae:"hive"`
	// 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.

func (*MachineLSEEntity) GetRealm

func (e *MachineLSEEntity) GetRealm() string

GetRealm returns the realm for the MachineLSE.

func (*MachineLSEEntity) Validate

func (e *MachineLSEEntity) Validate() error

Validate returns whether a MachineLSEEntity is valid

type MaintenanceConfigEntity

type MaintenanceConfigEntity struct {
	Extra             datastore.PropertyMap `gae:",extra"`
	Name              string                `gae:"$id"`
	MaintenanceConfig []byte                `gae:",noindex"`
	// contains filtered or unexported fields
}

func (*MaintenanceConfigEntity) GetProto

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

GetProto returns the unmarshalled MaintenanceConfig

func (*MaintenanceConfigEntity) Validate

func (e *MaintenanceConfigEntity) Validate() error

Validate returns whether a MaintenanceConfigEntity is valid

type OwnershipDataEntity

type OwnershipDataEntity struct {
	Extra         datastore.PropertyMap `gae:",extra"`
	Name          string                `gae:"$id"`
	AssetType     string                `gae:"AssetType"`
	OwnershipData []byte                `gae:",noindex"`
	// contains filtered or unexported fields
}

OwnershipDataEntity is a datastore entity that tracks a OwnershipData.

func GetOwnershipData

func GetOwnershipData(ctx context.Context, name string) (*OwnershipDataEntity, error)

GetOwnershipData returns OwnershipData for the given bot name from datastore.

func ListHostsByIdPrefixSearch

func ListHostsByIdPrefixSearch(ctx context.Context, pageSize int32, pageToken string, prefix string, keysOnly bool) (res []OwnershipDataEntity, nextPageToken string, err error)

ListHostsByIdPrefixSearch lists the hosts

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

func ListOwnerships

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

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

func PutOwnershipData

func PutOwnershipData(ctx context.Context, ownership *ufspb.OwnershipData, name string, assetType string) (*OwnershipDataEntity, error)

PutOwnershipData adds a bot name and its corresponding ownership in the datastore.

func (*OwnershipDataEntity) GetProto

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

GetProto returns the unmarshaled OwnershipData.

func (*OwnershipDataEntity) Validate

func (e *OwnershipDataEntity) Validate() error

Validate returns whether an OwnershipDataEntity is valid.

type RackLSEEntity

type RackLSEEntity struct {
	Extra              datastore.PropertyMap `gae:",extra"`
	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.

func (*RackLSEEntity) Validate

func (e *RackLSEEntity) Validate() error

Validate returns whether a RackLSEEntity is valid

type SchedulingUnitEntity

type SchedulingUnitEntity struct {
	Extra       datastore.PropertyMap `gae:",extra"`
	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.

func (*SchedulingUnitEntity) Validate

func (e *SchedulingUnitEntity) Validate() error

Validate returns whether a SchedulingUnitEntity is valid

type VMEntity

type VMEntity struct {
	Extra          datastore.PropertyMap `gae:",extra"`
	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"`
	MacAddress     string                `gae:"mac_address"`
	CpuCores       int32                 `gae:"cpu_cores"`
	Memory         int64                 `gae:"memory"`
	Storage        int64                 `gae:"storage"`
	Pool           string                `gae:"pool"`
	SwarmingServer string                `gae:"swarming_server"`
	Customer       string                `gae:"customer"`
	SecurityLevel  string                `gae:"security_level"`
	MibaRealm      string                `gae:"miba_realm,noindex"` // deprecated
	// 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.

func (*VMEntity) Validate

func (e *VMEntity) Validate() error

Validate returns whether a VMEntity is valid

Jump to

Keyboard shortcuts

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