firmware

package
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2025 License: Apache-2.0, BSD-3-Clause Imports: 12 Imported by: 4

Documentation

Overview

*

  • Copyright 2022 Comcast Cable Communications Management, LLC *
  • Licensed under the Apache License, Version 2.0 (the "License");
  • you may not use this file except in compliance with the License.
  • You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software
  • distributed under the License is distributed on an "AS IS" BASIS,
  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  • See the License for the specific language governing permissions and
  • limitations under the License. *
  • SPDX-License-Identifier: Apache-2.0

*

  • Copyright 2022 Comcast Cable Communications Management, LLC *
  • Licensed under the Apache License, Version 2.0 (the "License");
  • you may not use this file except in compliance with the License.
  • You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software
  • distributed under the License is distributed on an "AS IS" BASIS,
  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  • See the License for the specific language governing permissions and
  • limitations under the License. *
  • SPDX-License-Identifier: Apache-2.0

*

  • Copyright 2022 Comcast Cable Communications Management, LLC *
  • Licensed under the Apache License, Version 2.0 (the "License");
  • you may not use this file except in compliance with the License.
  • You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software
  • distributed under the License is distributed on an "AS IS" BASIS,
  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  • See the License for the specific language governing permissions and
  • limitations under the License. *
  • SPDX-License-Identifier: Apache-2.0

Index

Constants

View Source
const (
	MAC_RULE       = "MAC_RULE"
	IP_RULE        = "IP_RULE"
	ENV_MODEL_RULE = "ENV_MODEL_RULE"

	IP_FILTER   = "IP_FILTER"
	TIME_FILTER = "TIME_FILTER"

	REBOOT_IMMEDIATELY_FILTER = "REBOOT_IMMEDIATELY_FILTER"
	DOWNLOAD_LOCATION_FILTER  = "DOWNLOAD_LOCATION_FILTER"

	IV_RULE        = "IV_RULE"
	MIN_CHECK_RULE = "MIN_CHECK_RULE"
	MIN_CHECK_RI   = "MIN_CHECK_RI"

	GLOBAL_PERCENT = "GLOBAL_PERCENT"

	ACTIVATION_VERSION = "ACTIVATION_VERSION"
	KEY                = "FREE_ARG"
	VALUE              = "FIXED_ARG"
)
View Source
const (
	ApplicableActionClass               = ".ApplicableAction"
	RuleActionClass                     = ".RuleAction"
	DefinePropertiesActionClass         = ".DefinePropertiesAction"
	DefinePropertiesTemplateActionClass = ".DefinePropertiesTemplateAction"
	BlockingFilterActionClass           = ".BlockingFilterAction"
)

ApplicableAction's Type has to be one of these

View Source
const (
	STRING  ValidationType = "STRING"
	BOOLEAN                = "BOOLEAN"
	NUMBER                 = "NUMBER"
	PERCENT                = "PERCENT"
	PORT                   = "PORT"
	URL                    = "URL"
	IPV4                   = "IPV4"
	IPV6                   = "IPV6"
)
View Source
const (
	SINGLETON_ID = "DOWNLOAD_LOCATION_ROUND_ROBIN_FILTER_VALUE"
)

Variables

Functions

func ApplicableActionTypeToString

func ApplicableActionTypeToString(actionType ApplicableActionType) string

func CreateFirmwareRuleOneDB

func CreateFirmwareRuleOneDB(fr *FirmwareRule) error

func CreateFirmwareRuleTemplateOneDB

func CreateFirmwareRuleTemplateOneDB(ft *FirmwareRuleTemplate) error

func DeleteOneFirmwareRule

func DeleteOneFirmwareRule(id string) error

func GetFirmwareRuleAllAsListByApplicationType

func GetFirmwareRuleAllAsListByApplicationType(applicationType string) (map[string][]*FirmwareRule, error)

func GetFirmwareRuleAllAsListByApplicationTypeForAS

func GetFirmwareRuleAllAsListByApplicationTypeForAS(applicationType string) (map[string][]*FirmwareRule, error)

func HasFirmwareVersion

func HasFirmwareVersion(firmwareVersions []string, version string) bool

func IsValidApplicableActionType

func IsValidApplicableActionType(t ApplicableActionType) bool

func NewBlockingFilterAction

func NewBlockingFilterAction() interface{}

func NewDefinePropertiesAction

func NewDefinePropertiesAction() interface{}

func NewDefinePropertiesTemplateAction

func NewDefinePropertiesTemplateAction() interface{}

func NewFirmwareRuleInf

func NewFirmwareRuleInf() interface{}

func NewFirmwareRuleTemplateInf

func NewFirmwareRuleTemplateInf() interface{}

func RemoveAllByRuleTypes

func RemoveAllByRuleTypes(rules map[string][]*FirmwareRule, ruleType string)

