configuration

package
v0.0.0-...-5888cca Latest Latest
Warning

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

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

Documentation

Overview

Package configuration provides interfaces for managing DataStore entities that correspond to device configurations

Index

Constants

View Source
const ChromePlatformKind string = "ChromePlatform"

ChromePlatformKind is the datastore entity kind for chrome platforms.

View Source
const ConfigBundleKind string = "ConfigBundle"

ConfigBundleKind is the datastore entity kind ConfigBundle.

View Source
const DHCPKind string = "DHCP"

DHCPKind is the datastore entity kind dhcp.

View Source
const DeviceConfigKind string = "DeviceConfig"

DeviceConfigKind is the name of the device config entity kind in datastore.

View Source
const DeviceStabilityKind string = "DeviceStability"

DeviceStabilityKind is the datastore entity kind for device stability.

View Source
const DutAttributeKind string = "DutAttribute"

DutAttributeKind is the datastore entity kind DutAttribute.

View Source
const FlatConfigKind string = "FlatConfig"

FlatConfigKind is the datastore entity kind FlatConfig.

View Source
const HwidDataKind string = "HwidData"

HwidDataKind is the datastore entity kind HwidData.

View Source
const IPBatchSize = 100

IPBatchSize is the batch size for updating IPs in a batch put request

View Source
const IPKind string = "IP"

IPKind is the datastore entity kind for IP record

View Source
const MachineLSEPrototypeKind string = "MachineLSEPrototype"

MachineLSEPrototypeKind is the datastore entity kind for MachineLSEPrototypes.

View Source
const OSVersionKind string = "OSVersion"

OSVersionKind is the datastore entity kind for chrome os_version.

View Source
const ProjectConfigKind string = "ProjectConfig"

ProjectConfigKind is the datastore entity kind for storing the project configs.

View Source
const PublicBoardModelDataKind string = "PublicBoardModelData"

PublicBoardModelDataKind is the datastore entity kind PublicBoardModelData.

View Source
const RackLSEPrototypeKind string = "RackLSEPrototype"

RackLSEPrototypeKind is the datastore entity kind for RackLSEPrototypes.

View Source
const VlanKind string = "Vlan"

VlanKind is the datastore entity kind Vlan.

Variables

View Source
var DutAttributeRegex = regexp.MustCompile(`^[a-z0-9]+(?:[\-_][a-z0-9]+)*$`)

Functions

func BatchDeleteDHCPs

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

BatchDeleteDHCPs deletes dhcps 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 BatchDeleteDeviceConfigsACL

func BatchDeleteDeviceConfigsACL(ctx context.Context, cfgIDs []*deviceconfig.ConfigId) error

BatchDeleteDeviceConfigsACL deletes a batch of device configs and check ACLs

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

func BatchDeleteIPs

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

BatchDeleteIPs deletes ips 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 BatchGetChromePlatforms

func BatchGetChromePlatforms(ctx context.Context, ids []string) ([]*ufspb.ChromePlatform, error)

BatchGetChromePlatforms returns a batch of chrome platforms from datastore.

func BatchGetDHCPConfigs

func BatchGetDHCPConfigs(ctx context.Context, ids []string) ([]*ufspb.DHCPConfig, error)

BatchGetDHCPConfigs returns a batch of dhcp configs

func BatchGetMachineLSEPrototypes

func BatchGetMachineLSEPrototypes(ctx context.Context, ids []string) ([]*ufspb.MachineLSEPrototype, error)

BatchGetMachineLSEPrototypes returns a batch of machine lse prototypes from datastore.

func BatchGetRackLSEPrototypes

func BatchGetRackLSEPrototypes(ctx context.Context, ids []string) ([]*ufspb.RackLSEPrototype, error)

BatchGetRackLSEPrototypes returns a batch of rack lse prototypes from datastore.

func BatchGetVlans

func BatchGetVlans(ctx context.Context, ids []string) ([]*ufspb.Vlan, error)

BatchGetVlans returns a batch of vlans from datastore.

