Documentation
¶
Index ¶
- Variables
- func ExtractConfigurationsFromAPIResponse(res []byte) []byte
- func ExtractConfigurationsFromBootstrapJson(bootstrapFileData []byte, collectionId, environmentId string) []byte
- func FormatConfig(data []byte, environmentId string) []byte
- func GetNormalizedValue(str string) int
- func IsValidDataType(category string) bool
- func SetCache(featureMap map[string]Feature, propertyMap map[string]Property, ...)
- type APIConfig
- type BootstrapConfig
- type Cache
- type Collection
- type Configurations
- type Environment
- type EnvironmentC
- 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 ¶
var ExtractConfigurationsFromPersistentCache = ExtractConfigurationsFromAPIResponse
AliasFunction : Only for readability purpose. The configurations stored in Persistent cache & configuration fetched from API both are in same format
Functions ¶
func ExtractConfigurationsFromAPIResponse ¶ added in v0.5.0
ExtractConfigurationsFromAPIResponse will 1. Parse the configuration into models.APIConfig struct 2. Extract all the Features, Properties & Segments into models.Configurations struct
func ExtractConfigurationsFromBootstrapJson ¶ added in v0.5.0
func ExtractConfigurationsFromBootstrapJson(bootstrapFileData []byte, collectionId, environmentId string) []byte
ExtractConfigurationsFromBootstrapJson will 1. Parse the bootstrap configuration into models.BootstrapConfig struct 2. Extract all the Features, Properties & Segments that are under environmentId and assigned to collectionId into models.Configurations struct 3. And Marshals the models.Configurations Currently, for any type of errors that will occur, this method will not return error instead returns a nil. In the future, we will consider returning the error.
func FormatConfig ¶ added in v0.5.0
FormatConfig : will reformat the configurations from type Configurations to type APIConfig
func GetNormalizedValue ¶ added in v0.5.0
func IsValidDataType ¶ added in v0.2.0
Types ¶
type APIConfig ¶ added in v0.5.0
type APIConfig struct { Environments []Environment `json:"environments"` Segments []Segment `json:"segments"` }
APIConfig : the format of configurations returned from the API: `GET /config?action=sdkConfig`
type BootstrapConfig ¶ added in v0.5.0
type BootstrapConfig struct { Environments []EnvironmentC `json:"environments"` Collections []Collection `json:"collections"` Segments []Segment `json:"segments"` }
BootstrapConfig : the format of bootstrap configurations.
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 Collection ¶
type Configurations ¶ added in v0.5.0
type Configurations struct { Features []Feature `json:"features"` Properties []Property `json:"properties"` Segments []Segment `json:"segments"` }
Configurations : all the configurations pulled out from bootstrapJson/persistentCache/GitConfig/APIResponse will be stored in this struct format.
type Environment ¶ added in v0.5.0
type EnvironmentC ¶ 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"` }
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"` }
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