configuration

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

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

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

Documentation

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

This section is empty.

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 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 BatchUpdateIPs

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

BatchUpdateIPs updates the ip entity to UFS.

This can be used inside a transaction

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 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 GenerateCBEntityId

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

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 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 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 GetPlatformsFromGit

func GetPlatformsFromGit(ctx context.Context, gitC *gitlib.Client, fp string) (*crimsonconfig.Platforms, error)

GetPlatformsFromGit gets chrome platforms from git.

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 ImportChromePlatforms

func ImportChromePlatforms(ctx context.Context, platforms []*ufspb.ChromePlatform) (*ufsds.OpResults, error)

ImportChromePlatforms inserts chrome platforms to datastore.

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 ImportMachineLSEPrototypes

func ImportMachineLSEPrototypes(ctx context.Context, lps []*ufspb.MachineLSEPrototype) (*ufsds.OpResults, error)

ImportMachineLSEPrototypes creates or updates a batch of machine lse prototypes in datastore

func ImportOses

func ImportOses(ctx context.Context, oses []*ufspb.OSVersion) (*ufsds.OpResults, error)

ImportOses inserts chrome os versions to datastore.

func ImportRackLSEPrototypes

func ImportRackLSEPrototypes(ctx context.Context, lps []*ufspb.RackLSEPrototype) (*ufsds.OpResults, error)

ImportRackLSEPrototypes creates or updates a batch of rack lse prototypes 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 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 ParsePlatformsFromFile

func ParsePlatformsFromFile(path string) (*crimsonconfig.Platforms, error)

ParsePlatformsFromFile parse chrome platforms in crimson format from local file.

func QueryDHCPConfigByPropertyName

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

QueryDHCPConfigByPropertyName query dhcp entity in the datastore.

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 SaveProjectConfig

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

SaveProjectConfig saves project config to database

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 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 UpdateVlan

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

UpdateVlan updates vlan in datastore.

Types

type ChromePlatformEntity

type ChromePlatformEntity struct {
	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.

type ConfigBundleEntity

type ConfigBundleEntity struct {
	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.

type DHCPEntity

type DHCPEntity struct {

	// 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.

type IPEntity

type IPEntity struct {

	// To avoid duplication, the internal reference ID for IP: vlanName/IPv4, e.g. browser:120/20123455612
	ID       string `gae:"$id"`
	IPv4     uint32 `gae:"ipv4"`
	IPv4Str  string `gae:"ipv4_str"`
	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.

func (*IPEntity) GetProto

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

GetProto returns the unmarshaled IP.

type MachineLSEPrototypeEntity

type MachineLSEPrototypeEntity struct {
	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.

type OSVersionEntity

type OSVersionEntity struct {
	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.

type ProjectConfigEntity

type ProjectConfigEntity struct {
	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 RackLSEPrototypeEntity

type RackLSEPrototypeEntity struct {
	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.

type VlanEntity

type VlanEntity struct {
	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.

Jump to

Keyboard shortcuts

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