# `IMDS.Providers.Scaleway`

Scaleway instance metadata service.

The service answers on the link-local address `169.254.42.42`, at the path
`/conf?format=json`. No request needs an authentication header. The answer is
one JSON document. The documented IPv6 address `fd00:42::42` is available
through the `:base_url` option.

The document reports the zone, for example `fr-par-1`. The identity derives
the region from the zone, for example `fr-par`. The document reports the
commercial type as the machine size and the organization as the owner scope.

Detection needs the Scaleway address `169.254.42.42` and a JSON document with
the keys `id` and `commercial_type`.

The user data paths of Scaleway demand a source port below 1024. The default
transport cannot use a privileged port, so user data is out of scope.

# `path`

```elixir
@spec path() :: binary()
```

Return the metadata path of the JSON document.

# `region_from_zone`

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

Derive the region from a Scaleway zone name.

A zone name carries a trailing numeric segment, for example `fr-par-1`. The
region is the part before that segment. A name of another shape has no known
region.

## Examples

    iex> IMDS.Providers.Scaleway.region_from_zone("fr-par-1")
    "fr-par"

    iex> IMDS.Providers.Scaleway.region_from_zone("nl-ams-3")
    "nl-ams"

    iex> IMDS.Providers.Scaleway.region_from_zone("par1")
    nil

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

---

*Consult [api-reference.md](api-reference.md) for complete listing*
