common

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DATE_TIME_FORMATTER = "1/2/2006 15:04"
	LAST_CONFIG_LOG_ID  = "0"
)
View Source
const (
	ENTITY_STATUS_SUCCESS = "SUCCESS"
	ENTITY_STATUS_FAILURE = "FAILURE"
)
View Source
const (
	XCONF_HTTP_HEADER       = "HA-Haproxy-xconf-http"
	XCONF_HTTP_VALUE        = "xconf-http"
	X_FORWARDED_FOR_HEADER  = "X-Forwarded-For"
	HA_FORWARDED_FOR_HEADER = "HA-Forwarded-For"
)
View Source
const (
	HOST_MAC_PARAM = "hostMac"
	ECM_MAC_PARAM  = "ecmMac"
	FORCE_PARAM    = "force"
)
View Source
const (
	READ_COMMON         string = "read-common"
	WRITE_COMMON        string = "write-common"
	READ_FIRMWARE_ALL   string = "read-firmware-*"
	WRITE_FIRMWARE_ALL  string = "write-firmware-*"
	WRITE_DCM_ALL       string = "write-dcm-*"
	READ_DCM_ALL        string = "read-dcm-*"
	READ_TELEMETRY_ALL  string = "read-telemetry-*"
	WRITE_TELEMETRY_ALL string = "write-telemetry-*"
	WRITE_CHANGES_ALL   string = "write-changes-*"
	READ_CHANGES_ALL    string = "read-changes-*"
)
View Source
const (
	ID                     = "id"
	IP_ADDRESS             = "ipAddress"
	ESTB_IP                = "estbIP"
	ESTB_MAC_ADDRESS       = "estbMacAddress"
	STB_ESTB_MAC           = "eStbMac"
	ECM_MAC_ADDRESS        = "ecmMacAddress"
	STB_ECM_MAC            = "eCMMac"
	ENV                    = "env"
	MODEL                  = "model"
	MODEL_ID               = "modelId"
	ACCOUNT_MGMT           = "accountMgmt"
	SERIAL_NUM             = "serialNum"
	PARTNER_ID             = "partnerId"
	PASSED_PARTNER_ID      = "passedPartnerId"
	FIRMWARE_VERSION       = "firmwareVersion"
	RECEIVER_ID            = "receiverId"
	CONTROLLER_ID          = "controllerId"
	CHANNEL_MAP_ID         = "channelMapId"
	VOD_ID                 = "vodId"
	BYPASS_FILTERS         = "bypassFilters"
	FORCE_FILTERS          = "forceFilters"
	UPLOAD_IMMEDIATELY     = "uploadImmediately"
	TIME_ZONE              = "timezone"
	TIME_ZONE_OFFSET       = "timeZoneOffset"
	SCHEDULE_TIME_ZONE     = "scheduleTimezone"
	TIME                   = "time"
	ACCOUNT_ID             = "accountId"
	ACCOUNT_HASH           = "accountHash"
	CONFIG_SET_HASH        = "configSetHash"
	SYNDICATION_PARTNER    = "SyndicationPartner"
	MAC                    = "mac"
	CHECK_NOW              = "checkNow"
	VERSION                = "version"
	SETTING_TYPE           = "settingType"
	TABLE_NAME             = "tableName"
	ROW_KEY                = "rowKey"
	FIELD                  = "field"
	NAME                   = "name"
	LIST_ID                = "listId"
	RULE_NAME              = "ruleName"
	MAC_ADDRESS            = "macAddress"
	IP_ADDRESS_GROUP_NAME  = "ipAddressGroupName"
	FEATURE_INSTANCE       = "FEATURE_INSTANCE"
	FREE_ARG               = "FREE_ARG"
	FIXED_ARG              = "FIXED_ARG"
	NAME_UPPER             = "NAME"
	EXPORT                 = "export"
	EXPORTALL              = "exportAll"
	TYPE                   = "type"
	TYPE_UPPER             = "TYPE"
	DATA_UPPER             = "DATA"
	EDITABLE               = "isEditable"
	OVERWRITE              = "overwrite"
	NEW_PRIORITY           = "newPriority"
	APPLICABLE_ACTION_TYPE = "APPLICABLE_ACTION_TYPE"
	TEMPLATE_ID            = "templateId"
	CHANGE_ID              = "changeId"
	APPROVE_ID             = "approveId"
	PAGE_NUMBER            = "pageNumber"
	PAGE_SIZE              = "pageSize"
	DESCRIPTION            = "description"
	ENTITY                 = "ENTITY"
	AUTHOR                 = "AUTHOR"
	PROFILE                = "PROFILE"
	PROFILE_NAME           = "profilename"
	FULL                   = "full"
)

