iammember

package
v0.29.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 12, 2021 License: MIT Imports: 4 Imported by: 1

Documentation

Overview

Package iammember provides primitives for IAM member identifiers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveContextUnaryInterceptor added in v0.20.0

func ResolveContextUnaryInterceptor(resolver Resolver) grpc.UnaryServerInterceptor

ResolveContextUnaryInterceptor returns a gRPC server middleware that resolves IAM members with the provided resolver.

func WithResolvedContext added in v0.20.0

func WithResolvedContext(ctx context.Context, resolveResult ResolveResult) context.Context

WithResolvedContext returns a new context with cached IAM member resolve result.

Types

type Metadata added in v0.20.0

type Metadata map[string][]string

Metadata contains IAM members partitioned by which gRPC metadata key they were resolved from.

func (Metadata) Add added in v0.25.0

func (m Metadata) Add(key, member string)

Add a member to the specified metadata key.

func (Metadata) AddAll added in v0.25.0

func (m Metadata) AddAll(other Metadata)

AddAll adds all members from another metadata instance.

type ResolveResult added in v0.20.0

type ResolveResult struct {
	// Checksum of the metadata that the members were resolved from.
	Checksum uint64
	// Members are the resolved IAM members.
	Members []string
	// Metadata are the resolved IAM members partitioned by which metadata key they were resolved from.
	Metadata Metadata
}

ResolveResult is the output from a Resolver.

func FromResolvedContext added in v0.20.0

func FromResolvedContext(ctx context.Context) (ResolveResult, bool)

FromResolvedContext returns the resolved IAM members and metadata from the provided context.

func (*ResolveResult) Add added in v0.20.0

func (r *ResolveResult) Add(key string, member string)

Add a member resolved from the provided metadata key and value.

func (*ResolveResult) AddAll added in v0.20.0

func (r *ResolveResult) AddAll(other ResolveResult)

AddAll adds all the resolved members from another ResolveResult.

func (*ResolveResult) AddChecksum added in v0.25.0

func (r *ResolveResult) AddChecksum(key, value string)

AddChecksum adds the provided metadata key and value to the checksum.

type Resolver

type Resolver interface {
	ResolveIAMMembers(context.Context) (ResolveResult, error)
}

Resolver resolves the IAM member identifiers for a caller context.

func ChainResolvers added in v0.8.0

func ChainResolvers(resolvers ...Resolver) Resolver

ChainResolvers creates a single resolver out of a chain of many resolvers.

The resulting resolved members will be the union of the members resolved by each resolver.

If any resolver returns an error, that error is immediately returned and no further resolvers are called.

func FromContextResolver added in v0.20.0

func FromContextResolver() Resolver

FromContextResolver returns a Resolver that resolves cached IAM members and metadata from the current context.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL