C++ Server-Side SDK
LaunchDarkly SDK
|
#include <attributes_builder.hpp>
Public Member Functions | |
AttributesBuilder (BuilderReturn &builder, std::string kind, std::string key) | |
AttributesBuilder (BuilderReturn &builder, std::string kind, Attributes const &attributes) | |
AttributesBuilder (AttributesBuilder const &builder)=delete | |
AttributesBuilder & | operator= (AttributesBuilder const &)=delete |
AttributesBuilder & | operator= (AttributesBuilder &&)=delete |
AttributesBuilder (AttributesBuilder &&builder)=default | |
AttributesBuilder & | Name (std::string name) |
AttributesBuilder & | Anonymous (bool anonymous) |
AttributesBuilder & | Set (std::string name, launchdarkly::Value value) |
AttributesBuilder & | SetPrivate (std::string name, launchdarkly::Value value) |
AttributesBuilder & | AddPrivateAttribute (AttributeReference ref) |
template<typename IterType > | |
AttributesBuilder & | AddPrivateAttributes (IterType attributes) |
AttributesBuilder & | Kind (std::string kind, std::string key) |
AttributesBuilder * | Kind (std::string const &kind) |
BuildType | Build () const |
AttributesBuilder< ContextBuilder, Context > & | Name (std::string name) |
AttributesBuilder< ContextBuilder, Context > & | Anonymous (bool anonymous) |
AttributesBuilder< ContextBuilder, Context > & | Set (std::string name, Value value, bool private_attribute) |
AttributesBuilder< ContextBuilder, Context > & | Set (std::string name, Value value) |
AttributesBuilder< ContextBuilder, Context > & | SetPrivate (std::string name, Value value) |
AttributesBuilder< ContextBuilder, Context > & | AddPrivateAttribute (AttributeReference ref) |
Friends | |
class | ContextBuilder |
This is used in the implementation of the context builder for setting attributes for a single context. This is not intended to be directly used by an SDK consumer.
BuilderReturn | The type of builder using the AttributesBuilder. |
BuildType | The type of object being built. |
|
inline |
Create an attributes builder with the given kind and key.
builder | The context builder associated with this attributes builder. |
kind | The kind being added. |
key | The key for the kind. |
|
inline |
Crate an attributes builder with the specified kind, and pre-populated with the given attributes.
builder | The context builder associated with this attributes builder. |
kind | The kind being added. |
attributes | Attributes to populate the builder with. |
|
delete |
The attributes builder should never be copied. We depend on a stable reference stored in the context builder.
AttributesBuilder& launchdarkly::AttributesBuilder< BuilderReturn, BuildType >::AddPrivateAttribute | ( | AttributeReference | ref | ) |
Designate a context attribute, or properties within them, as private: that is, their values will not be sent to LaunchDarkly in analytics events.
Each parameter can be a simple attribute name, such as "email". Or, if the first character is a slash, the parameter is interpreted as a slash-delimited path to a property within a JSON object, where the first path component is a Context attribute name and each following component is a nested property name: for example, suppose the attribute "address" had the following JSON object value:
Using ["/address/street/line1"] in this case would cause the "line1" property to be marked as private. This syntax deliberately resembles JSON Pointer, but other JSON Pointer features such as array indexing are not supported for Private.
This action only affects analytics events that involve this particular Context. To mark some (or all) Context attributes as private for all contexts, use the overall configuration for the SDK. See launchdarkly::config::shared::builders::EventsBuilder<SDK>::AllAttributesPrivate and launchdarkly::config::shared::builders::EventsBuilder<SDK>::PrivateAttribute.
The attributes "kind" and "key", and the "_meta" attributes cannot be made private.
In this example, firstName is marked as private, but lastName is not:
This is a metadata property, rather than an attribute that can be addressed in evaluations: that is, a rule clause that references the attribute name "privateAttributes", will not use this value, but would use a "privateAttributes" attribute set on the context.
ref | The reference to set private. |
|
inline |
Add items from an iterable collection. One that provides a begin/end iterator and iterates over AttributeReferences or a convertible type.
IterType | The type of iterable. |
attributes | The attributes to add as private. |
AttributesBuilder& launchdarkly::AttributesBuilder< BuilderReturn, BuildType >::Anonymous | ( | bool | anonymous | ) |
If true, the context will not appear on the Contexts page in the LaunchDarkly dashboard.
anonymous | The value to set. |
|
inline |
Build the context.
|
inline |
Start updating an existing kind.
kind | The kind to start updating. |
|
inline |
Start adding a kind to the context.
If you call this function multiple times with the same kind, then the same builder will be returned each time. If you previously called the function with the same kind, but different key, then the key will be updated.
kind | The kind being added. |
key | The key for the kind. |
AttributesBuilder& launchdarkly::AttributesBuilder< BuilderReturn, BuildType >::Name | ( | std::string | name | ) |
The context's name.
You can search for contexts on the Contexts page by name.
name |
AttributesBuilder& launchdarkly::AttributesBuilder< BuilderReturn, BuildType >::Set | ( | std::string | name, |
launchdarkly::Value | value | ||
) |
Add or update an attribute in the context.
This method cannot be used to set the key, kind, name, anonymous, or _meta property of a context. The specific methods on the context builder, or attributes builder, should be used.
name | The name of the attribute. |
value | The value for the attribute. |
private_attribute | If the attribute should be considered private: that is, the value will not be sent to LaunchDarkly in analytics events. |
AttributesBuilder& launchdarkly::AttributesBuilder< BuilderReturn, BuildType >::SetPrivate | ( | std::string | name, |
launchdarkly::Value | value | ||
) |
Add or update a private attribute in the context.
This method cannot be used to set the key, kind, name, or anonymous property of a context. The specific methods on the context builder, or attributes builder, should be used.
Once you have set an attribute private it will remain in the private list even if you call set
afterward. This method is just a convenience which also adds the attribute to the PrivateAttributes
.
name | The name of the attribute. |
value | The value for the attribute. |
private_attribute | If the attribute should be considered private: that is, the value will not be sent to LaunchDarkly in analytics events. |