TODO: group constants by their usage, for now everithing is in one list: search related, rule evaluation, pagination, etc

View Source
const (
	TR181_DEVICE_TYPE_PARTNER_ID   = "tr181.Device.DeviceInfo.X_RDKCENTRAL-COM_Syndication.PartnerId"
	TR181_DEVICE_TYPE_ACCOUNT_ID   = "tr181.Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.AccountInfo.AccountID"
	TR181_DEVICE_TYPE_ACCOUNT_HASH = "tr181.Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.MD5AccountHash"
)
View Source
const (
	GenericNamespacedListTypes_STRING      = "STRING"
	GenericNamespacedListTypes_MAC_LIST    = "MAC_LIST"
	GenericNamespacedListTypes_IP_LIST     = "IP_LIST"
	GenericNamespacedListTypes_RI_MAC_LIST = "RI_MAC_LIST"
)
View Source
const (
	DefaultTimeDateFormatLayout   = "2006-01-02 15:04"
	DefaultDateFormatLayout       = "2006-01-02"
	DefaultTimeFormatLayout       = "15:04"
	DefaultLockdownStartTime      = "19:00" //EST Timezone
	DefaultLockdownEndTime        = "07:00" //EST Timezone
	DefaultLockdownTimezone       = "America/New_York"
	DefaultCanaryTimezone         = "America/New_York"
	DefaultLockdownModules        = "ALL"
	DefaultLockDuration           = 1800
	DefaultPrecookLockdownEnabled = false
)
View Source
const (
	PROP_LOCKDOWN_ENABLED               = "LockdownEnabled"
	PROP_LOCKDOWN_MODULES               = "LockdownModules"
	PROP_CANARY_MAXSIZE                 = "CanaryMaxSize"
	PROP_CANARY_DISTRIBUTION_PERCENTAGE = "CanaryDistributionPercentage"
	PROP_CANARY_FW_UPGRADE_STARTTIME    = "CanaryFwUpgradeStartTime"
	PROP_CANARY_FW_UPGRADE_ENDTIME      = "CanaryFwUpgradeEndTime"
	PROP_READONLY_PERMISSION            = "ReadOnlyPermission"
	PROP_LOCKDOWN_STARTTIME             = "LockdownStartTime"
	PROP_LOCKDOWN_ENDTIME               = "LockdownEndTime"
	PROP_PRECOOK_LOCKDOWN_ENABLED       = "PrecookLockdownEnabled"
	PROP_CANARY_TIMEZONE_LIST           = "CanaryTimezoneList"
)
View Source
const (
	Member     = "member"
	Tag        = "tag"
	StartRange = "startRange"
	EndRange   = "endRange"
)
View Source
const (
	READONLY_MODE           = "ReadonlyMode"
	READONLY_MODE_STARTTIME = "ReadonlyModeStartTime"
	READONLY_MODE_ENDTIME   = "ReadonlyModeEndTime"
)
View Source
const (
	HeaderAuthorization        = "Authorization"
	HeaderUserAgent            = "User-Agent"
	HeaderIfNoneMatch          = "If-None-Match"
	HeaderFirmwareVersion      = "X-System-Firmware-Version"
	HeaderSupportedDocs        = "X-System-Supported-Docs"
	HeaderSupplementaryService = "X-System-SupplementaryService-Sync"
	HeaderModelName            = "X-System-Model-Name"
	HeaderProfileVersion       = "X-System-Telemetry-Profile-Version"
	HeaderPartnerID            = "X-System-PartnerID"
	HeaderAccountID            = "X-System-AccountID"
	HeaderXconfDataService     = "XconfDataService"
	HeaderXconfAdminService    = "XconfAdminService"
)
View Source
const (
	ExportFileNames_ALL                             = "all"
	ExportFileNames_FIRMWARE_CONFIG                 = "firmwareConfig_"
	ExportFileNames_ALL_FIRMWARE_CONFIGS            = "allFirmwareConfigs"
	ExportFileNames_FIRMWARE_RULE                   = "firmwareRule_"
	ExportFileNames_ALL_FIRMWARE_RULES              = "allFirmwareRules"
	ExportFileNames_FIRMWARE_RULE_TEMPLATE          = "firmwareRuleTemplate_"
	ExportFileNames_ALL_FIRMWARE_RULE_TEMPLATES     = "allFirmwareRuleTemplates"
	ExportFileNames_ALL_PERMANENT_PROFILES          = "allPermanentProfiles"
	ExportFileNames_PERMANENT_PROFILE               = "permanentProfile_"
	ExportFileNames_ALL_TELEMETRY_RULES             = "allTelemetryRules"
	ExportFileNames_ALL_TELEMETRY_TWO_RULES         = "allTelemetryTwoRules"
	ExportFileNames_TELEMETRY_RULE                  = "telemetryRule_"
	ExportFileNames_TELEMETRY_TWO_RULE              = "telemetryTwoRule_"
	ExportFileNames_TELEMETRY_TWO_PROFILE           = "telemetryTwoProfile_"
	ExportFileNames_ALL_TELEMETRY_TWO_PROFILES      = "allTelemetryTwoProfiles"
	ExportFileNames_ALL_SETTING_PROFILES            = "allSettingProfiles"
	ExportFileNames_SETTING_PROFILE                 = "settingProfile_"
	ExportFileNames_ALL_SETTING_RULES               = "allSettingRules"
	ExportFileNames_SETTING_RULE                    = "settingRule_"
	ExportFileNames_ALL_FORMULAS                    = "allFormulas"
	ExportFileNames_FORMULA                         = "formula_"
	ExportFileNames_ALL_ENVIRONMENTS                = "allEnvironments"
	ExportFileNames_ENVIRONMENT                     = "environment_"
	ExportFileNames_ALL_MODELS                      = "allModels"
	ExportFileNames_MODEL                           = "model_"
	ExportFileNames_UPLOAD_REPOSITORY               = "uploadRepository_"
	ExportFileNames_ALL_UPLOAD_REPOSITORIES         = "allUploadRepositories"
	ExportFileNames_ROUND_ROBIN_FILTER              = "roundRobinFilter"
	ExportFileNames_GLOBAL_PERCENT                  = "globalPercent"
	ExportFileNames_GLOBAL_PERCENT_AS_RULE          = "globalPercentAsRule"
	ExportFileNames_ENV_MODEL_PERCENTAGE_BEANS      = "envModelPercentageBeans"
	ExportFileNames_ENV_MODEL_PERCENTAGE_BEAN       = "envModelPercentageBean_"
	ExportFileNames_ENV_MODEL_PERCENTAGE_AS_RULES   = "envModelPercentageAsRules"
	ExportFileNames_ENV_MODEL_PERCENTAGE_AS_RULE    = "envModelPercentageAsRule_"
	ExportFileNames_PERCENT_FILTER                  = "percentFilter"
	ExportFileNames_ALL_NAMESPACEDLISTS             = "allNamespacedLists"
	ExportFileNames_NAMESPACEDLIST                  = "namespacedList_"
	ExportFileNames_ALL_FEATURES                    = "allFeatures"
	ExportFileNames_FEATURE                         = "feature_"
	ExportFileNames_ALL_FEATURE_SETS                = "allFeatureSets"
	ExportFileNames_FEATURE_SET                     = "featureSet_"
	ExportFileNames_ALL_FEATURE_RUlES               = "allFeatureRules"
	ExportFileNames_FEATURE_RULE                    = "featureRule_"
	ExportFileNames_ACTIVATION_MINIMUM_VERSION      = "activationMinimumVersion_"
	ExportFileNames_ALL_ACTIVATION_MINIMUM_VERSIONS = "allActivationMinimumVersions"
	ExportFileNames_ALL_DEVICE_SETTINGS             = "allDeviceSettings"
	ExportFileNames_ALL_VOD_SETTINGS                = "allVodSettings"
	ExportFileNames_ALL_LOGREPO_SETTINGS            = "allLogRepoSettings"
)
View Source
const (
	DEFAULT_AUTH_PROVIDER = "acl"
)
View Source
const (
	TABLE_APP_SETTINGS = "AppSettings"
)

