Documentation
¶
Index ¶
- func ExtractConfigurations(data []byte, environmentId, collectionId string) ([]byte, error)
- func FormatConfig(data []byte, environmentId, collectionId string) []byte
- func GetNormalizedValue(str string) int
- func IsValidDataType(category string) bool
- func SetCache(featureMap map[string]Feature, propertyMap map[string]Property, ...)
- type Cache
- type CacheConfig
- type Collection
- type Config
- type Environment
- type Feature
- func (f *Feature) GetCurrentValue(entityID string, entityAttributes ...map[string]interface{}) interface{}
- func (f *Feature) GetDisabledValue() interface{}
- func (f *Feature) GetEnabledValue() interface{}
- func (f *Feature) GetFeatureDataFormat() string
- func (f *Feature) GetFeatureDataType() string
- func (f *Feature) GetFeatureID() string
- func (f *Feature) GetFeatureName() string
- func (f *Feature) GetRolloutPercentage() int
- func (f *Feature) GetSegmentRules() []SegmentRule
- func (f *Feature) IsEnabled() bool
- type FeatureC
- type Property
- func (p *Property) GetCurrentValue(entityID string, entityAttributes ...map[string]interface{}) interface{}
- func (p *Property) GetPropertyDataFormat() string
- func (p *Property) GetPropertyDataType() string
- func (p *Property) GetPropertyID() string
- func (p *Property) GetPropertyName() string
- func (p *Property) GetSegmentRules() []SegmentRule
- func (p *Property) GetValue() interface{}
- type PropertyC
- type Rule
- type RuleElem
- type SecretProperty
- type Segment
- type SegmentRule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractConfigurations ¶ added in v0.5.8
ExtractConfigurations will 1. Parse the configuration into models.Config struct 2. Extract all the Features, Properties & Segments that are under environmentId and assigned to collectionId 3. If collections array is not present - feature/property is still considered as part of the config. 4. And Marshals the extracted data into models.CacheConfig
func FormatConfig ¶ added in v0.5.0
FormatConfig : will reformat the configurations from type CacheConfig to type Config
func GetNormalizedValue ¶ added in v0.5.0
func IsValidDataType ¶ added in v0.2.0
Types ¶
type Cache ¶
type Cache struct { FeatureMap map[string]Feature PropertyMap map[string]Property SegmentMap map[string]Segment SecretManagerMap map[string]interface{} }
Cache : Cache struct
var CacheInstance *Cache
CacheInstance : Cache Instance
type CacheConfig ¶ added in v0.5.8
type CacheConfig struct { Features []FeatureC `json:"features"` Properties []PropertyC `json:"properties"` Segments []Segment `json:"segments"` }
CacheConfig : all the configurations pulled out from bootstrapJson/persistentCache/GitConfig/APIResponse will be stored in this struct format.
type Collection ¶
type Config ¶ added in v0.5.8
type Config struct { Environments []Environment `json:"environments"` Collections []Collection `json:"collections"` Segments []Segment `json:"segments"` }
Config : the format of all configurations.
type Environment ¶ added in v0.5.0
type Feature ¶
type Feature struct { Name string `json:"name"` FeatureID string `json:"feature_id"` DataType string `json:"type"` Format string `json:"format"` EnabledValue interface{} `json:"enabled_value"` DisabledValue interface{} `json:"disabled_value"` SegmentRules []SegmentRule `json:"segment_rules"` Enabled bool `json:"enabled"` RolloutPercentage *int `json:"rollout_percentage"` }
Feature : Feature struct
func (*Feature) GetCurrentValue ¶
func (f *Feature) GetCurrentValue(entityID string, entityAttributes ...map[string]interface{}) interface{}
GetCurrentValue returns one of the Enabled/Disabled/Overridden value based on the evaluation.
The function takes in entityId & entityAttributes parameters.
entityId is a string identifier related to the Entity against which the feature will be evaluated. For example, an entity might be an instance of an app that runs on a mobile device, a microservice that runs on the cloud, or a component of infrastructure that runs that microservice. For any entity to interact with App Configuration, it must provide a unique entity ID.
entityAttributes is a map of type `map[string]interface{}` consisting of the attribute name and their values that defines the specified entity. This is an optional parameter if the feature flag is not configured with any targeting definition. If the targeting is configured, then entityAttributes should be provided for the rule evaluation. An attribute is a parameter that is used to define a segment. The SDK uses the attribute values to determine if the specified entity satisfies the targeting rules, and returns the appropriate feature flag value.
func (*Feature) GetDisabledValue ¶
func (f *Feature) GetDisabledValue() interface{}
GetDisabledValue : Get Disabled Value
func (*Feature) GetEnabledValue ¶
func (f *Feature) GetEnabledValue() interface{}
GetEnabledValue : Get Enabled Value
func (*Feature) GetFeatureDataFormat ¶ added in v0.2.0
GetFeatureDataFormat : Get Feature Data Format
func (*Feature) GetFeatureDataType ¶
GetFeatureDataType : Get Feature Data Type
func (*Feature) GetFeatureID ¶ added in v0.1.1
GetFeatureID : Get Feature ID
func (*Feature) GetFeatureName ¶
GetFeatureName : Get Feature Name
func (*Feature) GetRolloutPercentage ¶ added in v0.3.0
GetRolloutPercentage : Get the Feature flag rollout percentage
func (*Feature) GetSegmentRules ¶
func (f *Feature) GetSegmentRules() []SegmentRule
GetSegmentRules : Get Segment Rules
type FeatureC ¶ added in v0.5.0
type FeatureC struct { Feature Collections []Collection `json:"collections,omitempty"` }
type Property ¶
type Property struct { Name string `json:"name"` PropertyID string `json:"property_id"` DataType string `json:"type"` Format string `json:"format"` Value interface{} `json:"value"` SegmentRules []SegmentRule `json:"segment_rules"` }
Property : Property struct
func (*Property) GetCurrentValue ¶
func (p *Property) GetCurrentValue(entityID string, entityAttributes ...map[string]interface{}) interface{}
GetCurrentValue returns the default property value or its overridden value based on the evaluation.
The function takes in entityId & entityAttributes parameters.
entityId is a string identifier related to the Entity against which the property will be evaluated. For example, an entity might be an instance of an app that runs on a mobile device, a microservice that runs on the cloud, or a component of infrastructure that runs that microservice. For any entity to interact with App Configuration, it must provide a unique entity ID.
entityAttributes is a map of type `map[string]interface{}` consisting of the attribute name and their values that defines the specified entity. This is an optional parameter if the property is not configured with any targeting definition. If the targeting is configured, then entityAttributes should be provided for the rule evaluation. An attribute is a parameter that is used to define a segment. The SDK uses the attribute values to determine if the specified entity satisfies the targeting rules, and returns the appropriate property value.
func (*Property) GetPropertyDataFormat ¶ added in v0.2.0
GetPropertyDataFormat : Get Property Data Format
func (*Property) GetPropertyDataType ¶
GetPropertyDataType : Get Property Data Type
func (*Property) GetPropertyID ¶ added in v0.1.1
GetPropertyID : Get Property Id
func (*Property) GetPropertyName ¶
GetPropertyName : Get Property Name
func (*Property) GetSegmentRules ¶
func (p *Property) GetSegmentRules() []SegmentRule
GetSegmentRules : Get Segment Rules
type PropertyC ¶ added in v0.5.0
type PropertyC struct { Property Collections []Collection `json:"collections,omitempty"` }
type Rule ¶
type Rule struct { Values []interface{} `json:"values"` Operator string `json:"operator"` AttributeName string `json:"attribute_name"` }
Rule : Rule struct
func (*Rule) EvaluateRule ¶
EvaluateRule : Evaluate Rule
func (*Rule) GetAttributeName ¶
GetAttributeName : Get Attribute Name
type RuleElem ¶
type RuleElem struct {
Segments []string `json:"segments"`
}
RuleElem : RuleElem struct
type SecretProperty ¶ added in v0.3.1
type SecretProperty struct {
PropertyID string
}
SecretProperty : SecretProperty struct
func (*SecretProperty) GetCurrentValue ¶ added in v0.3.1
func (sp *SecretProperty) GetCurrentValue(entityID string, entityAttributes ...map[string]interface{}) (result sm.SecretIntf, response *core.DetailedResponse, err error)
GetCurrentValue returns the actual secret value(default or overridden) based on the evaluation.
The function takes in entityId & entityAttributes parameters.
entityId is a string identifier related to the Entity against which the property will be evaluated. For example, an entity might be an instance of an app that runs on a mobile device, a microservice that runs on the cloud, or a component of infrastructure that runs that microservice. For any entity to interact with App Configuration, it must provide a unique entity ID.
entityAttributes is a map of type `map[string]interface{}` consisting of the attribute name and their values that defines the specified entity. This is an optional parameter if the property is not configured with any targeting definition. If the targeting is configured, then entityAttributes should be provided for the rule evaluation.
type Segment ¶
type Segment struct { Name string `json:"name"` SegmentID string `json:"segment_id"` Rules []Rule `json:"rules"` }
Segment : Segment struct
func (*Segment) EvaluateRule ¶
EvaluateRule : Evaluate Rule
func (*Segment) GetSegmentID ¶ added in v0.1.1
GetSegmentID : Get SegmentID
type SegmentRule ¶
type SegmentRule struct { Rules []RuleElem `json:"rules"` Value interface{} `json:"value"` Order int `json:"order"` RolloutPercentage *interface{} `json:"rollout_percentage"` }
SegmentRule : SegmentRule struct
func (*SegmentRule) GetRolloutPercentage ¶ added in v0.3.0
func (sr *SegmentRule) GetRolloutPercentage() interface{}
GetRolloutPercentage : Get the rollout percentage of the segment rule