func BatchUpdateChromePlatforms

func BatchUpdateChromePlatforms(ctx context.Context, platforms []*ufspb.ChromePlatform) ([]*ufspb.ChromePlatform, error)

BatchUpdateChromePlatforms updates ChromePlatforms 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 BatchUpdateDHCPs

func BatchUpdateDHCPs(ctx context.Context, dhcps []*ufspb.DHCPConfig) ([]*ufspb.DHCPConfig, error)

BatchUpdateDHCPs updates the dhcp entity to UFS.

This can be used inside a transaction

func BatchUpdateDeviceConfigs

func BatchUpdateDeviceConfigs(ctx context.Context, configs []*deviceconfig.Config, realmAssigner RealmAssignerFunc) ([]*deviceconfig.Config, error)

BatchUpdateDeviceConfigs upserts all configs. The `realmAssigner` determines the logic for adding realms to these configs, and can be different in different namespaces.

func BatchUpdateIPs

func BatchUpdateIPs(ctx context.Context, ips []*ufspb.IP) ([]*ufspb.IP, error)

BatchUpdateIPs updates the ip entity to UFS.

This cannot be used inside a transaction as the number IPS can exceed the transaction limit of 500

func BatchUpdateMachineLSEPrototypes

func BatchUpdateMachineLSEPrototypes(ctx context.Context, machineLSEPrototypes []*ufspb.MachineLSEPrototype) ([]*ufspb.MachineLSEPrototype, error)

BatchUpdateMachineLSEPrototypes updates machineLSEPrototype 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 BatchUpdateRackLSEPrototypes

func BatchUpdateRackLSEPrototypes(ctx context.Context, prototypes []*ufspb.RackLSEPrototype) ([]*ufspb.RackLSEPrototype, error)

BatchUpdateRackLSEPrototypes updates rackLSEPrototype 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 BatchUpdateVlans

func BatchUpdateVlans(ctx context.Context, vlans []*ufspb.Vlan) ([]*ufspb.Vlan, error)

BatchUpdateVlans updates a batch of vlans to datastore

Can be used in a transaction

func BlankRealmAssigner

func BlankRealmAssigner(d *deviceconfig.Config) string

BlankRealmAssigner is a RealmAssignerFunc for situations where associating a realm is not import, ex. fetching an entity.

func BoardModelRealmAssigner

func BoardModelRealmAssigner(d *deviceconfig.Config) string

BoardModelRealmAssigner constructs the realm of deviceconfig based on the board and model

func CrOSRealmAssigner

func CrOSRealmAssigner(d *deviceconfig.Config) string

CrOSRealmAssigner constructs the realm

func CreateChromePlatform

func CreateChromePlatform(ctx context.Context, chromePlatform *ufspb.ChromePlatform) (*ufspb.ChromePlatform, error)

CreateChromePlatform creates a new chromePlatform in datastore.

func CreateMachineLSEPrototype

func CreateMachineLSEPrototype(ctx context.Context, machineLSEPrototype *ufspb.MachineLSEPrototype) (*ufspb.MachineLSEPrototype, error)

CreateMachineLSEPrototype creates a new machineLSEPrototype in datastore.

func CreateRackLSEPrototype

func CreateRackLSEPrototype(ctx context.Context, rackLSEPrototype *ufspb.RackLSEPrototype) (*ufspb.RackLSEPrototype, error)

CreateRackLSEPrototype creates a new rackLSEPrototype in datastore.

func CreateVlan

func CreateVlan(ctx context.Context, vlan *ufspb.Vlan) (*ufspb.Vlan, error)

CreateVlan creates a new vlan in datastore.

func DeleteChromePlatform

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

DeleteChromePlatform deletes the chromePlatform in datastore

func DeleteChromePlatforms

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

DeleteChromePlatforms deletes a batch of chrome platforms

func DeleteDHCP

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

DeleteDHCP deletes a dhcp in datastore

This can be used inside a transaction

func DeleteDHCPs

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