db

Variables

View Source
var (
	BinaryVersion   = ""
	BinaryBranch    = ""
	BinaryBuildTime = ""

	DefaultIgnoredHeaders = []string{
		"Accept",
		"User-Agent",
		"Authorization",
		"Content-Type",
		"Content-Length",
		"Accept-Encoding",
		"X-B3-Sampled",
		"X-B3-Spanid",
		"X-B3-Traceid",
		"X-Envoy-Decorator-Operation",
		"X-Envoy-External-Address",
		"X-Envoy-Peer-Metadata",
		"X-Envoy-Peer-Metadata-Id",
		"X-Forwarded-Proto",
		"Token",
		"Cookie",
		"Set-Cookie",
	}
)
View Source
var (
	NotOK             = fmt.Errorf("!ok")
	NotFound          = fmt.Errorf("Not found")
	NotFirmwareConfig = fmt.Errorf("Not FirmwareCofig")
	NotFirmwareRule   = fmt.Errorf("Not FirmwareRule")
)
View Source
var ActiveAuthProfiles string
View Source
var AllowedNumberOfFeatures int
View Source
var ApplicationTypes []string
View Source
var AuthProvider string
View Source
var CacheUpdateWindowSize int64
View Source
var CanaryCreationEnabled bool
View Source
var CanaryDefaultPartner string
View Source
var CanaryDistributionPercentage float64
View Source
var CanaryEndTime string
View Source
var CanaryFwUpgradeEndTime int
View Source
var CanaryFwUpgradeStartTime int
View Source
var CanaryPercentFilterNameSet = util.Set{}
View Source
var CanarySize int
View Source
var CanaryStartTime string
View Source
var CanarySyndicatePartnerSet = util.Set{}
View Source
var CanaryTimeFormat string
View Source
var CanaryTimezone *time.Location
View Source
var CanaryTimezoneList []string
View Source
var CanaryVideoModelSet = util.Set{}
View Source
var CanaryWakeupPercentFilterNameSet = util.Set{}
View Source
var DefaultAuthProfiles string
View Source
var IpMacIsConditionLimit int
View Source
var LockDuration int32
View Source
var SatOn bool
View Source
var (
	SupportedPokeDocs = []string{"primary", "telemetry"}
)
View Source
var VideoCanaryCreationEnabled bool
View Source
var WakeupPoolTagName string
View Source
var XconfErrorType = &XconfError{}

