metadata

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2025 License: GPL-3.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNilMetadata                      = errors.New("missing metadata")
	ErrNilMetadataKeyValue              = errors.New("metadata key value is nil")
	ErrAuthorizationMetadataInvalid     = errors.New("authorization metadata invalid")
	ErrAuthorizationMetadataNotProvided = errors.New("authorization metadata is not provided")
)

Functions

func ClearMetadataAccessToken

func ClearMetadataAccessToken(md metadata.MD) metadata.MD

ClearMetadataAccessToken clears the access token from the metadata

Parameters:

  • md: The metadata to clear the token from

Returns:

  • metadata.MD: The metadata with the token cleared

func ClearMetadataAuthorizationToken

func ClearMetadataAuthorizationToken(md metadata.MD) metadata.MD

ClearMetadataAuthorizationToken clears the authorization token from the metadata

Parameters:

  • md: The metadata to clear the token from

Returns:

  • metadata.MD: The metadata with the token cleared

func ClearMetadataGCloudAuthorizationToken

func ClearMetadataGCloudAuthorizationToken(md metadata.MD) metadata.MD

ClearMetadataGCloudAuthorizationToken clears the GCloud authorization token from the metadata

Parameters:

  • md: The metadata to clear the token from

Returns:

  • metadata.MD: The metadata with the token cleared

func ClearMetadataRefreshToken

func ClearMetadataRefreshToken(md metadata.MD) metadata.MD

ClearMetadataRefreshToken clears the refresh token from the metadata

Parameters:

  • md: The metadata to clear the token from

Returns:

  • metadata.MD: The metadata with the token cleared

func DeleteMetadataValue

func DeleteMetadataValue(md metadata.MD, key string) metadata.MD

DeleteMetadataValue deletes the value for a given key from the metadata

Parameters:

  • md: The metadata to delete the value from
  • key: The key to delete the value for

Returns:

  • metadata.MD: The metadata with the value deleted

func GetIncomingCtxMetadata added in v0.6.0

func GetIncomingCtxMetadata(ctx context.Context) (metadata.MD, error)

GetIncomingCtxMetadata gets the incoming metadata from the context

Parameters:

  • ctx: The context to get the incoming metadata from

Returns:

  • metadata.MD: The incoming metadata from the context
  • error: An error if the metadata is not found or any other error occurs

func GetIncomingCtxMetadataAccessToken added in v0.6.0

func GetIncomingCtxMetadataAccessToken(ctx context.Context) (string, error)

GetIncomingCtxMetadataAccessToken gets the access token from the incoming context metadata

Parameters:

  • ctx: The incoming context to get the token from

Returns:

  • string: The token
  • error: An error if the token is not found or any other error occurs

func GetIncomingCtxMetadataAuthorizationToken added in v0.6.0

func GetIncomingCtxMetadataAuthorizationToken(ctx context.Context) (string, error)

GetIncomingCtxMetadataAuthorizationToken gets the authorization token from the incoming context metadata

Parameters:

  • ctx: The incoming context to get the metadata from

Returns:

  • string: The token
  • error: An error if the token is not found or any other error occurs

func GetIncomingCtxMetadataBearerToken added in v0.6.0

func GetIncomingCtxMetadataBearerToken(ctx context.Context, key string) (
	string,
	error,
)

GetIncomingCtxMetadataBearerToken gets the bearer token from the incoming context metadata

Parameters:

  • ctx: The incoming context to get the metadata from
  • key: The key to get the token for

Returns:

  • string: The token
  • error: An error if the token is not found or any other error occurs

func GetIncomingCtxMetadataGCloudAuthorizationToken added in v0.6.0

func GetIncomingCtxMetadataGCloudAuthorizationToken(ctx context.Context) (
	string,
	error,
)

GetIncomingCtxMetadataGCloudAuthorizationToken gets the GCloud authorization token from the incoming context metadata

Parameters:

  • ctx: The incoming context to get the metadata from

Returns:

  • string: The token
  • error: An error if the token is not found or any other error occurs

func GetIncomingCtxMetadataRefreshToken added in v0.6.0

func GetIncomingCtxMetadataRefreshToken(ctx context.Context) (string, error)

GetIncomingCtxMetadataRefreshToken gets the refresh token from the incoming context metadata

Parameters:

  • ctx: The incoming context to get the token from