DeleteDHCPs deletes a batch of dhcps

This function doesn't throw exceptions if the resourceName doesn't exist.

func DeleteIPs

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

DeleteIPs deletes a batch of ips

func DeleteMachineLSEPrototype

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

DeleteMachineLSEPrototype deletes the machineLSEPrototype in datastore

func DeleteOSes

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

DeleteOSes deletes a batch of chrome os_version

func DeleteRackLSEPrototype

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

DeleteRackLSEPrototype deletes the rackLSEPrototype in datastore

func DeleteVlan

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

DeleteVlan deletes the vlan in datastore

func DeleteVlans

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

DeleteVlans deletes a batch of vlans

func DeviceConfigsExistACL

func DeviceConfigsExistACL(ctx context.Context, cfgIDs []*deviceconfig.ConfigId) ([]bool, error)

DeviceConfigsExistACL returns an array of bools. The ith value in this array represents whether the ith entry in cfgIDs exists and is visible to the user

func GenerateCBEntityId

func GenerateCBEntityId(cb *payload.ConfigBundle) (string, error)

func GenerateFCEntityId

func GenerateFCEntityId(fc *payload.FlatConfig) (string, error)

func GenerateFCIdFromCrosMachine

func GenerateFCIdFromCrosMachine(machine *ufspb.Machine) (string, error)

GenerateFCIdFromCrosMachine generates a FlatConfig ID from a Cros Machine.

The ID generated is based on the build target (board), model, and sku of a ChromeOS Machine. The result is ${board}-${model}-${model:sku}.

func GetAllChromePlatforms

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

GetAllChromePlatforms returns all platforms in record.

func GetAllDHCPs

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

GetAllDHCPs returns all dhcps in datastore.

func GetAllIPs

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

GetAllIPs returns all ips in datastore.

func GetAllOSes

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

GetAllOSes returns all os versions in record.

func GetAllVlans

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

GetAllVlans returns all vlans in datastore.

func GetChromePlatform

func GetChromePlatform(ctx context.Context, id string) (*ufspb.ChromePlatform, error)

GetChromePlatform returns chromePlatform for the given id from datastore.

func GetChromePlatformIndexedFieldName

func GetChromePlatformIndexedFieldName(input string) (string, error)

GetChromePlatformIndexedFieldName returns the index name

func GetConfigBundle

func GetConfigBundle(ctx context.Context, id string) (rsp *payload.ConfigBundle, err error)

GetConfigBundle returns ConfigBundle for the given id (${programId}-${designId}) from datastore.

func GetConfigID

func GetConfigID(board, model, variant string) *deviceconfig.ConfigId

GetConfigID creates ConfigId from the board/model/variant strings.

func GetDHCPConfig

func GetDHCPConfig(ctx context.Context, id string) (*ufspb.DHCPConfig, error)

GetDHCPConfig returns dhcp config for the given id from datastore.

func GetDHCPIndexedFieldName

func GetDHCPIndexedFieldName(input string) (string, error)

GetDHCPIndexedFieldName returns the index name

func GetDeviceConfigACL

func GetDeviceConfigACL(ctx context.Context, cfgID *deviceconfig.ConfigId) (*deviceconfig.Config, error)

GetDeviceConfigACL fetches a single device config if it is visible to the user.

func GetDeviceConfigIDStr

func GetDeviceConfigIDStr(cfgid *deviceconfig.ConfigId) string

GetDeviceConfigIDStr returns a string as device config short name.

func GetDeviceStability

func GetDeviceStability(ctx context.Context, id string) (*dut.DeviceStability, error)

GetDeviceStability returns deviceStability for the given id from datastore.

func GetDutAttribute

func GetDutAttribute(ctx context.Context, id string) (rsp *api.DutAttribute, err error)

GetDutAttribute returns DutAttribute for the given id from datastore.

func GetFlatConfig

func GetFlatConfig(ctx context.Context, id string) (rsp *payload.FlatConfig, err error)