func SortConfigEntry

func SortConfigEntry(entries []*ConfigEntry)

func ValidateRuleName

func ValidateRuleName(id string, name string, applicationType string) error

Types

type ActivationVersion

type ActivationVersion struct {
	ID                 string   `json:"id"`
	ApplicationType    string   `json:"applicationType,omitempty"`
	Description        string   `json:"description,omitempty"`
	Model              string   `json:"model,omitempty"`
	PartnerId          string   `json:"partnerId,omitempty"`
	RegularExpressions []string `json:"regularExpressions"`
	FirmwareVersions   []string `json:"firmwareVersions"`
}

func NewActivationVersion

func NewActivationVersion() *ActivationVersion

NewActivationVersion constructor

func (*ActivationVersion) GetApplicationType

func (obj *ActivationVersion) GetApplicationType() string

getApplicationType implements queries.T.

func (*ActivationVersion) SetApplicationType

func (obj *ActivationVersion) SetApplicationType(appType string)

setApplicationType implements queries.T.

type ApplicableAction

type ApplicableAction struct {
	Type                       string               `json:"type"`
	ActionType                 ApplicableActionType `json:"actionType,omitempty"`
	ConfigId                   string               `json:"configId,omitempty"`
	ConfigEntries              []ConfigEntry        `json:"configEntries"` // RuleAction
	Active                     bool                 `json:"active"`
	UseAccountPercentage       bool                 `json:"useAccountPercentage"`
	FirmwareCheckRequired      bool                 `json:"firmwareCheckRequired"`
	RebootImmediately          bool                 `json:"rebootImmediately"`
	Whitelist                  string               `json:"whitelist,omitempty"`
	IntermediateVersion        string               `json:"intermediateVersion,omitempty"`
	FirmwareVersions           []string             `json:"firmwareVersions,omitempty"`
	Properties                 map[string]string    `json:"properties,omitempty"` // DefinePropertiesAction
	ByPassFilters              []string             `json:"byPassFilters,omitempty"`
	ActivationFirmwareVersions map[string][]string  `json:"activationFirmwareVersions,omitempty"`
}

FirmwareRule FirmwareRule4 table

func NewApplicableAction

func NewApplicableAction(typ string, configId string) *ApplicableAction

func NewApplicableActionAndType

func NewApplicableActionAndType(typ string, actionType ApplicableActionType, configId string) *ApplicableAction

func (*ApplicableAction) GetFirmwareVersionRegExs

func (d *ApplicableAction) GetFirmwareVersionRegExs() []string

func (*ApplicableAction) GetFirmwareVersions

func (d *ApplicableAction) GetFirmwareVersions() []string

func (ApplicableAction) IsValid

func (a ApplicableAction) IsValid() bool

func (ApplicableAction) String

func (a ApplicableAction) String() string

type ApplicableActionType

type ApplicableActionType string
const (
	RULE                       ApplicableActionType = "RULE"
	DEFINE_PROPERTIES          ApplicableActionType = "DEFINE_PROPERTIES"
	BLOCKING_FILTER            ApplicableActionType = "BLOCKING_FILTER"
	RULE_TEMPLATE              ApplicableActionType = "RULE_TEMPLATE"
	DEFINE_PROPERTIES_TEMPLATE ApplicableActionType = "DEFINE_PROPERTIES_TEMPLATE"
	BLOCKING_FILTER_TEMPLATE   ApplicableActionType = "BLOCKING_FILTER_TEMPLATE"
)

func (*ApplicableActionType) CaseIgnoreEquals

func (this *ApplicableActionType) CaseIgnoreEquals(that ApplicableActionType) bool

func (*ApplicableActionType) IsSuperSetOf

func (this *ApplicableActionType) IsSuperSetOf(that *ApplicableActionType) bool

type BlockingFilterAction

type BlockingFilterAction struct {
	ApplicableAction
}

BlockingFilterAction ...

type ConfigEntry

type ConfigEntry struct {
	ConfigId          string  `json:"configId"`
	Percentage        float64 `json:"percentage"`
	StartPercentRange float64 `json:"startPercentRange"`
	EndPercentRange   float64 `json:"endPercentRange"`
	IsPaused          bool    `json:"isPaused"`
	IsCanaryDisabled  bool    `json:"isCanaryDisabled"`
}

func NewConfigEntry

func NewConfigEntry(configId string, startPercentRange float64, endPercentRange float64) *ConfigEntry

func (*ConfigEntry) CompareTo

func (c *ConfigEntry) CompareTo(configEntry *ConfigEntry) int

func (*ConfigEntry) Equals

func (c *ConfigEntry) Equals(configEntry *ConfigEntry) bool

type DefinePropertiesAction

