Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ExAws add-on for AWS Service Discovery
defmodule ExAws.ServiceDiscovery do
@moduledoc """
Minimal module to issue AWS Cloud Map requests with ExAws, which
is used by clustering mechanisms.
"""
alias ExAws.Operation.JSON
@version "2017-03-14"
@namespace "Route53AutoNaming_v20170314"
def list_instances(service_id) do
request(%{
"Action" => "ListInstances",
"ServiceId" => service_id
})
end
defp request(%{"Action" => action} = params, opts \\ %{}) do
headers = [
{"x-amz-target", "#{@namespace}.#{action}"},
{"content-type", "application/x-amz-json-1.1"}
]
params = Map.merge(params, %{"Version" => @version})
body = %{data: params, headers: headers} |> Map.merge(opts)
JSON.new(:servicediscovery, body)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.