GetFlatConfig returns FlatConfig for the given id (${programId}-${designId} or ${programId}-${designId}-${designConfigId}) from datastore.

func GetIPIndexedFieldName

func GetIPIndexedFieldName(input string) (string, error)

GetIPIndexedFieldName returns the index name

func GetMachineLSEPrototype

func GetMachineLSEPrototype(ctx context.Context, id string) (*ufspb.MachineLSEPrototype, error)

GetMachineLSEPrototype returns machineLSEPrototype for the given id from datastore.

func GetMachineLSEPrototypeIndexedFieldName

func GetMachineLSEPrototypeIndexedFieldName(input string) (string, error)

GetMachineLSEPrototypeIndexedFieldName returns the index name

func GetOSVersionIndexedFieldName

func GetOSVersionIndexedFieldName(input string) (string, error)

GetOSVersionIndexedFieldName returns the index name

func GetRackLSEPrototype

func GetRackLSEPrototype(ctx context.Context, id string) (*ufspb.RackLSEPrototype, error)

GetRackLSEPrototype returns rackLSEPrototype for the given id from datastore.

func GetRackLSEPrototypeIndexedFieldName

func GetRackLSEPrototypeIndexedFieldName(input string) (string, error)

GetRackLSEPrototypeIndexedFieldName returns the index name

func GetVlan

func GetVlan(ctx context.Context, id string) (*ufspb.Vlan, error)

GetVlan returns vlan for the given id from datastore.

func GetVlanIndexedFieldName

func GetVlanIndexedFieldName(input string) (string, error)

GetVlanIndexedFieldName returns the index name

func ImportDHCPConfigs

func ImportDHCPConfigs(ctx context.Context, dhcpConfigs []*ufspb.DHCPConfig) (*ufsds.OpResults, error)

ImportDHCPConfigs creates or updates a batch of dhcp configs in datastore

func ImportIPs

func ImportIPs(ctx context.Context, ips []*ufspb.IP) (*ufsds.OpResults, error)

ImportIPs creates or updates a batch of ips in datastore

func ImportVlans

func ImportVlans(ctx context.Context, vlans []*ufspb.Vlan) (*ufsds.OpResults, error)

ImportVlans creates or updates a batch of vlan in datastore

func ListChromePlatforms

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

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

func ListDHCPConfigs

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

ListDHCPConfigs lists the dhcp configs

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

func ListDeviceConfigs

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

ListDeviceConfigs lists all device configs.

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

func ListDutAttributes

func ListDutAttributes(ctx context.Context, keysOnly bool) (rsp []*api.DutAttribute, err error)

ListDutAttributes lists the DutAttributes from datastore.

func ListHwidData

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

ListHwidData lists the HwidData

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

func ListIPs

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

ListIPs lists the ips

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

func ListMachineLSEPrototypes

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

ListMachineLSEPrototypes lists the machineLSEPrototypes

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

func ListOSes

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

ListOSes lists the chrome os_versions

func ListRackLSEPrototypes

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

ListRackLSEPrototypes lists the rackLSEPrototypes

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

func ListVlans

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

ListVlans lists the vlans

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

func ParseHwidData

func ParseHwidData(ent *HwidDataEntity) (*ufspb.HwidData, error)

ParseHwidData returns the HwidData proto based on the datastore entity.

It parses a given HwidDataEntity into the ufspb.HwidData proto containing all DutLabels. No error is returned if the entity is nil.

func ParseHwidDataIntoMfgCfg

func ParseHwidDataIntoMfgCfg(hwidData *ufspb.HwidData) (*ufsmfg.ManufacturingConfig, error)

ParseHwidDataIntoMfgCfg takes HWID data from the HWID server and conforms it into the ManufacturingConfig proto format.

Note that this ignores the CR50Phase and CR50KeyEnv fields as those have been deprecated in ManufacturingConfig and replaced by StateConfig values.

func QueryDHCPConfigByPropertyName

func QueryDHCPConfigByPropertyName(ctx context.Context, propertyName, id string) ([]*ufspb.DHCPConfig, error)

