IMDS.Providers.GCE (imds v1.0.0)

Copy Markdown

Google Compute Engine VM metadata server.

Every request sends Metadata-Flavor: Google. Detection requires both a non-empty instance ID and a response header with the value Google.

Summary

Functions

Derive the region from a zone name.

Functions

region_from_zone(zone)

@spec region_from_zone(binary() | nil) :: binary() | nil

Derive the region from a zone name.

Examples

iex> IMDS.Providers.GCE.region_from_zone("europe-west1-b")
"europe-west1"

iex> IMDS.Providers.GCE.region_from_zone("projects/123/zones/europe-west1-b")
"europe-west1"

iex> IMDS.Providers.GCE.region_from_zone(nil)
nil