metadata

package
v0.5.15 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2025 License: GPL-3.0 Imports: 7 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")
)

Functions

func ClearCtxMetadataAccessToken

func ClearCtxMetadataAccessToken(ctx context.Context) (context.Context, error)

ClearCtxMetadataAccessToken clears the access token from the context metadata

Parameters:

  • ctx: The context to clear the token from

Returns:

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

func ClearCtxMetadataAuthorizationToken

func ClearCtxMetadataAuthorizationToken(ctx context.Context) (
	context.Context,
	error,
)

ClearCtxMetadataAuthorizationToken clears the authorization token from the context metadata

Parameters:

  • ctx: The context to clear the token from

Returns:

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

func ClearCtxMetadataGCloudAuthorizationToken

func ClearCtxMetadataGCloudAuthorizationToken(ctx context.Context) (
	context.Context,
	error,
)

ClearCtxMetadataGCloudAuthorizationToken clears the GCloud authorization token from the context metadata

Parameters:

  • ctx: The context to clear the token from

Returns:

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

func ClearCtxMetadataRefreshToken

func ClearCtxMetadataRefreshToken(ctx context.Context) (
	context.Context,
	error,
)

ClearCtxMetadataRefreshToken clears the refresh token from the context metadata

Parameters:

  • ctx: The context to clear the token from

Returns:

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

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 DeleteCtxMetadataValue

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

DeleteCtxMetadataValue deletes the value for a given key from the context metadata

Parameters:

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

Returns:

  • context.Context: The context with the value deleted
  • error: An error if the key is not found or any other error occurs

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 GetCtxMetadata

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

GetCtxMetadata gets the metadata from the context

Parameters:

  • ctx: The context to get the metadata from

Returns:

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

func GetCtxMetadataAccessToken

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

GetCtxMetadataAccessToken gets the access token from the context metadata

Parameters:

  • ctx: The 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 GetCtxMetadataAuthorizationToken

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

GetCtxMetadataAuthorizationToken gets the authorization token from the context metadata

Parameters:

  • ctx: The 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 GetCtxMetadataBearerToken

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

GetCtxMetadataBearerToken gets the bearer token from the context metadata

Parameters:

  • ctx: The 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 GetCtxMetadataGCloudAuthorizationToken

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

GetCtxMetadataGCloudAuthorizationToken gets the GCloud authorization token from the context metadata

Parameters:

  • ctx: The 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 GetCtxMetadataRefreshToken

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

GetCtxMetadataRefreshToken gets the refresh token from the context metadata

Parameters:

  • ctx: The 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 GetCtxMetadataValue

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

GetCtxMetadataValue 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 SetCtxMetadataAccessToken

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

SetCtxMetadataAccessToken sets the access token to the metadata

Parameters:

  • ctx: The 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 SetCtxMetadataAuthorizationToken

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

SetCtxMetadataAuthorizationToken sets the authorization token to the metadata

Parameters:

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

Returns:

  • context.Context: The context with the token set

func SetCtxMetadataBearerToken

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

SetCtxMetadataBearerToken sets the authorization token to the metadata

Parameters:

  • ctx: The 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 SetCtxMetadataGCloudAuthorizationToken

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

SetCtxMetadataGCloudAuthorizationToken sets the GCloud authorization token to the metadata

Parameters:

  • ctx: The 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 SetCtxMetadataRefreshToken

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

SetCtxMetadataRefreshToken sets the refresh token to the metadata

Parameters:

  • ctx: The 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

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

Types

This section is empty.

Jump to

Keyboard shortcuts

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