QueryDHCPConfigByPropertyName query dhcp entity in the datastore.

func QueryIPByAddress

func QueryIPByAddress(ctx context.Context, ip string) ([]*ufspb.IP, error)

QueryIPByAddress looks up an IPEntity by IPv4 or IPv6.

func QueryIPByPropertyName

func QueryIPByPropertyName(ctx context.Context, propertyMap map[string]string) ([]*ufspb.IP, error)

QueryIPByPropertyName query IP Entity by property in the datastore

func QueryVlanByPropertyName

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

QueryVlanByPropertyName query's vlanb Entity in the datastore

func RunFreeIPs

func RunFreeIPs(ctx context.Context, vlanName string, cb ipCallback) error

RunFreeIPs runs an ipCallback over all the unassigned IPs in a vlan.

Note that there are two kinds of unassigned IPs in a vlan, one of them has an explicit IPEntity object inside datastore that is not reserved and not occupied. The other kind doesn't exist (i.e. that particular IP has no corresponding datastore entity). It used to be the case that every possible IP in a vlan, whether assigned or unassigned, always got an IPEntity from the moment the vlan was created right up until it got deleted.

At some point, though, we decided to start supporting large vlans for which it would be impractical to preallocate all the IPs.

That's where this two-phase function comes from. We first try to find an unassigned-but-existent vlan inside datastore and then return that. However, in cases where there are no unassigned-but-existent vlans, we don't give up. We instead precompute all the possible IPs, put them in a map, remove entries that already exist from the map, and then pick arbitrary IPs.

This method is also deterministic. It uses a map internally, but we iterate over its keys in sorted order.

func SaveProjectConfig

func SaveProjectConfig(ctx context.Context, e *ProjectConfigEntity) error

SaveProjectConfig saves project config to database

func SetHwidDataWithDutLabels

func SetHwidDataWithDutLabels(hwidData *ufspb.HwidData) *ufspb.HwidData

SetHwidDataWithDutLabels sets the Sku and Variant of HwidData proto.

It parses the DutLabels of a given HwidData entity and fills in the Sku and Variant values of the proto.

func UpdateChromePlatform

func UpdateChromePlatform(ctx context.Context, chromePlatform *ufspb.ChromePlatform) (*ufspb.ChromePlatform, error)

UpdateChromePlatform updates chromePlatform in datastore.

Cannot be used in a transaction

func UpdateConfigBundle

func UpdateConfigBundle(ctx context.Context, cb *payload.ConfigBundle) (*payload.ConfigBundle, error)

UpdateConfigBundle updates ConfigBundle in datastore.

func UpdateDeviceStability

func UpdateDeviceStability(ctx context.Context, id string, ds *dut.DeviceStability) error

func UpdateDutAttribute

func UpdateDutAttribute(ctx context.Context, attr *api.DutAttribute) (*api.DutAttribute, error)

UpdateDutAttribute updates DutAttribute in datastore.

func UpdateFlatConfig

func UpdateFlatConfig(ctx context.Context, fc *payload.FlatConfig) (*payload.FlatConfig, error)

UpdateFlatConfig updates FlatConfig in datastore.

func UpdateMachineLSEPrototype

func UpdateMachineLSEPrototype(ctx context.Context, machineLSEPrototype *ufspb.MachineLSEPrototype) (*ufspb.MachineLSEPrototype, error)

UpdateMachineLSEPrototype updates machineLSEPrototype in datastore.

func UpdateRackLSEPrototype

func UpdateRackLSEPrototype(ctx context.Context, rackLSEPrototype *ufspb.RackLSEPrototype) (*ufspb.RackLSEPrototype, error)

UpdateRackLSEPrototype updates rackLSEPrototype in datastore.

func UpdateServiceConfig

func UpdateServiceConfig(ctx context.Context, sc *ServiceConfig) error

func UpdateVlan

func UpdateVlan(ctx context.Context, vlan *ufspb.Vlan) (*ufspb.Vlan, error)

