Documentation
¶
Overview ¶
Package configuration provides interfaces for managing DataStore entities that correspond to device configurations
Index ¶
- Constants
- Variables
- func BatchDeleteDHCPs(ctx context.Context, ids []string) error
- func BatchDeleteDeviceConfigsACL(ctx context.Context, cfgIDs []*deviceconfig.ConfigId) error
- func BatchDeleteIPs(ctx context.Context, ids []string) error
- func BatchGetChromePlatforms(ctx context.Context, ids []string) ([]*ufspb.ChromePlatform, error)
- func BatchGetDHCPConfigs(ctx context.Context, ids []string) ([]*ufspb.DHCPConfig, error)
- func BatchGetMachineLSEPrototypes(ctx context.Context, ids []string) ([]*ufspb.MachineLSEPrototype, error)
- func BatchGetRackLSEPrototypes(ctx context.Context, ids []string) ([]*ufspb.RackLSEPrototype, error)
- func BatchGetVlans(ctx context.Context, ids []string) ([]*ufspb.Vlan, error)
- func BatchUpdateChromePlatforms(ctx context.Context, platforms []*ufspb.ChromePlatform) ([]*ufspb.ChromePlatform, error)
- func BatchUpdateDHCPs(ctx context.Context, dhcps []*ufspb.DHCPConfig) ([]*ufspb.DHCPConfig, error)
- func BatchUpdateDeviceConfigs(ctx context.Context, configs []*deviceconfig.Config, ...) ([]*deviceconfig.Config, error)
- func BatchUpdateIPs(ctx context.Context, ips []*ufspb.IP) ([]*ufspb.IP, error)
- func BatchUpdateMachineLSEPrototypes(ctx context.Context, machineLSEPrototypes []*ufspb.MachineLSEPrototype) ([]*ufspb.MachineLSEPrototype, error)
- func BatchUpdateRackLSEPrototypes(ctx context.Context, prototypes []*ufspb.RackLSEPrototype) ([]*ufspb.RackLSEPrototype, error)
- func BatchUpdateVlans(ctx context.Context, vlans []*ufspb.Vlan) ([]*ufspb.Vlan, error)
- func BlankRealmAssigner(d *deviceconfig.Config) string
- func BoardModelRealmAssigner(d *deviceconfig.Config) string
- func CrOSRealmAssigner(d *deviceconfig.Config) string
- func CreateChromePlatform(ctx context.Context, chromePlatform *ufspb.ChromePlatform) (*ufspb.ChromePlatform, error)
- func CreateMachineLSEPrototype(ctx context.Context, machineLSEPrototype *ufspb.MachineLSEPrototype) (*ufspb.MachineLSEPrototype, error)
- func CreateRackLSEPrototype(ctx context.Context, rackLSEPrototype *ufspb.RackLSEPrototype) (*ufspb.RackLSEPrototype, error)
- func CreateVlan(ctx context.Context, vlan *ufspb.Vlan) (*ufspb.Vlan, error)
- func DeleteChromePlatform(ctx context.Context, id string) error
- func DeleteChromePlatforms(ctx context.Context, resourceNames []string) *ufsds.OpResults
- func DeleteDHCP(ctx context.Context, id string) error
- func DeleteDHCPs(ctx context.Context, resourceNames []string) *ufsds.OpResults
- func DeleteIPs(ctx context.Context, resourceNames []string) *ufsds.OpResults
- func DeleteMachineLSEPrototype(ctx context.Context, id string) error
- func DeleteOSes(ctx context.Context, resourceNames []string) *ufsds.OpResults
- func DeleteRackLSEPrototype(ctx context.Context, id string) error
- func DeleteVlan(ctx context.Context, id string) error
- func DeleteVlans(ctx context.Context, resourceNames []string) *ufsds.OpResults
- func DeviceConfigsExistACL(ctx context.Context, cfgIDs []*deviceconfig.ConfigId) ([]bool, error)
- func GenerateCBEntityId(cb *payload.ConfigBundle) (string, error)
- func GenerateFCEntityId(fc *payload.FlatConfig) (string, error)
- func GenerateFCIdFromCrosMachine(machine *ufspb.Machine) (string, error)
- func GetAllChromePlatforms(ctx context.Context) (*ufsds.OpResults, error)
- func GetAllDHCPs(ctx context.Context) (*ufsds.OpResults, error)
- func GetAllIPs(ctx context.Context) (*ufsds.OpResults, error)
- func GetAllOSes(ctx context.Context) (*ufsds.OpResults, error)
- func GetAllVlans(ctx context.Context) (*ufsds.OpResults, error)
- func GetChromePlatform(ctx context.Context, id string) (*ufspb.ChromePlatform, error)
- func GetChromePlatformIndexedFieldName(input string) (string, error)
- func GetConfigBundle(ctx context.Context, id string) (rsp *payload.ConfigBundle, err error)
- func GetConfigID(board, model, variant string) *deviceconfig.ConfigId
- func GetDHCPConfig(ctx context.Context, id string) (*ufspb.DHCPConfig, error)
- func GetDHCPIndexedFieldName(input string) (string, error)
- func GetDeviceConfigACL(ctx context.Context, cfgID *deviceconfig.ConfigId) (*deviceconfig.Config, error)
- func GetDeviceConfigIDStr(cfgid *deviceconfig.ConfigId) string
- func GetDeviceStability(ctx context.Context, id string) (*dut.DeviceStability, error)
- func GetDutAttribute(ctx context.Context, id string) (rsp *api.DutAttribute, err error)
- func GetFlatConfig(ctx context.Context, id string) (rsp *payload.FlatConfig, err error)
- func GetIPIndexedFieldName(input string) (string, error)
- func GetMachineLSEPrototype(ctx context.Context, id string) (*ufspb.MachineLSEPrototype, error)
- func GetMachineLSEPrototypeIndexedFieldName(input string) (string, error)
- func GetOSVersionIndexedFieldName(input string) (string, error)
- func GetRackLSEPrototype(ctx context.Context, id string) (*ufspb.RackLSEPrototype, error)
- func GetRackLSEPrototypeIndexedFieldName(input string) (string, error)
- func GetVlan(ctx context.Context, id string) (*ufspb.Vlan, error)
- func GetVlanIndexedFieldName(input string) (string, error)
- func ImportDHCPConfigs(ctx context.Context, dhcpConfigs []*ufspb.DHCPConfig) (*ufsds.OpResults, error)
- func ImportIPs(ctx context.Context, ips []*ufspb.IP) (*ufsds.OpResults, error)
- func ImportVlans(ctx context.Context, vlans []*ufspb.Vlan) (*ufsds.OpResults, error)
- func ListChromePlatforms(ctx context.Context, pageSize int32, pageToken string, ...) (res []*ufspb.ChromePlatform, nextPageToken string, err error)
- func ListDHCPConfigs(ctx context.Context, pageSize int32, pageToken string, ...) (res []*ufspb.DHCPConfig, nextPageToken string, err error)
- func ListDeviceConfigs(ctx context.Context, pageSize int32, pageToken string, ...) (res []*deviceconfig.Config, nextPageToken string, err error)
- func ListDutAttributes(ctx context.Context, keysOnly bool) (rsp []*api.DutAttribute, err error)
- func ListHwidData(ctx context.Context, pageSize int32, pageToken string, ...) (res []*ufspb.HwidData, nextPageToken string, err error)
- func ListIPs(ctx context.Context, pageSize int32, pageToken string, ...) (res []*ufspb.IP, nextPageToken string, err error)
- func ListMachineLSEPrototypes(ctx context.Context, pageSize int32, pageToken string, ...) (res []*ufspb.MachineLSEPrototype, nextPageToken string, err error)
- func ListOSes(ctx context.Context, pageSize int32, pageToken string, ...) (res []*ufspb.OSVersion, nextPageToken string, err error)
- func ListRackLSEPrototypes(ctx context.Context, pageSize int32, pageToken string, ...) (res []*ufspb.RackLSEPrototype, nextPageToken string, err error)
- func ListVlans(ctx context.Context, pageSize int32, pageToken string, ...) (res []*ufspb.Vlan, nextPageToken string, err error)
- func ParseHwidData(ent *HwidDataEntity) (*ufspb.HwidData, error)
- func ParseHwidDataIntoMfgCfg(hwidData *ufspb.HwidData) (*ufsmfg.ManufacturingConfig, error)
- func QueryDHCPConfigByPropertyName(ctx context.Context, propertyName, id string) ([]*ufspb.DHCPConfig, error)
- func QueryIPByAddress(ctx context.Context, ip string) ([]*ufspb.IP, error)
- func QueryIPByPropertyName(ctx context.Context, propertyMap map[string]string) ([]*ufspb.IP, error)
- func QueryVlanByPropertyName(ctx context.Context, propertyName, id string, keysOnly bool) ([]*ufspb.Vlan, error)
- func RunFreeIPs(ctx context.Context, vlanName string, cb ipCallback) error
- func SaveProjectConfig(ctx context.Context, e *ProjectConfigEntity) error
- func SetHwidDataWithDutLabels(hwidData *ufspb.HwidData) *ufspb.HwidData
- func UpdateChromePlatform(ctx context.Context, chromePlatform *ufspb.ChromePlatform) (*ufspb.ChromePlatform, error)
- func UpdateConfigBundle(ctx context.Context, cb *payload.ConfigBundle) (*payload.ConfigBundle, error)
- func UpdateDeviceStability(ctx context.Context, id string, ds *dut.DeviceStability) error
- func UpdateDutAttribute(ctx context.Context, attr *api.DutAttribute) (*api.DutAttribute, error)
- func UpdateFlatConfig(ctx context.Context, fc *payload.FlatConfig) (*payload.FlatConfig, error)
- func UpdateMachineLSEPrototype(ctx context.Context, machineLSEPrototype *ufspb.MachineLSEPrototype) (*ufspb.MachineLSEPrototype, error)
- func UpdateRackLSEPrototype(ctx context.Context, rackLSEPrototype *ufspb.RackLSEPrototype) (*ufspb.RackLSEPrototype, error)
- func UpdateServiceConfig(ctx context.Context, sc *ServiceConfig) error
- func UpdateVlan(ctx context.Context, vlan *ufspb.Vlan) (*ufspb.Vlan, error)
- type ChromePlatformEntity
- type ConfigBundleEntity
- type DHCPEntity
- type DeviceConfigEntity
- type DeviceStabilityEntity
- type DutAttributeEntity
- type FlatConfigEntity
- type HwidDataEntity
- type IPEntity
- type MachineLSEPrototypeEntity
- type OSVersionEntity
- type ProjectConfigEntity
- type PublicBoardModelDataEntity
- type RackLSEPrototypeEntity
- type RealmAssignerFunc
- type ServiceConfig
- type ServiceConfigEntity
- type VlanEntity
Constants ¶
const ChromePlatformKind string = "ChromePlatform"
ChromePlatformKind is the datastore entity kind for chrome platforms.
const ConfigBundleKind string = "ConfigBundle"
ConfigBundleKind is the datastore entity kind ConfigBundle.
const DHCPKind string = "DHCP"
DHCPKind is the datastore entity kind dhcp.
const DeviceConfigKind string = "DeviceConfig"
DeviceConfigKind is the name of the device config entity kind in datastore.
const DeviceStabilityKind string = "DeviceStability"
DeviceStabilityKind is the datastore entity kind for device stability.
const DutAttributeKind string = "DutAttribute"
DutAttributeKind is the datastore entity kind DutAttribute.
const FlatConfigKind string = "FlatConfig"
FlatConfigKind is the datastore entity kind FlatConfig.
const HwidDataKind string = "HwidData"
HwidDataKind is the datastore entity kind HwidData.
const IPBatchSize = 100
IPBatchSize is the batch size for updating IPs in a batch put request
const IPKind string = "IP"
IPKind is the datastore entity kind for IP record
const MachineLSEPrototypeKind string = "MachineLSEPrototype"
MachineLSEPrototypeKind is the datastore entity kind for MachineLSEPrototypes.
const OSVersionKind string = "OSVersion"
OSVersionKind is the datastore entity kind for chrome os_version.
const ProjectConfigKind string = "ProjectConfig"
ProjectConfigKind is the datastore entity kind for storing the project configs.
const PublicBoardModelDataKind string = "PublicBoardModelData"
PublicBoardModelDataKind is the datastore entity kind PublicBoardModelData.
const RackLSEPrototypeKind string = "RackLSEPrototype"
RackLSEPrototypeKind is the datastore entity kind for RackLSEPrototypes.
const VlanKind string = "Vlan"
VlanKind is the datastore entity kind Vlan.
Variables ¶
var DutAttributeRegex = regexp.MustCompile(`^[a-z0-9]+(?:[\-_][a-z0-9]+)*$`)
Functions ¶
func BatchDeleteDHCPs ¶
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 ¶
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 ¶
BatchGetChromePlatforms returns a batch of chrome platforms from datastore.
func BatchGetDHCPConfigs ¶
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 ¶
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 ¶
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 ¶
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 ¶
CreateVlan creates a new vlan in datastore.
func DeleteChromePlatform ¶
DeleteChromePlatform deletes the chromePlatform in datastore
func DeleteChromePlatforms ¶
DeleteChromePlatforms deletes a batch of chrome platforms
func DeleteDHCPs ¶
DeleteDHCPs deletes a batch of dhcps
This function doesn't throw exceptions if the resourceName doesn't exist.
func DeleteMachineLSEPrototype ¶
DeleteMachineLSEPrototype deletes the machineLSEPrototype in datastore
func DeleteOSes ¶
DeleteOSes deletes a batch of chrome os_version
func DeleteRackLSEPrototype ¶
DeleteRackLSEPrototype deletes the rackLSEPrototype in datastore
func DeleteVlan ¶
DeleteVlan deletes the vlan in datastore
func DeleteVlans ¶
DeleteVlans deletes a batch of vlans
func DeviceConfigsExistACL ¶
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 ¶
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 ¶
GetAllChromePlatforms returns all platforms in record.
func GetAllDHCPs ¶
GetAllDHCPs returns all dhcps in datastore.
func GetAllOSes ¶
GetAllOSes returns all os versions in record.
func GetAllVlans ¶
GetAllVlans returns all vlans in datastore.
func GetChromePlatform ¶
GetChromePlatform returns chromePlatform for the given id from datastore.
func GetChromePlatformIndexedFieldName ¶
GetChromePlatformIndexedFieldName returns the index name
func GetConfigBundle ¶
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 ¶
GetDHCPConfig returns dhcp config for the given id from datastore.
func GetDHCPIndexedFieldName ¶
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 ¶
GetDeviceStability returns deviceStability for the given id from datastore.
func GetDutAttribute ¶
GetDutAttribute returns DutAttribute for the given id from datastore.
func GetFlatConfig ¶
GetFlatConfig returns FlatConfig for the given id (${programId}-${designId} or ${programId}-${designId}-${designConfigId}) from datastore.
func GetIPIndexedFieldName ¶
GetIPIndexedFieldName returns the index name
func GetMachineLSEPrototype ¶
GetMachineLSEPrototype returns machineLSEPrototype for the given id from datastore.
func GetMachineLSEPrototypeIndexedFieldName ¶
GetMachineLSEPrototypeIndexedFieldName returns the index name
func GetOSVersionIndexedFieldName ¶
GetOSVersionIndexedFieldName returns the index name
func GetRackLSEPrototype ¶
GetRackLSEPrototype returns rackLSEPrototype for the given id from datastore.
func GetRackLSEPrototypeIndexedFieldName ¶
GetRackLSEPrototypeIndexedFieldName returns the index name
func GetVlanIndexedFieldName ¶
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 ImportVlans ¶
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 ¶
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 ¶
QueryIPByAddress looks up an IPEntity by IPv4 or IPv6.
func QueryIPByPropertyName ¶
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 ¶
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 ¶
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 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
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 .
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 ¶
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.
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.
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.