GoogleCloudPlatform / functions-framework-dart

FaaS (Function as a service) framework for writing portable Dart functions
https://pub.dev/packages/functions_framework
Apache License 2.0
536 stars 54 forks source link

Provide access to an instance's region from metadata #392

Open prefanatic opened 1 year ago

prefanatic commented 1 year ago

I've found myself carrying around a method to derive a region from metadata.google.internal. It's fairly analogous to projectIdFromMetadataServer from package:gcp

Usage of this method looks like:

final location = await locationFromMetadataServer();
print(location);
...
// Outputs: us-central1

I've scanned through a couple other issues, it looks like #123 is somewhat related, although is potentially larger in scope.

Would this be a welcome contribution, to be added to package:gcp?

kevmoo commented 1 year ago

Something for pkg:gcp sounds good to me!