Functions

func DeleteOneEnvironment

func DeleteOneEnvironment(id string) error

func DeleteOneModel

func DeleteOneModel(id string) error

func GetAllEnvironmentList

func GetAllEnvironmentList() []*shared.Environment

func GetAllModelList

func GetAllModelList() []*shared.Model

func GetAppSettings

func GetAppSettings() (map[string]interface{}, error)

func GetBooleanAppSetting

func GetBooleanAppSetting(key string, vargs ...bool) bool

func GetFloat64AppSetting

func GetFloat64AppSetting(key string, vargs ...float64) float64

func GetIntAppSetting

func GetIntAppSetting(key string, vargs ...int) int

func GetOneEnvironment

func GetOneEnvironment(id string) *shared.Environment

func GetOneModel

func GetOneModel(id string) *shared.Model

func GetStringAppSetting

func GetStringAppSetting(key string, vargs ...string) string

func GetTimeAppSetting

func GetTimeAppSetting(key string, vargs ...time.Time) time.Time

func GetXconfErrorStatusCode

func GetXconfErrorStatusCode(err error) int

func IsExistModel

func IsExistModel(id string) bool

func IsValidAppSetting

func IsValidAppSetting(key string) bool

func NewDCMGenericRuleInf

func NewDCMGenericRuleInf() interface{}

