Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Languages map[string][]string
Languages is a map of SDK IDs to supported languages.
var Names map[string]string
Names is a map of SDK IDs to display names.
var Popularity map[string]int
Popularity is a map of SDK IDs to popularity scores.
var Releases map[string]ReleaseList
var Repos map[string]Repo
Repos is a map of SDK IDs to repository information.
var Types map[string]Type
Types is a map of SDK IDs to SDK types.
Functions ¶
func GetSDKNameByWrapperOrUserAgent ¶ added in v0.4.0
GetSDKNameByWrapperOrUserAgent attempts to find an SDK name by first checking wrapper names, then user agents, in alphabetical order by SDK ID. Returns the SDK name and true if found, empty string and false if not found.
Use UserAgents.ResolveSDKID when you need more than a display name.
Types ¶
type AISDKIdentifier ¶ added in v0.6.0
type AISDKIdentifier struct {
// Name is the value reported as aiSdkName. This is the package name.
Name string `json:"name"`
// Language is the value reported as aiSdkLanguage, for example "python".
Language string `json:"language"`
}
AISDKIdentifier is one (name, language) pair that an AI SDK reports about itself in the $ld:ai:sdk:info custom event.
type AISDKIdentifierMap ¶ added in v0.6.0
type AISDKIdentifierMap map[string][]AISDKIdentifier
AISDKIdentifierMap maps SDK IDs to the identifiers those AI SDKs report.
var AISDKIdentifiers AISDKIdentifierMap
AISDKIdentifiers is a map of SDK IDs to the identifiers those AI SDKs report.
An AI SDK wraps a client that the caller supplies, so it sends no user agent of its own. It reports itself in a custom event instead. Historical names are kept so that older deployments still resolve.
func (AISDKIdentifierMap) ResolveSDKID ¶ added in v0.6.0
func (m AISDKIdentifierMap) ResolveSDKID(name string, language string) (string, bool)
ResolveSDKID finds the SDK ID for an AI SDK from the aiSdkName and aiSdkLanguage it reports in the $ld:ai:sdk:info event. Returns the SDK ID and true if found, empty string and false if not found.
Both arguments are required. The name alone is not unique: the Python and Ruby AI SDKs both report "launchdarkly-server-sdk-ai".
The returned ID is the key for Names, Types, Repos, and Releases.
type Release ¶
type Release struct {
Major int `json:"major"`
Minor int `json:"minor"`
Date time.Time `json:"date"`
EOL *time.Time `json:"eol"`
}
func (Release) IsApproachingEOL ¶
IsApproachingEOL returns true if the release is not the latest release and the EOL date is within the time period from now to now + thresholdPrior. This is only valid if IsEOL() returns false.
func (Release) IsEOL ¶
IsEOL returns true if the release is not the latest release and the current time is after the EOL date. The parameter represents the current time.
func (Release) IsLatest ¶
IsLatest returns true if the release is the latest release, meaning there is no EOL date set.
func (Release) MajorMinor ¶
MajorMinor returns a version string comprised of the major and minor version. For example, '2.1'.
type ReleaseList ¶
type ReleaseList []Release
ReleaseList is an ordered list of releases. The first item should be the most recent release, while the last item is the oldest release.
func (ReleaseList) Earliest ¶
func (r ReleaseList) Earliest() Release
Earliest returns the earliest release.
func (ReleaseList) Latest ¶
func (r ReleaseList) Latest() Release
Latest returns the latest release.
type Repo ¶
type Repo struct {
// GitHub is the GitHub repo path including the owner and repo name (e.g. launchdarkly/js-core).
GitHub string `json:"github"`
}
Repo contains the location of an SDK.
type SDKUserAgentMap ¶ added in v0.4.0
type SDKUserAgentMap struct {
UserAgents []string `json:"userAgents,omitempty"`
WrapperNames []string `json:"wrapperNames,omitempty"`
}
SDKUserAgentMap contains user agent and wrapper information for an SDK
type Type ¶
type Type string
Type represents the most common use-case for an SDK.
const ( // ClientSideType is an SDK that runs in a client context. ClientSideType Type = "client-side" // ServerSideType is an SDK that runs in a server context. ServerSideType Type = "server-side" // EdgeType is an SDK that runs in an edge deployment scenario. EdgeType Type = "edge" // AIType is an SDK that is primarily focused on AI/ML use cases. AIType Type = "ai" // AIProviderType is a provider integration for an AI SDK, such as an OpenAI or // Anthropic handler. AIProviderType Type = "ai-provider" // OpenFeatureProviderType is an OpenFeature provider. OpenFeatureProviderType Type = "open-feature-provider" // RelayType is Relay Proxy. RelayType Type = "relay" )
type UserAgentMap ¶ added in v0.6.0
type UserAgentMap map[string]SDKUserAgentMap
UserAgentMap maps SDK IDs to the user agents and wrapper names they report.
var UserAgents UserAgentMap
UserAgents is a map of SDK IDs to their user agent and wrapper information
func (UserAgentMap) ResolveSDKID ¶ added in v0.6.0
func (m UserAgentMap) ResolveSDKID(identifier string) (string, bool)
ResolveSDKID finds the SDK ID that reports the given wrapper name or user agent. Wrapper names are checked first, then user agents, in alphabetical order by SDK ID. Returns the SDK ID and true if found, empty string and false if not found.
The returned ID is the key for Names, Types, Repos, and Releases.
Some identifiers are reported by more than one SDK. For example both akamai-base and akamai-edgekv report "AkamaiEdgeSDK". In that case the first SDK ID in alphabetical order is returned.