UpdateVlan updates vlan in datastore.

Types

type ChromePlatformEntity

type ChromePlatformEntity struct {
	Extra        datastore.PropertyMap `gae:",extra"`
	ID           string                `gae:"$id"`
	Tags         []string              `gae:"tags"`
	Manufacturer string                `gae:"manufacturer"`
	// ufspb.ChromePlatform cannot be directly used as it contains pointer.
	Platform []byte `gae:",noindex"`
	// contains filtered or unexported fields
}

ChromePlatformEntity is a datastore entity that tracks a platform.

func (*ChromePlatformEntity) GetProto

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

GetProto returns the unmarshaled Chrome platform.

func (*ChromePlatformEntity) Validate

func (e *ChromePlatformEntity) Validate() error

Validate returns whether a ChromePlatformEntity is valid.

type ConfigBundleEntity

type ConfigBundleEntity struct {
	Extra      datastore.PropertyMap `gae:",extra"`
	ID         string                `gae:"$id"`
	ConfigData []byte                `gae:",noindex"`
	Updated    time.Time
	// contains filtered or unexported fields
}

ConfigBundleEntity is a datastore entity that tracks a ConfigBundle.

func (*ConfigBundleEntity) GetProto

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

GetProto returns the unmarshaled ConfigBundle.

func (*ConfigBundleEntity) Validate

func (e *ConfigBundleEntity) Validate() error

Validate returns whether a ConfigBundleEntity is valid.

type DHCPEntity

type DHCPEntity struct {
	Extra datastore.PropertyMap `gae:",extra"`
	// refer to the hostname
	ID   string `gae:"$id"`
	IPv4 string `gae:"ipv4"`
	Vlan string `gae:"vlan"`
	// ufspb.DHCPConfig cannot be directly used as it contains pointer (timestamp).
	Dhcp []byte `gae:",noindex"`
	// contains filtered or unexported fields
}

DHCPEntity is a datastore entity that tracks dhcp.

func (*DHCPEntity) GetProto

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

GetProto returns the unmarshaled DHCP.

func (*DHCPEntity) Validate

func (e *DHCPEntity) Validate() error

Validate returns whether a DHCPEntity is valid.

type DeviceConfigEntity

type DeviceConfigEntity struct {
	Extra        datastore.PropertyMap `gae:",extra"`
	ID           string                `gae:"$id"`
	DeviceConfig []byte                `gae:",noindex"`
	Updated      time.Time
	Realm        string `gae:"realm"` // Realm for this entity
	// contains filtered or unexported fields
}

DeviceConfigEntity is a datastore entity that tracks a DeviceConfig.

func (*DeviceConfigEntity) GetProto

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

GetProto returns the unmarshaled DeviceConfig.

func (*DeviceConfigEntity) GetRealm

func (e *DeviceConfigEntity) GetRealm() string

GetRealm returns the realm of the device config.

func (*DeviceConfigEntity) Validate

func (e *DeviceConfigEntity) Validate() error

Validate returns whether a DeviceConfigEntity is valid.

type DeviceStabilityEntity

type DeviceStabilityEntity struct {
	Extra         datastore.PropertyMap `gae:",extra"`
	ID            string                `gae:"$id"`
	StabilityData []byte                `gae:",noindex"`
	Updated       time.Time
	// contains filtered or unexported fields
}

DeviceStabilityEntity is a datastore entity that tracks a device stability record .

func (*DeviceStabilityEntity) GetProto

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

GetProto returns the unmarshaled DeviceStability.

type DutAttributeEntity

type DutAttributeEntity struct {
	Extra         datastore.PropertyMap `gae:",extra"`
	ID            string                `gae:"$id"`
	AttributeData []byte                `gae:",noindex"`
	Updated       time.Time
	// contains filtered or unexported fields
}

DutAttributeEntity is a datastore entity that tracks a DutAttribute.

func (*DutAttributeEntity) GetProto

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

