To map some map keys and save the entire map in a variable, you can use = variablewith a template:
def check_data(arg1, %{"action" => "action1"} = map, arg2) do
end
, "action1" "action" ( /) , map:
iex(1)> defmodule Main do
...(1)> def check_data(_arg1, %{"action" => "action1"} = map, _arg2), do: map
...(1)> end
iex(2)> Main.check_data :foo, %{}, :bar
** (FunctionClauseError) no function clause matching in Main.check_data/3
iex:2: Main.check_data(:foo, %{}, :bar)
iex(2)> Main.check_data :foo, %{"action" => "action1"}, :bar
%{"action" => "action1"}
iex(3)> Main.check_data :foo, %{"action" => "action1", :foo => :bar}, :bar
%{:foo => :bar, "action" => "action1"}