func NewError

func NewError(err error) error

func NewXconfError

func NewXconfError(status int, message string) error

func ServerOriginId

func ServerOriginId() string

func SetAppSetting

func SetAppSetting(key string, value interface{}) (*shared.AppSetting, error)

func SetOneEnvironment

func SetOneEnvironment(env *shared.Environment) (*shared.Environment, error)

func SetOneModel

func SetOneModel(model *core.Model) (*core.Model, error)

func UnwrapAll

func UnwrapAll(wrappedErr error) error

Types

type ApplicationTypeAware

type ApplicationTypeAware interface {
	GetApplicationType() string
	SetApplicationType(appType string)
}

type CanarySettings

type CanarySettings struct {
	CanaryDistributionPercentage *float64 `json:"distributionPercentage,omitempty"`
	CanaryMaxSize                *int     `json:"maxSize,omitempty"`
	CanaryFwUpgradeStartTime     *int     `json:"firmwareUpgradeStartTime,omitempty"`
	CanaryFwUpgradeEndTime       *int     `json:"firmwareUpgradeEndTime,omitempty"`
}

CanarySettings settings for canary deployment

func (*CanarySettings) Validate

func (obj *CanarySettings) Validate() error

type DCMFormula

type DCMFormula struct {
	Formula DCMGenericRule `json:"formula"`
}

type DCMGenericRule

type DCMGenericRule struct {
	re.Rule
	ID              string      `json:"id"`
	Updated         int64       `json:"updated"`
	Name            string      `json:"name,omitempty"`
	Description     string      `json:"description,omitempty"`
	Priority        int         `json:"priority,omitempty"`
	RuleExpression  string      `json:"ruleExpression,omitempty"`
	Percentage      int         `json:"percentage,omitempty"`
	PercentageL1    json.Number `json:"percentageL1,omitempty"`
	PercentageL2    json.Number `json:"percentageL2,omitempty"`
	PercentageL3    json.Number `json:"percentageL3,omitempty"`
	ApplicationType string      `json:"applicationType"`
}

DcmRule DcmRule table

func GetDCMGenericRuleList

func GetDCMGenericRuleList() []*DCMGenericRule

func GetOneDCMGenericRule

func GetOneDCMGenericRule(id string) *DCMGenericRule

func (*DCMGenericRule) Clone

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

func (*DCMGenericRule) GetID

func (obj *DCMGenericRule) GetID() string

func (*DCMGenericRule) GetId

func (r *DCMGenericRule) GetId() string

GetId XRule interface

func (*DCMGenericRule) GetName

func (r *DCMGenericRule) GetName() string

GetName XRule interface

func (*DCMGenericRule) GetPriority

func (obj *DCMGenericRule) GetPriority() int

func (*DCMGenericRule) GetRule

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

GetRule XRule interface

func (*DCMGenericRule) GetRuleType

func (r *DCMGenericRule) GetRuleType() string

GetRuleType XRule interface

func (*DCMGenericRule) GetTemplateId

func (r *DCMGenericRule) GetTemplateId() string

GetTemplateId XRule interface

