Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[client] Remove experimental comment from Metadata #9796

Merged
merged 2 commits into from Mar 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 8 additions & 9 deletions client/client.go
Expand Up @@ -98,15 +98,9 @@ type Info struct {
Auth AuthData

// Metadata is the request metadata from the client connecting to this connector.
// Experimental: *NOTE* this structure is subject to change or removal in the future.
Metadata Metadata
}

// Metadata is an immutable map, meant to contain request metadata.
type Metadata struct {
data map[string][]string
}

// AuthData represents the authentication data as seen by authenticators tied to
// the receivers.
type AuthData interface {
Expand All @@ -116,8 +110,7 @@ type AuthData interface {
// "membership" might return a list of strings.
GetAttribute(string) any

// GetAttributes returns the names of all attributes in this authentication
// data.
// GetAttributeNames returns the names of all attributes in this authentication data.
GetAttributeNames() []string
}

Expand All @@ -139,7 +132,12 @@ func FromContext(ctx context.Context) Info {
return c
}

// NewMetadata creates a new Metadata object to use in Info. md is used as-is.
// Metadata is an immutable map, meant to contain request metadata.
type Metadata struct {
data map[string][]string
}

// NewMetadata creates a new Metadata object to use in Info.
func NewMetadata(md map[string][]string) Metadata {
c := make(map[string][]string, len(md))
for k, v := range md {
Expand All @@ -151,6 +149,7 @@ func NewMetadata(md map[string][]string) Metadata {
}

// Get gets the value of the key from metadata, returning a copy.
// The key lookup is case-insensitive.
func (m Metadata) Get(key string) []string {
if len(m.data) == 0 {
return nil
Expand Down