Returns:

  • string: The token
  • error: An error if the token is not found or any other error occurs

func GetIncomingCtxMetadataValue added in v0.6.0

func GetIncomingCtxMetadataValue(ctx context.Context, key string) ([]string, error)

GetIncomingCtxMetadataValue gets the value for a given key from the context metadata

Parameters:

  • ctx: The context to get the metadata from
  • key: The key to get the value for

Returns:

  • []string: The value for the given key
  • error: An error if the key is not found or any other error occurs

func GetMetadataAccessToken

func GetMetadataAccessToken(md metadata.MD) (string, error)

GetMetadataAccessToken gets the access token from the metadata

Parameters:

  • md: The metadata to get the token from

Returns:

  • string: The token
  • error: An error if the token is not found or any other error occurs

func GetMetadataAuthorizationToken

func GetMetadataAuthorizationToken(md metadata.MD) (string, error)

GetMetadataAuthorizationToken gets the authorization token from the metadata

Parameters:

  • md: The metadata to get the token from

Returns:

  • string: The token
  • error: An error if the token is not found or any other error occurs

func GetMetadataBearerToken

func GetMetadataBearerToken(md metadata.MD, key string) (string, error)

GetMetadataBearerToken gets the bearer token from the metadata

Parameters:

  • md: The metadata to get the token from
  • key: The key to get the token for

Returns:

  • string: The token
  • error: An error if the token is not found or any other error occurs

func GetMetadataGCloudAuthorizationToken

func GetMetadataGCloudAuthorizationToken(md metadata.MD) (string, error)

GetMetadataGCloudAuthorizationToken gets the GCloud authorization token from the metadata

Parameters:

  • md: The metadata to get the token from

Returns:

  • string: The token
  • error: An error if the token is not found or any other error occurs

func GetMetadataRefreshToken

func GetMetadataRefreshToken(md metadata.MD) (string, error)

GetMetadataRefreshToken gets the refresh token from the metadata

Parameters:

  • md: The metadata to get the token from

Returns:

  • string: The token
  • error: An error if the token is not found or any other error occurs

func GetMetadataValue

func GetMetadataValue(md metadata.MD, key string) ([]string, error)

GetMetadataValue gets the value for a given key from the metadata

Parameters:

  • md: The metadata to get the value from
  • key: The key to get the value for

Returns:

  • []string: The value for the given key
  • error: An error if the key is not found or any other error occurs

func GetOutgoingCtxMetadata added in v0.6.0

func GetOutgoingCtxMetadata(ctx context.Context) metadata.MD

GetOutgoingCtxMetadata gets the outgoing metadata from the context

Parameters:

  • ctx: The context to get the outgoing metadata from

Returns:

- metadata.MD: The outgoing metadata from the context

func GetOutgoingCtxMetadataAccessToken added in v0.6.0

func GetOutgoingCtxMetadataAccessToken(ctx context.Context) (string, error)

GetOutgoingCtxMetadataAccessToken gets the access token from the outgoing context metadata

Parameters:

- ctx: The outgoing context to get the token from

Returns:

- string: The token - error: An error if the token is not found or any other error occurs

func GetOutgoingCtxMetadataAuthorizationToken added in v0.6.0

func GetOutgoingCtxMetadataAuthorizationToken(ctx context.Context) (
	string,
	error,
)

GetOutgoingCtxMetadataAuthorizationToken gets the authorization token from the outgoing context metadata

Parameters:

- ctx: The outgoing context to get the token from

Returns:

- string: The token - error: An error if the token is not found or any other error occurs

func GetOutgoingCtxMetadataGCloudAuthorizationToken added in v0.6.0

func GetOutgoingCtxMetadataGCloudAuthorizationToken(ctx context.Context) (
	string,
	error,
)

GetOutgoingCtxMetadataGCloudAuthorizationToken gets the GCloud authorization token from the outgoing context metadata

Parameters:

- ctx: The outgoing context to get the token from

Returns:

- string: The token - error: An error if the token is not found or any other error occurs

func GetOutgoingCtxMetadataRefreshToken added in v0.6.0

func GetOutgoingCtxMetadataRefreshToken(ctx context.Context) (string, error)

GetOutgoingCtxMetadataRefreshToken gets the refresh token from the outgoing context metadata

