gcloudjuice

package
v1.6.8 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package gcloudjuice provides utility functions for interacting with Google Cloud services.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthenticateOIDCToken

func AuthenticateOIDCToken(ctx context.Context, w http.ResponseWriter, r *http.Request, authTokenKey string, expectedAudience, expectedIssuer string) (*structcup.AuthResponse, error)

AuthenticateOIDCToken verifies a JWT token's authenticity based on the provided audience and issuer. It requires an HTTP response writer (w), an HTTP request (r), an authorization token key (authTokenKey), an expected audience (expectedAudience), and an expected issuer (expectedIssuer). It returns a success response if the token is valid or an error if the token is invalid or does not match the expected audience and issuer.

func CreateOIDCToken

func CreateOIDCToken(ctx context.Context, FS embed.FS, credentialsPath string, audience string) (*oauth2.Token, error)

CreateOIDCToken creates an OIDC token with the given audience. It requires an embedded filesystem (FS), a path to the credentials file (credentialsPath), and an audience (audience). It returns the OIDC token or an error if the operation fails.

func GetSecretValue

func GetSecretValue(ctx context.Context, FS embed.FS, credentialsPath string, projectID string, secretID string, versionID string) ([]byte, error)

GetSecretValue retrieves a secret value from Google Cloud Secret Manager. It requires an embedded filesystem (FS), a path to the credentials file (credentialsPath), a Google Cloud project ID (projectID), a secret ID (secretID), and a secret version ID (versionID). It returns the secret value as a byte slice or an error if the operation fails.

func GetTimezoneFromCoordinates added in v1.5.0

func GetTimezoneFromCoordinates(ctx context.Context, mapsAPIKey string, latitude float64, longitude float64) (string, error)

GetTimezoneFromCoordinates retrieves the timezone from the given coordinates.

Types

This section is empty.

Jump to

Keyboard shortcuts

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