general library

Properties

gceMetadataHost → String
Returns the host for the GCE metadata server.
no setter

Functions

computeProjectId({Client? client, bool refresh = false}) → Future<String>
A convenience wrapper that tries multiple strategies to find the project ID, prioritizing local development strategies over cloud discovery.
fetchMetadataValue(String path, {Client? client, Duration timeout = const Duration(seconds: 3)}) → Future<String>
Retrieves a value from the GCE metadata server without caching the result.
gceMetadataUrl(String path) → Uri
Returns a Uri for the given path on the GCE metadata server.
getMetadataValue(String path, {Client? client, Duration timeout = const Duration(seconds: 3), bool refresh = false}) → Future<String>
Retrieves a value from the GCE metadata server.
projectIdFromCredentialsFile() → String?
Returns the Project ID for the current Google Cloud Project by reading the project_id field from the credentials JSON file specified by the GOOGLE_APPLICATION_CREDENTIALS environment variable.
projectIdFromEnvironmentVariables() → String?
Returns the Project ID for the current Google Cloud Project by checking the environment variables in projectIdEnvironmentVariableOptions.
projectIdFromGcloudConfig() → Future<String?>
Returns a Future that completes with the Project ID for the current Google Cloud Project by querying the gcloud CLI configuration.
projectIdFromMetadataServer({Client? client, bool refresh = false}) → Future<String>
Returns a Future that completes with the Project ID for the current Google Cloud Project by checking project metadata.
serviceAccountEmailFromMetadataServer({Client? client, bool refresh = false}) → Future<String>
A convenience wrapper that tries to retrieve the default service account email from the Metadata Server.

Exceptions / Errors

MetadataServerException
Exception thrown when accessing the GCE metadata server fails.