GetProto returns the unmarshaled DutAttribute.

func (*DutAttributeEntity) Validate

func (e *DutAttributeEntity) Validate() error

Validate returns whether a DutAttributeEntity is valid.

type FlatConfigEntity

type FlatConfigEntity struct {
	Extra      datastore.PropertyMap `gae:",extra"`
	ID         string                `gae:"$id"`
	ConfigData []byte                `gae:",noindex"`
	Updated    time.Time
	// contains filtered or unexported fields
}

FlatConfigEntity is a datastore entity that tracks a FlatConfig.

func (*FlatConfigEntity) GetProto

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

GetProto returns the unmarshaled FlatConfig.

func (*FlatConfigEntity) Validate

func (e *FlatConfigEntity) Validate() error

Validate returns whether a FlatConfigEntity is valid.

type HwidDataEntity

type HwidDataEntity struct {
	Extra    datastore.PropertyMap `gae:",extra"`
	ID       string                `gae:"$id"`
	HwidData []byte                `gae:",noindex"`
	Updated  time.Time
	// contains filtered or unexported fields
}

HwidDataEntity is a datastore entity that tracks a HwidData.

func GetHwidData

func GetHwidData(ctx context.Context, hwid string) (*HwidDataEntity, error)

GetHwidData returns HwidData for the given hwid from datastore.

func UpdateHwidData

func UpdateHwidData(ctx context.Context, d *ufspb.HwidData, hwid string) (*HwidDataEntity, error)

UpdateHwidData updates HwidData in datastore.

func UpdateLegacyHwidData

func UpdateLegacyHwidData(ctx context.Context, d *ufspb.DutLabel, hwid string) (*HwidDataEntity, error)

UpdateLegacyHwidData updates HwidDataEntity with DutLabel as HwidData instead of HwidData proto in datastore. This is also the previous implementation of UpdateHwidData.

func (*HwidDataEntity) GetDutLabelProto

func (e *HwidDataEntity) GetDutLabelProto() (proto.Message, error)

GetDutLabelProto returns the unmarshaled HwidData. TODO (b/240771930): Remove this method once datastore data is overwritten.

func (*HwidDataEntity) GetProto

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

GetProto returns the unmarshaled HwidData.

type IPEntity

type IPEntity struct {
	Extra datastore.PropertyMap `gae:",extra"`
	// To avoid duplication, the internal reference ID for IP: vlanName/IPv4, e.g. browser:120/20123455612
	// For an IPv6 address, use the textual representation of IPv6.
	ID string `gae:"$id"`
	// IPv4 addresses, for historical UFS reasons, store both the numerical address and the string representation.
	IPv4    uint32 `gae:"ipv4"`
	IPv4Str string `gae:"ipv4_str"`
	// For IPv6, we don't bother storing the human-readable form of the IP address. This can be reconstructed on demand.
	IPv6     []byte `gae:"ipv6"`
	Vlan     string `gae:"vlan"`
	Occupied bool   `gae:"occupied"`
	Reserve  bool   `gae:"reserve"`
	// contains filtered or unexported fields
}

IPEntity is a datastore entity that tracks IP.

IPv4-related fields should ONLY be set if the address is an IPv4 address.

The IPv6 field should always be set, even for IPv4 addresses. The Go standard library reserves a prefix to designate IPv4 in IPv6 addresses, so we do the same.

func (*IPEntity) GetProto

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

GetProto returns the unmarshaled IP.

Note: we do NOT enforce invariants such as an IPv6 containing exactly 16 bytes.

func (*IPEntity) Validate

func (e *IPEntity) Validate() error

Validate returns whether an IPEntity is valid.

type MachineLSEPrototypeEntity

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

MachineLSEPrototypeEntity is a datastore entity that tracks a platform.

func (*MachineLSEPrototypeEntity) GetProto

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

GetProto returns the unmarshaled MachineLSEPrototype.

func (*MachineLSEPrototypeEntity) Validate

func (e *MachineLSEPrototypeEntity) Validate() error