type DefinePropertiesAction struct {
	ApplicableAction
	Properties                 map[string]PropertyValue `json:"properties"`
	ByPassFilters              []string                 `json:"byPassFilters"`
	ActivationFirmwareVersions map[string][]string      `json:"activationFirmwareVersions"`
}

DefinePropertiesAction ...

type DefinePropertiesTemplateAction

type DefinePropertiesTemplateAction struct {
	ApplicableAction
	Properties                 map[string]PropertyValue `json:"properties"`
	ByPassFilters              []string                 `json:"byPassFilters"`
	ActivationFirmwareVersions map[string][]string      `json:"activationFirmwareVersions"`
}

DefinePropertiesTemplateAction ...

type FirmwareRule

type FirmwareRule struct {
	ID               string            `json:"id"`
	Updated          int64             `json:"updated"`
	Name             string            `json:"name"`
	ApplicableAction *ApplicableAction `json:"applicableAction"`
	Rule             re.Rule           `json:"rule"`
	Type             string            `json:"type"`
	Active           bool              `json:"active"`
	ApplicationType  string            `json:"applicationType,omitempty"`
}

FirmwareRule FirmwareRule4 table

func GetEnvModelFirmwareRules

func GetEnvModelFirmwareRules(applicationType string) ([]*FirmwareRule, error)

func GetEnvModelFirmwareRulesForAS

func GetEnvModelFirmwareRulesForAS(applicationType string) ([]*FirmwareRule, error)

func GetFirmwareRuleAllAsListDB

func GetFirmwareRuleAllAsListDB() ([]*FirmwareRule, error)

func GetFirmwareRuleAllAsListDBForAdmin

func GetFirmwareRuleAllAsListDBForAdmin() ([]*FirmwareRule, error)

func GetFirmwareRuleOneDB

func GetFirmwareRuleOneDB(id string) (*FirmwareRule, error)

func GetFirmwareRulesByApplicationType

func GetFirmwareRulesByApplicationType(applicationType string) ([]*FirmwareRule, error)

func GetFirmwareSortedRuleAllAsListDB

func GetFirmwareSortedRuleAllAsListDB() ([]*FirmwareRule, error)

GetFirmwareSortedRuleAllAsListDB returns all FirmwareRule sorted by Name

func GetRulesByRuleTypes

func GetRulesByRuleTypes(rules map[string][]*FirmwareRule, ruleType string) []*FirmwareRule

GetRulesByRuleTypes ...

func NewEmptyFirmwareRule

func NewEmptyFirmwareRule() *FirmwareRule

func NewFirmwareRule

func NewFirmwareRule(id string, name string, ruleType string, rule *re.Rule, action *ApplicableAction, active bool) *FirmwareRule

func (*FirmwareRule) Clone

func (obj *FirmwareRule) Clone() (*FirmwareRule, error)

func (*FirmwareRule) ConfigId

func (r *FirmwareRule) ConfigId() string

func (*FirmwareRule) Equals

func (r *FirmwareRule) Equals(f *FirmwareRule) bool

func (*FirmwareRule) GetApplicationType

func (obj *FirmwareRule) GetApplicationType() string

func (*FirmwareRule) GetId

func (r *FirmwareRule) GetId() string

GetId XRule interface

func (*FirmwareRule) GetName

func (r *FirmwareRule) GetName() string

GetName XRule interface

func (*FirmwareRule) GetRule

func (r *FirmwareRule) GetRule() *re.Rule

GetRule XRule interface

func (*FirmwareRule) GetRuleType

func (r *FirmwareRule) GetRuleType() string

GetRuleType XRule interface

func (*FirmwareRule) GetTemplateId

func (r *FirmwareRule) GetTemplateId() string

GetTemplateId XRule interface

func (*FirmwareRule) IsNoop

func (r *FirmwareRule) IsNoop() bool

IsNoop ...

func (*FirmwareRule) SetApplicationType

func (obj *FirmwareRule) SetApplicationType(appType string)

func (*FirmwareRule) String

func (r *FirmwareRule) String() string

func (*FirmwareRule) Validate

func (r *FirmwareRule) Validate() error

type FirmwareRuleTemplate

type FirmwareRuleTemplate struct {
	ID                   string                    `json:"id"`
	Updated              int64                     `json:"updated,omitempty"`
	Rule                 re.Rule                   `json:"rule"`
	ApplicableAction     *TemplateApplicableAction `json:"applicableAction"`
	Priority             int32                     `json:"priority"`
	RequiredFields       []string                  `json:"requiredFields,omitempty"`
	ByPassFilters        []string                  `json:"byPassFilters,omitempty"`
	ValidationExpression string                    `json:"validationExpression,omitempty"`
	Editable             bool                      `json:"editable"`
}

FirmwareRuleTemplate table

func GetFirmwareRuleTemplateAllAsListByActionType

