Documentation ¶
Index ¶
- func GetComponent() string
- func GetFirebaseIDToken(email, password, firebaseAPIKey string) (string, error)
- func GetSecretValue(FS embed.FS, credentialsPath string, secretName string) ([]byte, error)
- func WriteErrorResponse(w http.ResponseWriter, msg string, errorCode int)
- func WriteGzipJSONResponse(w http.ResponseWriter, data interface{}, code int) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetComponent ¶
func GetComponent() string
GetComponent returns details about the caller function. It is utilized to populate the component field of a GoogleLogEntry, or any other log entry component field.
func GetFirebaseIDToken ¶
GetFirebaseIDToken exchanges an email and password for a Firebase ID token. The email and password are used to authenticate with Firebase. The Firebase ID token is returned. If the request fails, an error is returned.
func GetSecretValue ¶ added in v1.0.8
GetSecretValue is a function to retrieve a secret value from Google Cloud Secret Manager. FS is the embed.FS embedded filesystem to pass to the function. The credentialsPath parameter is the path to the credentials file. The secretName parameter is the name of the secret to retrieve. The secret value is returned as a byte slice.
func WriteErrorResponse ¶ added in v1.0.7
func WriteErrorResponse(w http.ResponseWriter, msg string, errorCode int)
WriteErrorResponse writes an error response to the response writer with appropriate headers. It does NOT return an error because it is used to write an error response. Instead, if an error occurs internally, it writes the error to the response writer with http.Error.
func WriteGzipJSONResponse ¶
func WriteGzipJSONResponse(w http.ResponseWriter, data interface{}, code int) error
WriteGzippedJSONResponse compresses the JSON data and writes it to the response writer with appropriate headers. The Content-Encoding header is set to gzip and the Content-Type header is set to application/json. The Content-Length header is set with the length of the compressed data. The status code is set based on the provided code parameter. If the data cannot be serialized to JSON, an error is returned. If the compressed data cannot be written to the response writer, an error is returned.
Types ¶
This section is empty.