func (*DCMGenericRule) SetPriority

func (obj *DCMGenericRule) SetPriority(priority int)

func (*DCMGenericRule) ToStringOnlyBaseProperties

func (dcm *DCMGenericRule) ToStringOnlyBaseProperties() string

type EntityMessage

type EntityMessage struct {
	Status  string `json:"status"`
	Message string `json:"message"`
}

type GenericNamespacedList

type GenericNamespacedList struct {
	ID       string          `json:"id"`
	TypeName string          `json:"typeName"`
	Data     map[string]bool `json:"data"`
}

type HttpAdminErrorResponse

type HttpAdminErrorResponse struct {
	Status  int    `json:"status"`
	Type    string `json:"type,omitempty"`
	Message string `json:"message"`
}

http error response to match xconf java admin

type HttpErrorResponse

type HttpErrorResponse struct {
	Status    int         `json:"status"`
	ErrorCode int         `json:"error_code,omitempty"`
	Message   string      `json:"message,omitempty"`
	Errors    interface{} `json:"errors,omitempty"`
}

http error response

type HttpResponse

type HttpResponse struct {
	Status  int         `json:"status"`
	Message string      `json:"message,omitempty"`
	Data    interface{} `json:"data,omitempty"`
}

http ok response

type InfoVersion

type InfoVersion struct {
	ProjectName    string `json:"projectName"`
	ProjectVersion string `json:"projectVersion"`
	ServiceName    string `json:"serviceName"`
	ServiceVersion string `json:"serviceVersion"`
	Source         string `json:"source"`
	Rev            string `json:"rev"`
	GitBranch      string `json:"gitBranch"`
	GitBuildTime   string `json:"gitBuildTime"`
	GitCommitId    string `json:"gitCommitId"`
	GitCommitTime  string `json:"gitCommitTime"`
}

type LockdownSettings

type LockdownSettings struct {
	LockdownEnabled   *bool   `json:"lockdownEnabled,omitempty"`
	LockdownStartTime *string `json:"lockdownStartTime,omitempty"`
	LockdownEndTime   *string `json:"lockdownEndTime,omitempty"`
	LockdownModules   *string `json:"lockdownModules,omitempty"`
}

func (*LockdownSettings) Validate

func (obj *LockdownSettings) Validate() error

type MacIpRuleConfig

type MacIpRuleConfig struct {
	IpMacIsConditionLimit int `json:"ipMacIsConditionLimit"`
}

type RecookingLockdownSettings

type RecookingLockdownSettings struct {
	LockdownStartTime *string   `json:"lockdownStartTime,omitempty"`
	Models            *[]string `json:"models,omitempty"`
	Partners          *[]string `json:"partners,omitempty"`
}

recooking_lockdown_settings struct

type ResponseEntity

type ResponseEntity struct {
	Status int
	Error  error
	Data   interface{}
}

func NewResponseEntity

func NewResponseEntity(err error, data interface{}) *ResponseEntity

func NewResponseEntityWithStatus

func NewResponseEntityWithStatus(status int, err error, data interface{}) *ResponseEntity

TODO drop this function when we're done converting from NewResponseEntityWithStatus to NewResponseEntity

type ServerConfig

type ServerConfig struct {
	*configuration.Config
	// contains filtered or unexported fields
}

func NewServerConfig

func NewServerConfig(configFile string) (*ServerConfig, error)

func (*ServerConfig) ConfigBytes

func (c *ServerConfig) ConfigBytes() []byte

type Version

type Version struct {
	CodeGitCommit   string `json:"code_git_commit"`
	BuildTime       string `json:"build_time"`
	BinaryVersion   string `json:"binary_version"`
	BinaryBranch    string `json:"binary_branch"`
	BinaryBuildTime string `json:"binary_build_time"`
}

type XconfError

type XconfError struct {
	StatusCode int
	Message    string
}

func (XconfError) Error

func (e XconfError) Error() string

Jump to

Keyboard shortcuts

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