func GetFirmwareRuleTemplateAllAsListByActionType(actionType ApplicableActionType) ([]*FirmwareRuleTemplate, error)

func GetFirmwareRuleTemplateAllAsListDB

func GetFirmwareRuleTemplateAllAsListDB(actionType ApplicableActionType) ([]*FirmwareRuleTemplate, error)

func GetFirmwareRuleTemplateAllAsListDBForAS

func GetFirmwareRuleTemplateAllAsListDBForAS(actionType ApplicableActionType) ([]*FirmwareRuleTemplate, error)

func GetFirmwareRuleTemplateOneDB

func GetFirmwareRuleTemplateOneDB(ruleType string) (*FirmwareRuleTemplate, error)

func GetFirmwareRuleTemplateOneDBWithId

func GetFirmwareRuleTemplateOneDBWithId(id string) (*FirmwareRuleTemplate, error)

func NewEmptyFirmwareRuleTemplate

func NewEmptyFirmwareRuleTemplate() *FirmwareRuleTemplate

func (*FirmwareRuleTemplate) Clone

func (*FirmwareRuleTemplate) GetID

func (r *FirmwareRuleTemplate) GetID() string

func (*FirmwareRuleTemplate) GetId

func (r *FirmwareRuleTemplate) GetId() string

GetId XRule interface

func (*FirmwareRuleTemplate) GetName

func (f *FirmwareRuleTemplate) GetName() string

GetName XRule interface

func (*FirmwareRuleTemplate) GetPriority

func (obj *FirmwareRuleTemplate) GetPriority() int

func (*FirmwareRuleTemplate) GetRule

func (r *FirmwareRuleTemplate) GetRule() *re.Rule

GetRule XRule interface

func (*FirmwareRuleTemplate) GetRuleType

func (f *FirmwareRuleTemplate) GetRuleType() string

GetRuleType XRule interface

func (*FirmwareRuleTemplate) GetTemplateId

func (f *FirmwareRuleTemplate) GetTemplateId() string

GetTemplateId XRule interface

func (*FirmwareRuleTemplate) SetPriority

func (obj *FirmwareRuleTemplate) SetPriority(priority int)

func (*FirmwareRuleTemplate) Validate

func (obj *FirmwareRuleTemplate) Validate() error

type PropertyValue

type PropertyValue struct {
	Value           string           `json:"value"`
	Optional        bool             `json:"optional"`
	ValidationTypes []ValidationType `json:"validationTypes"`
}

func NewPropertyValue

func NewPropertyValue(value string, optional bool, vtype ValidationType) *PropertyValue

type RuleAction

type RuleAction struct {
	ApplicableAction
	ConfigId              string        `json:"configId"`
	ConfigEntries         []ConfigEntry `json:"configEntries"`
	Active                bool          `json:"active"`
	UseAccountPercentage  bool          `json:"useAccountPercentage"`
	FirmwareCheckRequired bool          `json:"firmwareCheckRequired"`
	RebootImmediately     bool          `json:"rebootImmediately"`
	Whitelist             string        `json:"whitelist"`
	IntermediateVersion   string        `json:"intermediateVersion"`
	FirmwareVersions      []string      `json:"firmwareVersions"`
}

RuleAction ...

func NewRuleAction

func NewRuleAction() *RuleAction

type TemplateApplicableAction

type TemplateApplicableAction struct {
	Type                       string                   `json:"type"`
	ActionType                 ApplicableActionType     `json:"actionType"`
	ConfigId                   string                   `json:"configI,omitempty"`
	ConfigEntries              []ConfigEntry            `json:"configEntries,omitempty"` // RuleAction
	Active                     bool                     `json:"active"`
	UseAccountPercentage       bool                     `json:"useAccountPercentage"`
	FirmwareCheckRequired      bool                     `json:"firmwareCheckRequired"`
	RebootImmediately          bool                     `json:"rebootImmediately"`
	Whitelist                  string                   `json:"whitelist,omitempty"`
	IntermediateVersion        string                   `json:"intermediateVersion,omitempty"`
	FirmwareVersions           []string                 `json:"firmwareVersions,omitempty"`
	Properties                 map[string]PropertyValue `json:"properties,omitempty"` // DefinePropertiesAction
	ByPassFilters              []string                 `json:"byPassFilters,omitempty"`
	ActivationFirmwareVersions map[string][]string      `json:"activationFirmwareVersions,omitempty"`
}

func NewTemplateApplicableAction

func NewTemplateApplicableAction(typ string, configId string) *TemplateApplicableAction

func NewTemplateApplicableActionAndType

func NewTemplateApplicableActionAndType(typ string, actionType ApplicableActionType, configId string) *TemplateApplicableAction

type ValidationType

type ValidationType string

type Void

type Void struct{}

Jump to

Keyboard shortcuts

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