Validate returns whether a MachineLSEPrototypeEntity is valid.

type OSVersionEntity

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

OSVersionEntity is a datastore entity that tracks an os_version.

func (*OSVersionEntity) GetProto

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

GetProto returns the unmarshaled Chrome os_version.

func (*OSVersionEntity) Validate

func (e *OSVersionEntity) Validate() error

Validate returns whether an OSVersionEntity is valid.

type ProjectConfigEntity

type ProjectConfigEntity struct {
	Extra            datastore.PropertyMap `gae:",extra"`
	Name             string                `gae:"$id"`
	DailyDumpTimeStr string
	// contains filtered or unexported fields
}

ProjectConfigEntity is a datastore entity that stores the project configs.

func GetProjectConfig

func GetProjectConfig(ctx context.Context, name string) (*ProjectConfigEntity, error)

GetProjectConfig gets project config from database

type PublicBoardModelDataEntity

type PublicBoardModelDataEntity struct {
	Extra                 datastore.PropertyMap `gae:",extra"`
	Board                 string                `gae:"$id"`
	Models                []string              `gae:"models"`
	BoardHasPrivateModels bool                  `gae:"boardHasPrivateModels"`
	// contains filtered or unexported fields
}

PublicBoardModelDataEntity is a datastore entity that tracks a PublicBoardModelData.

func AddPublicBoardModelData

func AddPublicBoardModelData(ctx context.Context, board string, models []string, hasPrivateModels bool) (*PublicBoardModelDataEntity, error)

AddPublicBoardModelData adds a public board name and its corresponding models in the datastore.

func GetPublicBoardModelData

func GetPublicBoardModelData(ctx context.Context, board string) (*PublicBoardModelDataEntity, error)

GetPublicBoardModelData returns PublicBoardModelData for the given board from datastore.

type RackLSEPrototypeEntity

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

RackLSEPrototypeEntity is a datastore entity that tracks a platform.

func (*RackLSEPrototypeEntity) GetProto

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

GetProto returns the unmarshaled RackLSEPrototype.

func (*RackLSEPrototypeEntity) Validate

func (e *RackLSEPrototypeEntity) Validate() error

Validate returns whether a RackLSEPrototypeEntity is valid.

type RealmAssignerFunc

type RealmAssignerFunc func(*deviceconfig.Config) string

RealmAssignerFunc holds logic for associating a `DeviceConfig` with a realm.

type ServiceConfig

type ServiceConfig struct {
	// The last checked vm mac address. Used for vm mac address auto generation.
	LastCheckedVMMacAddress string
}

ServiceConfig we stored for ufs.

func GetServiceConfig

func GetServiceConfig(ctx context.Context) (*ServiceConfig, error)

func InitEmptyServiceConfig

func InitEmptyServiceConfig() *ServiceConfig

type ServiceConfigEntity

type ServiceConfigEntity struct {
	Extra      datastore.PropertyMap `gae:",extra"`
	ID         string                `gae:"$id"`
	Data       ServiceConfig         `gae:",noindex"`
	UpdateTime time.Time
	// contains filtered or unexported fields
}

ServiceConfigEntity is a datastore entity that records service-level configs.

type VlanEntity

type VlanEntity struct {
	Extra     datastore.PropertyMap `gae:",extra"`
	ID        string                `gae:"$id"`
	State     string                `gae:"state"`
	CidrBlock string                `gae:"cidr_block"`
	Zones     []string              `gae:"zone"`
	Tags      []string              `gae:"tags"`
	// ufspb.Vlan cannot be directly used as it contains pointer.
	Vlan []byte `gae:",noindex"`
	// contains filtered or unexported fields
}

VlanEntity is a datastore entity that tvlans Vlan.

func (*VlanEntity) GetProto

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

GetProto returns the unmarshaled Vlan.

func (*VlanEntity) Validate

func (e *VlanEntity) Validate() error

Validate returns whether a vlan entity is valid.

Jump to

Keyboard shortcuts

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