lib/nomad/api/regions.ex

# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
# https://openapi-generator.tech
# Do not edit the class manually.

defmodule Nomad.Api.Regions do
  @moduledoc """
  API calls for all endpoints tagged `Regions`.
  """

  alias Nomad.Connection
  import Nomad.RequestBuilder

  @doc """
  list all known regions

  ## Parameters

  - connection (Nomad.Connection): Connection to server
  - opts (KeywordList): [optional] Optional parameters
  ## Returns

  {:ok, [%String{}, ...]} on success
  {:error, Tesla.Env.t} on failure
  """
  @spec get_regions(Tesla.Env.client(), keyword()) ::
          {:ok, list(String.t())} | {:error, Tesla.Env.t()}
  def get_regions(connection, _opts \\ []) do
    %{}
    |> method(:get)
    |> url("/regions")
    |> Enum.into([])
    |> (&Connection.request(connection, &1)).()
    |> evaluate_response([
      {200, []}
    ])
  end
end