Parameters:

  • ctx: The outgoing context to get the token from

Returns:

- string: The token - error: An error if the token is not found or any other error occurs

func SetMetadataAccessToken

func SetMetadataAccessToken(md metadata.MD, accessToken string) metadata.MD

SetMetadataAccessToken sets the access token to the metadata

Parameters:

  • md: The metadata to set the token to
  • accessToken: The token to set

Returns:

  • metadata.MD: The metadata with the token set

func SetMetadataAuthorizationToken

func SetMetadataAuthorizationToken(md metadata.MD, token string) metadata.MD

SetMetadataAuthorizationToken sets the authorization token to the metadata

Parameters:

  • md: The metadata to set the token to
  • token: The token to set

Returns:

  • metadata.MD: The metadata with the token set

func SetMetadataBearerToken

func SetMetadataBearerToken(md metadata.MD, key, token string) metadata.MD

SetMetadataBearerToken sets the authorization token to the metadata

Parameters:

  • md: The metadata to set the token to
  • key: The metadata key where the token will be set
  • token: The token to set

Returns:

  • metadata.MD: The metadata with the token set

func SetMetadataGCloudAuthorizationToken

func SetMetadataGCloudAuthorizationToken(
	md metadata.MD,
	token string,
) metadata.MD

SetMetadataGCloudAuthorizationToken sets the GCloud authorization token to the metadata

Parameters:

  • md: The metadata to set the token to
  • token: The token to set

Returns:

  • metadata.MD: The metadata with the token set

func SetMetadataRefreshToken

func SetMetadataRefreshToken(md metadata.MD, refreshToken string) metadata.MD

SetMetadataRefreshToken sets the refresh token to the metadata

Parameters:

  • md: The metadata to set the token to
  • refreshToken: The token to set

Returns:

  • metadata.MD: The metadata with the token set

func SetOutgoingCtxMetadataAccessToken added in v0.6.0

func SetOutgoingCtxMetadataAccessToken(
	ctx context.Context,
	accessToken string,
) (context.Context, error)

SetOutgoingCtxMetadataAccessToken sets the access token to the metadata

Parameters:

  • ctx: The outgoing context to set the token to
  • accessToken: The token to set

Returns:

  • context.Context: The context with the token set
  • error: An error if the metadata is not found or any other error occurs

func SetOutgoingCtxMetadataAuthorizationToken added in v0.6.0

func SetOutgoingCtxMetadataAuthorizationToken(
	ctx context.Context,
	token string,
) (context.Context, error)

SetOutgoingCtxMetadataAuthorizationToken sets the authorization token to the metadata

Parameters:

  • ctx: The outgoing context to set the token to
  • token: The token to set

Returns:

  • context.Context: The context with the token set

func SetOutgoingCtxMetadataBearerToken added in v0.6.0

func SetOutgoingCtxMetadataBearerToken(
	ctx context.Context,
	key, token string,
) (context.Context, error)

SetOutgoingCtxMetadataBearerToken sets the authorization token to the metadata

Parameters:

  • ctx: The outgoing context to set the token to
  • key: The metadata key where the token will be set
  • token: The token to set

Returns:

  • context.Context: The context with the token set
  • error: An error if the metadata is not found or any other error occurs

func SetOutgoingCtxMetadataGCloudAuthorizationToken added in v0.6.0

func SetOutgoingCtxMetadataGCloudAuthorizationToken(
	ctx context.Context,
	token string,
) (context.Context, error)

SetOutgoingCtxMetadataGCloudAuthorizationToken sets the GCloud authorization token to the metadata

Parameters:

  • ctx: The outgoing context to set the token to
  • token: The token to set

Returns:

  • context.Context: The context with the token set
  • error: An error if the metadata is not found or any other error occurs

func SetOutgoingCtxMetadataRefreshToken added in v0.6.0

func SetOutgoingCtxMetadataRefreshToken(
	ctx context.Context,
	refreshToken string,
) (context.Context, error)

SetOutgoingCtxMetadataRefreshToken sets the refresh token to the metadata

Parameters:

  • ctx: The outgoing context to set the token to
  • refreshToken: The token to set

Returns:

  • context.Context: The context with the token set
  • error: An error if the metadata is not found or any other error occurs

Types

This section is empty.

Jump to

Keyboard shortcuts

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