hexsha
stringlengths
40
40
size
int64
2
991k
ext
stringclasses
2 values
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
4
208
max_stars_repo_name
stringlengths
6
106
max_stars_repo_head_hexsha
stringlengths
40
40
max_stars_repo_licenses
sequence
max_stars_count
int64
1
33.5k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
4
208
max_issues_repo_name
stringlengths
6
106
max_issues_repo_head_hexsha
stringlengths
40
40
max_issues_repo_licenses
sequence
max_issues_count
int64
1
16.3k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
4
208
max_forks_repo_name
stringlengths
6
106
max_forks_repo_head_hexsha
stringlengths
40
40
max_forks_repo_licenses
sequence
max_forks_count
int64
1
6.91k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
2
991k
avg_line_length
float64
1
36k
max_line_length
int64
1
977k
alphanum_fraction
float64
0
1
791307aadd39cedc35449314564847e435c21ee8
990
ex
Elixir
lib/reporters/output_utils.ex
RichMorin/doctor
fc3520990452d9621a2991e01aec3d421f36169b
[ "MIT" ]
null
null
null
lib/reporters/output_utils.ex
RichMorin/doctor
fc3520990452d9621a2991e01aec3d421f36169b
[ "MIT" ]
null
null
null
lib/reporters/output_utils.ex
RichMorin/doctor
fc3520990452d9621a2991e01aec3d421f36169b
[ "MIT" ]
null
null
null
defmodule Doctor.Reporters.OutputUtils do @moduledoc """ This module provides convenience functions for use when generating reports """ @doc """ Generate a line in a table with the given width and padding. Expects a list with either a 2 or 3 element tuple. """ def generate_table_line(line_data) do line_data |> Enum.reduce("", fn {value, width}, acc -> "#{acc}#{gen_fixed_width_string(value, width)}" {value, width, padding}, acc -> "#{acc}#{gen_fixed_width_string(value, width, padding)}" end) end defp gen_fixed_width_string(value, width, padding \\ 2) defp gen_fixed_width_string(value, width, padding) when is_integer(value) do value |> Integer.to_string() |> gen_fixed_width_string(width, padding) end defp gen_fixed_width_string(value, width, padding) do sub_string_length = width - (padding + 1) value |> String.slice(0..sub_string_length) |> String.pad_trailing(width) end end
26.052632
78
0.681818
7913240136783c54256950e45ca7e86c3841367b
519
ex
Elixir
lib/groupher_server_web/middleware/github_user.ex
coderplanets/coderplanets_server
3663e56340d6d050e974c91f7e499d8424fc25e9
[ "Apache-2.0" ]
240
2018-11-06T09:36:54.000Z
2022-02-20T07:12:36.000Z
lib/groupher_server_web/middleware/github_user.ex
coderplanets/coderplanets_server
3663e56340d6d050e974c91f7e499d8424fc25e9
[ "Apache-2.0" ]
363
2018-07-11T03:38:14.000Z
2021-12-14T01:42:40.000Z
lib/groupher_server_web/middleware/github_user.ex
coderplanets/coderplanets_server
3663e56340d6d050e974c91f7e499d8424fc25e9
[ "Apache-2.0" ]
22
2019-01-27T11:47:56.000Z
2021-02-28T13:17:52.000Z
defmodule GroupherServerWeb.Middleware.GithubUser do @behaviour Absinthe.Middleware import Helper.Utils, only: [handle_absinthe_error: 2] alias Helper.OAuth2.Github def call(%{arguments: %{code: code}} = resolution, _) do case Github.user_profile(code) do {:ok, user} -> arguments = resolution.arguments |> Map.merge(%{github_user: user}) %{resolution | arguments: arguments} {:error, err_msg} -> resolution |> handle_absinthe_error(err_msg) end end end
27.315789
75
0.674374
79132680b29d7690542e98367e79123af8c30c24
3,839
ex
Elixir
lib/session_worker.ex
kongo2002/retro
781149bfe96a665778319ccea03d5ee66349373d
[ "MIT" ]
null
null
null
lib/session_worker.ex
kongo2002/retro
781149bfe96a665778319ccea03d5ee66349373d
[ "MIT" ]
null
null
null
lib/session_worker.ex
kongo2002/retro
781149bfe96a665778319ccea03d5ee66349373d
[ "MIT" ]
null
null
null
defmodule Retro.SessionWorker do use GenServer alias Retro.Session alias Retro.Participant alias Retro.Entry require Logger def start_link(state) do GenServer.start_link(__MODULE__, state) end def init(%Session{id: id} = state) do Logger.info("session #{id} started.") {:ok, state} end def handle_call(:get, _from, state) do {:reply, state, state} end ### participant ### def handle_call( {:create, :participant, participant}, _from, %Session{participants: participants} = state ) do {:reply, state, %Session{state | participants: participants ++ [participant]} |> Session.active()} end def handle_call( {:update, :participant, participant}, _from, state ) do {:reply, state, state |> Participant.update(participant) |> Session.active()} end def handle_call( {:delete, :participant, id_to_delete}, _from, %Session{participants: participants} = state ) do {:reply, state, %Session{ state | participants: participants |> Enum.filter(fn %Participant{id: id} -> id != id_to_delete end) } |> Session.active()} end ### entry ### def handle_call( {:create, :entry, entry}, _from, %Session{entries: entries} = state ) do {:reply, state, %Session{state | entries: entries ++ [entry]} |> Session.active()} end def handle_call( {:update, :entry, entry_to_update}, _from, %Session{entries: entries} = state ) do {:reply, state, %Session{state | entries: Entry.update(entries, entry_to_update)} |> Session.active()} end def handle_call( {:delete, :entry, id_to_delete}, _from, %Session{entries: entries} = state ) do {:reply, state, %Session{ state | entries: entries |> Enum.filter(fn %Entry{id: id} -> id != id_to_delete end) } |> Session.active()} end def terminate(reason, %Session{id: id, entries: entries, participants: participants}) do Logger.info( "SessionWorker terminates for #{id} with #{length(entries)} entries and #{ length(participants) }. Reason: #{reason}" ) topic = id |> String.to_atom() case EventBus.unregister_topic(topic) do :ok -> Logger.info("EventBus: The topic for session #{id} has been unregistered") _ -> Logger.warn("EventBus: Could not unregister topic for session #{id}") end end ### client ### defp call(session_id, params) do case session_id |> Retro.SessionSupervisor.get_pid() do {:ok, pid} -> {:ok, GenServer.call(pid, params)} _ -> {:error, :unknown, session_id} end end def get(session_id), do: session_id |> call(:get) def create_participant(session_id, participant), do: session_id |> call({:create, :participant, participant}) def get_participant(session_id, participant_id) do {:ok, %Session{participants: participants}} = get(session_id) participants |> Enum.find(fn %Participant{id: id} -> id == participant_id end) end def update_participant(session_id, participant), do: session_id |> call({:update, :participant, participant}) def delete_participant(session_id, participant_id), do: session_id |> call({:delete, :participant, participant_id}) def create_entry(session_id, entry) do session_id |> call({:create, :entry, entry}) end def update_entry(session_id, entry) do session_id |> call({:update, :entry, entry}) end def delete_entry(session_id, entry_id), do: session_id |> call({:delete, :entry, entry_id}) end
23.266667
91
0.600156
79133114af8dc0d5f92526e0e9ef908458aeb3c0
971
exs
Elixir
test/plsm_test.exs
aymiratech/Plsm
8488f06ab3f75666203ccc74ba34290b4c0725a2
[ "MIT" ]
null
null
null
test/plsm_test.exs
aymiratech/Plsm
8488f06ab3f75666203ccc74ba34290b4c0725a2
[ "MIT" ]
null
null
null
test/plsm_test.exs
aymiratech/Plsm
8488f06ab3f75666203ccc74ba34290b4c0725a2
[ "MIT" ]
1
2021-02-10T00:48:58.000Z
2021-02-10T00:48:58.000Z
defmodule PlsmTest do use ExUnit.Case @schema_dir "lib/test_temp/schemas/" describe "plsm task using postgres" do setup do Application.put_env(:plsm, :server, "localhost") Application.put_env(:plsm, :port, "5432") Application.put_env(:plsm, :database_name, "OnTarget") Application.put_env(:plsm, :prefix, "aym_security") Application.put_env(:plsm, :username, "postgres") Application.put_env(:plsm, :password, "5Point_0") Application.put_env(:plsm, :type, :postgres) Application.put_env(:plsm, :module_name, "Aymira.AymSecurity") Application.put_env(:plsm, :destination, @schema_dir) File.ls!("#{@schema_dir}") |> Enum.filter(fn file -> !String.starts_with?(file, ".") end) |> Enum.each(fn file -> File.rm!(file) end) :ok end test "schema files are generated and can compile" do Mix.Tasks.Plsm.run([]) assert :ok == IEx.Helpers.recompile() end end end
30.34375
68
0.651905
7913495d3c4b2d5aaf52eb4e495e89911e4390b1
1,273
ex
Elixir
lib/credo/check/consistency/line_endings.ex
sevenseacat/credo
48837401040d9c2340b5fb9c7d786d31f89f6426
[ "MIT" ]
1
2020-01-31T10:23:37.000Z
2020-01-31T10:23:37.000Z
lib/credo/check/consistency/line_endings.ex
sevenseacat/credo
48837401040d9c2340b5fb9c7d786d31f89f6426
[ "MIT" ]
null
null
null
lib/credo/check/consistency/line_endings.ex
sevenseacat/credo
48837401040d9c2340b5fb9c7d786d31f89f6426
[ "MIT" ]
null
null
null
defmodule Credo.Check.Consistency.LineEndings do @moduledoc """ Windows and *nix systems use different line-endings in files. While this is not necessarily a concern for the correctness of your code, you should use a consistent style throughout your codebase. """ @explanation [check: @moduledoc] @code_patterns [ Credo.Check.Consistency.LineEndings.Unix, Credo.Check.Consistency.LineEndings.Windows ] alias Credo.Check.Consistency.Helper alias Credo.Check.PropertyValue use Credo.Check, run_on_all: true, base_priority: :high @doc false def run(source_files, params \\ []) when is_list(source_files) do source_files |> Helper.run_code_patterns(@code_patterns, params) |> Helper.append_issues_via_issue_service(&issue_for/5, params) :ok end defp issue_for(_issue_meta, _actual_props, nil, _picked_count, _total_count), do: nil defp issue_for(_issue_meta, [], _expected_prop, _picked_count, _total_count), do: nil defp issue_for(issue_meta, actual_prop, expected_prop, _picked_count, _total_count) do actual_prop = PropertyValue.get(actual_prop) format_issue issue_meta, message: "File is using #{actual_prop} line endings while most of the files use #{expected_prop} line endings." end end
32.641026
117
0.755695
791352d6c3e051d80339caaa6f76b28d3b7c82d7
14,997
ex
Elixir
lib/elixir/lib/record.ex
basdirks/elixir
2cb058ba32e410e8ea073970ef52d6476ef7b4d3
[ "Apache-2.0" ]
1
2018-08-08T12:15:48.000Z
2018-08-08T12:15:48.000Z
lib/elixir/lib/record.ex
basdirks/elixir
2cb058ba32e410e8ea073970ef52d6476ef7b4d3
[ "Apache-2.0" ]
1
2018-09-10T23:36:45.000Z
2018-09-10T23:36:45.000Z
lib/elixir/lib/record.ex
basdirks/elixir
2cb058ba32e410e8ea073970ef52d6476ef7b4d3
[ "Apache-2.0" ]
1
2018-09-10T23:32:56.000Z
2018-09-10T23:32:56.000Z
defmodule Record do @moduledoc """ Module to work with, define, and import records. Records are simply tuples where the first element is an atom: iex> Record.is_record({User, "john", 27}) true This module provides conveniences for working with records at compilation time, where compile-time field names are used to manipulate the tuples, providing fast operations on top of the tuples' compact structure. In Elixir, records are used mostly in two situations: 1. to work with short, internal data 2. to interface with Erlang records The macros `defrecord/3` and `defrecordp/3` can be used to create records while `extract/2` and `extract_all/1` can be used to extract records from Erlang files. ## Types Types can be defined for tuples with the `record/2` macro (only available in typespecs). This macro will expand to a tuple as seen in the example below: defmodule MyModule do require Record Record.defrecord(:user, name: "john", age: 25) @type user :: record(:user, name: String.t(), age: integer) # expands to: "@type user :: {:user, String.t(), integer}" end """ @doc """ Extracts record information from an Erlang file. Returns a quoted expression containing the fields as a list of tuples. `name`, which is the name of the extracted record, is expected to be an atom *at compile time*. ## Options This function accepts the following options, which are exclusive to each other (i.e., only one of them can be used in the same call): * `:from` - (binary representing a path to a file) path to the Erlang file that contains the record definition to extract; with this option, this function uses the same path lookup used by the `-include` attribute used in Erlang modules. * `:from_lib` - (binary representing a path to a file) path to the Erlang file that contains the record definition to extract; with this option, this function uses the same path lookup used by the `-include_lib` attribute used in Erlang modules. * `:includes` - (a list of directories as binaries) if the record being extracted depends on relative includes, this option allows developers to specify the directory those relative includes exist * `:macros` - (keyword list of macro names and values) if the record being extract depends on the values of macros, this option allows the value of those macros to be set These options are expected to be literals (including the binary values) at compile time. ## Examples iex> Record.extract(:file_info, from_lib: "kernel/include/file.hrl") [ size: :undefined, type: :undefined, access: :undefined, atime: :undefined, mtime: :undefined, ctime: :undefined, mode: :undefined, links: :undefined, major_device: :undefined, minor_device: :undefined, inode: :undefined, uid: :undefined, gid: :undefined ] """ @spec extract(name :: atom, keyword) :: keyword def extract(name, opts) when is_atom(name) and is_list(opts) do Record.Extractor.extract(name, opts) end @doc """ Extracts all records information from an Erlang file. Returns a keyword list of `{record_name, fields}` tuples where `record_name` is the name of an extracted record and `fields` is a list of `{field, value}` tuples representing the fields for that record. ## Options This function accepts the following options, which are exclusive to each other (i.e., only one of them can be used in the same call): * `:from` - (binary representing a path to a file) path to the Erlang file that contains the record definitions to extract; with this option, this function uses the same path lookup used by the `-include` attribute used in Erlang modules. * `:from_lib` - (binary representing a path to a file) path to the Erlang file that contains the record definitions to extract; with this option, this function uses the same path lookup used by the `-include_lib` attribute used in Erlang modules. These options are expected to be literals (including the binary values) at compile time. """ @spec extract_all(keyword) :: [{name :: atom, keyword}] def extract_all(opts) when is_list(opts) do Record.Extractor.extract_all(opts) end @doc """ Checks if the given `data` is a record of kind `kind`. This is implemented as a macro so it can be used in guard clauses. ## Examples iex> record = {User, "john", 27} iex> Record.is_record(record, User) true """ defguard is_record(data, kind) when is_atom(kind) and is_tuple(data) and tuple_size(data) > 0 and elem(data, 0) == kind @doc """ Checks if the given `data` is a record. This is implemented as a macro so it can be used in guard clauses. ## Examples iex> record = {User, "john", 27} iex> Record.is_record(record) true iex> tuple = {} iex> Record.is_record(tuple) false """ defguard is_record(data) when is_tuple(data) and tuple_size(data) > 0 and is_atom(elem(data, 0)) @doc """ Defines a set of macros to create, access, and pattern match on a record. The name of the generated macros will be `name` (which has to be an atom). `tag` is also an atom and is used as the "tag" for the record (i.e., the first element of the record tuple); by default (if `nil`), it's the same as `name`. `kv` is a keyword list of `name: default_value` fields for the new record. The following macros are generated: * `name/0` to create a new record with default values for all fields * `name/1` to create a new record with the given fields and values, to get the zero-based index of the given field in a record or to convert the given record to a keyword list * `name/2` to update an existing record with the given fields and values or to access a given field in a given record All these macros are public macros (as defined by `defmacro`). See the "Examples" section for examples on how to use these macros. ## Examples defmodule User do require Record Record.defrecord(:user, name: "meg", age: "25") end In the example above, a set of macros named `user` but with different arities will be defined to manipulate the underlying record. # Import the module to make the user macros locally available import User # To create records record = user() #=> {:user, "meg", 25} record = user(age: 26) #=> {:user, "meg", 26} # To get a field from the record user(record, :name) #=> "meg" # To update the record user(record, age: 26) #=> {:user, "meg", 26} # To get the zero-based index of the field in record tuple # (index 0 is occupied by the record "tag") user(:name) #=> 1 # Convert a record to a keyword list user(record) #=> [name: "meg", age: 26] The generated macros can also be used in order to pattern match on records and to bind variables during the match: record = user() #=> {:user, "meg", 25} user(name: name) = record name #=> "meg" By default, Elixir uses the record name as the first element of the tuple (the "tag"). However, a different tag can be specified when defining a record, as in the following example, in which we use `Customer` as the second argument of `defrecord/3`: defmodule User do require Record Record.defrecord(:user, Customer, name: nil) end require User User.user() #=> {Customer, nil} ## Defining extracted records with anonymous functions in the values If a record defines an anonymous function in the default values, an `ArgumentError` will be raised. This can happen unintentionally when defining a record after extracting it from an Erlang library that uses anonymous functions for defaults. Record.defrecord(:my_rec, Record.extract(...)) #=> ** (ArgumentError) invalid value for record field fun_field, #=> cannot escape #Function<12.90072148/2 in :erl_eval.expr/5>. To work around this error, redefine the field with your own &M.f/a function, like so: defmodule MyRec do require Record Record.defrecord(:my_rec, Record.extract(...) |> Keyword.merge(fun_field: &__MODULE__.foo/2)) def foo(bar, baz), do: IO.inspect({bar, baz}) end """ defmacro defrecord(name, tag \\ nil, kv) do quote bind_quoted: [name: name, tag: tag, kv: kv] do tag = tag || name fields = Record.__fields__(:defrecord, kv) defmacro unquote(name)(args \\ []) do Record.__access__(unquote(tag), unquote(fields), args, __CALLER__) end defmacro unquote(name)(record, args) do Record.__access__(unquote(tag), unquote(fields), record, args, __CALLER__) end end end @doc """ Same as `defrecord/3` but generates private macros. """ defmacro defrecordp(name, tag \\ nil, kv) do quote bind_quoted: [name: name, tag: tag, kv: kv] do tag = tag || name fields = Record.__fields__(:defrecordp, kv) defmacrop unquote(name)(args \\ []) do Record.__access__(unquote(tag), unquote(fields), args, __CALLER__) end defmacrop unquote(name)(record, args) do Record.__access__(unquote(tag), unquote(fields), record, args, __CALLER__) end end end # Normalizes of record fields to have default values. @doc false def __fields__(type, fields) do normalizer_fun = fn {key, value} when is_atom(key) -> try do Macro.escape(value) rescue e in [ArgumentError] -> raise ArgumentError, "invalid value for record field #{key}, " <> Exception.message(e) else value -> {key, value} end key when is_atom(key) -> {key, nil} other -> raise ArgumentError, "#{type} fields must be atoms, got: #{inspect(other)}" end :lists.map(normalizer_fun, fields) end # Callback invoked from record/0 and record/1 macros. @doc false def __access__(tag, fields, args, caller) do cond do is_atom(args) -> index(tag, fields, args) Keyword.keyword?(args) -> create(tag, fields, args, caller) true -> fields = Macro.escape(fields) case Macro.expand(args, caller) do {:{}, _, [^tag | list]} when length(list) == length(fields) -> record = List.to_tuple([tag | list]) Record.__keyword__(tag, fields, record) {^tag, arg} when length(fields) == 1 -> Record.__keyword__(tag, fields, {tag, arg}) _ -> quote(do: Record.__keyword__(unquote(tag), unquote(fields), unquote(args))) end end end # Callback invoked from the record/2 macro. @doc false def __access__(tag, fields, record, args, caller) do cond do is_atom(args) -> get(tag, fields, record, args) Keyword.keyword?(args) -> update(tag, fields, record, args, caller) true -> raise ArgumentError, "expected arguments to be a compile time atom or a keyword list, got: " <> Macro.to_string(args) end end # Gets the index of field. defp index(tag, fields, field) do if index = find_index(fields, field, 0) do # Convert to Elixir index index - 1 else raise ArgumentError, "record #{inspect(tag)} does not have the key: #{inspect(field)}" end end # Creates a new record with the given default fields and keyword values. defp create(tag, fields, keyword, caller) do in_match = Macro.Env.in_match?(caller) keyword = apply_underscore(fields, keyword) {match, remaining} = Enum.map_reduce(fields, keyword, fn {field, default}, each_keyword -> new_fields = case Keyword.fetch(each_keyword, field) do {:ok, value} -> value :error when in_match -> {:_, [], nil} :error -> Macro.escape(default) end {new_fields, Keyword.delete(each_keyword, field)} end) case remaining do [] -> {:{}, [], [tag | match]} _ -> keys = for {key, _} <- remaining, do: key raise ArgumentError, "record #{inspect(tag)} does not have the key: #{inspect(hd(keys))}" end end # Updates a record given by var with the given keyword. defp update(tag, fields, var, keyword, caller) do if Macro.Env.in_match?(caller) do raise ArgumentError, "cannot invoke update style macro inside match" end keyword = apply_underscore(fields, keyword) Enum.reduce(keyword, var, fn {key, value}, acc -> index = find_index(fields, key, 0) if index do quote do :erlang.setelement(unquote(index), unquote(acc), unquote(value)) end else raise ArgumentError, "record #{inspect(tag)} does not have the key: #{inspect(key)}" end end) end # Gets a record key from the given var. defp get(tag, fields, var, key) do index = find_index(fields, key, 0) if index do quote do :erlang.element(unquote(index), unquote(var)) end else raise ArgumentError, "record #{inspect(tag)} does not have the key: #{inspect(key)}" end end defp find_index([{k, _} | _], k, i), do: i + 2 defp find_index([{_, _} | t], k, i), do: find_index(t, k, i + 1) defp find_index([], _k, _i), do: nil # Returns a keyword list of the record @doc false def __keyword__(tag, fields, record) do if is_record(record, tag) do [_tag | values] = Tuple.to_list(record) case join_keyword(fields, values, []) do kv when is_list(kv) -> kv expected_fields -> raise ArgumentError, "expected argument to be a #{inspect(tag)} record with " <> "#{expected_fields} fields, got: " <> inspect(record) end else raise ArgumentError, "expected argument to be a literal atom, literal keyword or " <> "a #{inspect(tag)} record, got runtime: " <> inspect(record) end end # Returns a keyword list, or expected number of fields on size mismatch defp join_keyword([{field, _default} | fields], [value | values], acc), do: join_keyword(fields, values, [{field, value} | acc]) defp join_keyword([], [], acc), do: :lists.reverse(acc) defp join_keyword(rest_fields, _rest_values, acc), do: length(acc) + length(rest_fields) defp apply_underscore(fields, keyword) do case Keyword.fetch(keyword, :_) do {:ok, default} -> fields |> Enum.map(fn {k, _} -> {k, default} end) |> Keyword.merge(keyword) |> Keyword.delete(:_) :error -> keyword end end end
31.639241
101
0.639861
79135818e4e6392f5d1733a1c41b5fb1d5464ea0
365,956
ex
Elixir
lib/openflow/enums.ex
shun159/tres
1e3e7f78ba1aa4f184d4be70300e5f4703d50a2f
[ "Beerware" ]
5
2019-05-25T02:25:13.000Z
2020-10-06T17:00:03.000Z
lib/openflow/enums.ex
shun159/tres
1e3e7f78ba1aa4f184d4be70300e5f4703d50a2f
[ "Beerware" ]
5
2018-03-29T14:42:10.000Z
2019-11-19T07:03:09.000Z
lib/openflow/enums.ex
shun159/tres
1e3e7f78ba1aa4f184d4be70300e5f4703d50a2f
[ "Beerware" ]
1
2019-03-30T20:48:27.000Z
2019-03-30T20:48:27.000Z
defmodule Openflow.Enums do @moduledoc "auto generated code" def to_int(Openflow.Hello, :openflow_codec) do openflow_codec_to_int(Openflow.Hello) catch _class, _reason -> Openflow.Hello end def to_int(Openflow.ErrorMsg, :openflow_codec) do openflow_codec_to_int(Openflow.ErrorMsg) catch _class, _reason -> Openflow.ErrorMsg end def to_int(Openflow.Echo.Request, :openflow_codec) do openflow_codec_to_int(Openflow.Echo.Request) catch _class, _reason -> Openflow.Echo.Request end def to_int(Openflow.Echo.Reply, :openflow_codec) do openflow_codec_to_int(Openflow.Echo.Reply) catch _class, _reason -> Openflow.Echo.Reply end def to_int(Openflow.Experimenter, :openflow_codec) do openflow_codec_to_int(Openflow.Experimenter) catch _class, _reason -> Openflow.Experimenter end def to_int(Openflow.Features.Request, :openflow_codec) do openflow_codec_to_int(Openflow.Features.Request) catch _class, _reason -> Openflow.Features.Request end def to_int(Openflow.Features.Reply, :openflow_codec) do openflow_codec_to_int(Openflow.Features.Reply) catch _class, _reason -> Openflow.Features.Reply end def to_int(Openflow.GetConfig.Request, :openflow_codec) do openflow_codec_to_int(Openflow.GetConfig.Request) catch _class, _reason -> Openflow.GetConfig.Request end def to_int(Openflow.GetConfig.Reply, :openflow_codec) do openflow_codec_to_int(Openflow.GetConfig.Reply) catch _class, _reason -> Openflow.GetConfig.Reply end def to_int(Openflow.SetConfig, :openflow_codec) do openflow_codec_to_int(Openflow.SetConfig) catch _class, _reason -> Openflow.SetConfig end def to_int(Openflow.PacketIn, :openflow_codec) do openflow_codec_to_int(Openflow.PacketIn) catch _class, _reason -> Openflow.PacketIn end def to_int(Openflow.FlowRemoved, :openflow_codec) do openflow_codec_to_int(Openflow.FlowRemoved) catch _class, _reason -> Openflow.FlowRemoved end def to_int(Openflow.PortStatus, :openflow_codec) do openflow_codec_to_int(Openflow.PortStatus) catch _class, _reason -> Openflow.PortStatus end def to_int(Openflow.PacketOut, :openflow_codec) do openflow_codec_to_int(Openflow.PacketOut) catch _class, _reason -> Openflow.PacketOut end def to_int(Openflow.FlowMod, :openflow_codec) do openflow_codec_to_int(Openflow.FlowMod) catch _class, _reason -> Openflow.FlowMod end def to_int(Openflow.GroupMod, :openflow_codec) do openflow_codec_to_int(Openflow.GroupMod) catch _class, _reason -> Openflow.GroupMod end def to_int(Openflow.PortMod, :openflow_codec) do openflow_codec_to_int(Openflow.PortMod) catch _class, _reason -> Openflow.PortMod end def to_int(Openflow.TableMod, :openflow_codec) do openflow_codec_to_int(Openflow.TableMod) catch _class, _reason -> Openflow.TableMod end def to_int(Openflow.Multipart.Request, :openflow_codec) do openflow_codec_to_int(Openflow.Multipart.Request) catch _class, _reason -> Openflow.Multipart.Request end def to_int(Openflow.Multipart.Reply, :openflow_codec) do openflow_codec_to_int(Openflow.Multipart.Reply) catch _class, _reason -> Openflow.Multipart.Reply end def to_int(Openflow.Barrier.Request, :openflow_codec) do openflow_codec_to_int(Openflow.Barrier.Request) catch _class, _reason -> Openflow.Barrier.Request end def to_int(Openflow.Barrier.Reply, :openflow_codec) do openflow_codec_to_int(Openflow.Barrier.Reply) catch _class, _reason -> Openflow.Barrier.Reply end def to_int(Openflow.Role.Request, :openflow_codec) do openflow_codec_to_int(Openflow.Role.Request) catch _class, _reason -> Openflow.Role.Request end def to_int(Openflow.Role.Reply, :openflow_codec) do openflow_codec_to_int(Openflow.Role.Reply) catch _class, _reason -> Openflow.Role.Reply end def to_int(Openflow.GetAsync.Request, :openflow_codec) do openflow_codec_to_int(Openflow.GetAsync.Request) catch _class, _reason -> Openflow.GetAsync.Request end def to_int(Openflow.GetAsync.Reply, :openflow_codec) do openflow_codec_to_int(Openflow.GetAsync.Reply) catch _class, _reason -> Openflow.GetAsync.Reply end def to_int(Openflow.SetAsync, :openflow_codec) do openflow_codec_to_int(Openflow.SetAsync) catch _class, _reason -> Openflow.SetAsync end def to_int(Openflow.MeterMod, :openflow_codec) do openflow_codec_to_int(Openflow.MeterMod) catch _class, _reason -> Openflow.MeterMod end def to_int(_int, :openflow_codec) do throw(:bad_enum) end def to_int(:nicira_ext_message, :experimenter_id) do experimenter_id_to_int(:nicira_ext_message) catch _class, _reason -> :nicira_ext_message end def to_int(:onf_ext_message, :experimenter_id) do experimenter_id_to_int(:onf_ext_message) catch _class, _reason -> :onf_ext_message end def to_int(_int, :experimenter_id) do throw(:bad_enum) end def to_int(Openflow.NxSetPacketInFormat, :nicira_ext_message) do nicira_ext_message_to_int(Openflow.NxSetPacketInFormat) catch _class, _reason -> Openflow.NxSetPacketInFormat end def to_int(Openflow.NxSetControllerId, :nicira_ext_message) do nicira_ext_message_to_int(Openflow.NxSetControllerId) catch _class, _reason -> Openflow.NxSetControllerId end def to_int(Openflow.NxFlowMonitor.Cancel, :nicira_ext_message) do nicira_ext_message_to_int(Openflow.NxFlowMonitor.Cancel) catch _class, _reason -> Openflow.NxFlowMonitor.Cancel end def to_int(Openflow.NxFlowMonitor.Paused, :nicira_ext_message) do nicira_ext_message_to_int(Openflow.NxFlowMonitor.Paused) catch _class, _reason -> Openflow.NxFlowMonitor.Paused end def to_int(Openflow.NxFlowMonitor.Resumed, :nicira_ext_message) do nicira_ext_message_to_int(Openflow.NxFlowMonitor.Resumed) catch _class, _reason -> Openflow.NxFlowMonitor.Resumed end def to_int(Openflow.NxTLVTableMod, :nicira_ext_message) do nicira_ext_message_to_int(Openflow.NxTLVTableMod) catch _class, _reason -> Openflow.NxTLVTableMod end def to_int(Openflow.NxTLVTable.Request, :nicira_ext_message) do nicira_ext_message_to_int(Openflow.NxTLVTable.Request) catch _class, _reason -> Openflow.NxTLVTable.Request end def to_int(Openflow.NxTLVTable.Reply, :nicira_ext_message) do nicira_ext_message_to_int(Openflow.NxTLVTable.Reply) catch _class, _reason -> Openflow.NxTLVTable.Reply end def to_int(Openflow.NxSetAsyncConfig2, :nicira_ext_message) do nicira_ext_message_to_int(Openflow.NxSetAsyncConfig2) catch _class, _reason -> Openflow.NxSetAsyncConfig2 end def to_int(Openflow.NxResume, :nicira_ext_message) do nicira_ext_message_to_int(Openflow.NxResume) catch _class, _reason -> Openflow.NxResume end def to_int(Openflow.NxCtFlushZone, :nicira_ext_message) do nicira_ext_message_to_int(Openflow.NxCtFlushZone) catch _class, _reason -> Openflow.NxCtFlushZone end def to_int(Openflow.NxPacketIn2, :nicira_ext_message) do nicira_ext_message_to_int(Openflow.NxPacketIn2) catch _class, _reason -> Openflow.NxPacketIn2 end def to_int(_int, :nicira_ext_message) do throw(:bad_enum) end def to_int(Openflow.OnfBundleControl, :onf_ext_message) do onf_ext_message_to_int(Openflow.OnfBundleControl) catch _class, _reason -> Openflow.OnfBundleControl end def to_int(Openflow.OnfBundleAddMessage, :onf_ext_message) do onf_ext_message_to_int(Openflow.OnfBundleAddMessage) catch _class, _reason -> Openflow.OnfBundleAddMessage end def to_int(_int, :onf_ext_message) do throw(:bad_enum) end def to_int(:more, :multipart_request_flags) do multipart_request_flags_to_int(:more) catch _class, _reason -> :more end def to_int(_int, :multipart_request_flags) do throw(:bad_enum) end def to_int(:more, :multipart_reply_flags) do multipart_reply_flags_to_int(:more) catch _class, _reason -> :more end def to_int(_int, :multipart_reply_flags) do throw(:bad_enum) end def to_int(Openflow.Multipart.Desc.Request, :multipart_request_codec) do multipart_request_codec_to_int(Openflow.Multipart.Desc.Request) catch _class, _reason -> Openflow.Multipart.Desc.Request end def to_int(Openflow.Multipart.Flow.Request, :multipart_request_codec) do multipart_request_codec_to_int(Openflow.Multipart.Flow.Request) catch _class, _reason -> Openflow.Multipart.Flow.Request end def to_int(Openflow.Multipart.Aggregate.Request, :multipart_request_codec) do multipart_request_codec_to_int(Openflow.Multipart.Aggregate.Request) catch _class, _reason -> Openflow.Multipart.Aggregate.Request end def to_int(Openflow.Multipart.Table.Request, :multipart_request_codec) do multipart_request_codec_to_int(Openflow.Multipart.Table.Request) catch _class, _reason -> Openflow.Multipart.Table.Request end def to_int(Openflow.Multipart.Port.Request, :multipart_request_codec) do multipart_request_codec_to_int(Openflow.Multipart.Port.Request) catch _class, _reason -> Openflow.Multipart.Port.Request end def to_int(Openflow.Multipart.Queue.Request, :multipart_request_codec) do multipart_request_codec_to_int(Openflow.Multipart.Queue.Request) catch _class, _reason -> Openflow.Multipart.Queue.Request end def to_int(Openflow.Multipart.Group.Request, :multipart_request_codec) do multipart_request_codec_to_int(Openflow.Multipart.Group.Request) catch _class, _reason -> Openflow.Multipart.Group.Request end def to_int(Openflow.Multipart.GroupDesc.Request, :multipart_request_codec) do multipart_request_codec_to_int(Openflow.Multipart.GroupDesc.Request) catch _class, _reason -> Openflow.Multipart.GroupDesc.Request end def to_int(Openflow.Multipart.GroupFeatures.Request, :multipart_request_codec) do multipart_request_codec_to_int(Openflow.Multipart.GroupFeatures.Request) catch _class, _reason -> Openflow.Multipart.GroupFeatures.Request end def to_int(Openflow.Multipart.Meter.Request, :multipart_request_codec) do multipart_request_codec_to_int(Openflow.Multipart.Meter.Request) catch _class, _reason -> Openflow.Multipart.Meter.Request end def to_int(Openflow.Multipart.MeterConfig.Request, :multipart_request_codec) do multipart_request_codec_to_int(Openflow.Multipart.MeterConfig.Request) catch _class, _reason -> Openflow.Multipart.MeterConfig.Request end def to_int(Openflow.Multipart.MeterFeatures.Request, :multipart_request_codec) do multipart_request_codec_to_int(Openflow.Multipart.MeterFeatures.Request) catch _class, _reason -> Openflow.Multipart.MeterFeatures.Request end def to_int(Openflow.Multipart.TableFeatures.Request, :multipart_request_codec) do multipart_request_codec_to_int(Openflow.Multipart.TableFeatures.Request) catch _class, _reason -> Openflow.Multipart.TableFeatures.Request end def to_int(Openflow.Multipart.PortDesc.Request, :multipart_request_codec) do multipart_request_codec_to_int(Openflow.Multipart.PortDesc.Request) catch _class, _reason -> Openflow.Multipart.PortDesc.Request end def to_int(Openflow.Multipart.Experimenter.Request, :multipart_request_codec) do multipart_request_codec_to_int(Openflow.Multipart.Experimenter.Request) catch _class, _reason -> Openflow.Multipart.Experimenter.Request end def to_int(_int, :multipart_request_codec) do throw(:bad_enum) end def to_int(Openflow.Multipart.Desc.Reply, :multipart_reply_codec) do multipart_reply_codec_to_int(Openflow.Multipart.Desc.Reply) catch _class, _reason -> Openflow.Multipart.Desc.Reply end def to_int(Openflow.Multipart.Flow.Reply, :multipart_reply_codec) do multipart_reply_codec_to_int(Openflow.Multipart.Flow.Reply) catch _class, _reason -> Openflow.Multipart.Flow.Reply end def to_int(Openflow.Multipart.Aggregate.Reply, :multipart_reply_codec) do multipart_reply_codec_to_int(Openflow.Multipart.Aggregate.Reply) catch _class, _reason -> Openflow.Multipart.Aggregate.Reply end def to_int(Openflow.Multipart.Table.Reply, :multipart_reply_codec) do multipart_reply_codec_to_int(Openflow.Multipart.Table.Reply) catch _class, _reason -> Openflow.Multipart.Table.Reply end def to_int(Openflow.Multipart.Port.Reply, :multipart_reply_codec) do multipart_reply_codec_to_int(Openflow.Multipart.Port.Reply) catch _class, _reason -> Openflow.Multipart.Port.Reply end def to_int(Openflow.Multipart.Queue.Reply, :multipart_reply_codec) do multipart_reply_codec_to_int(Openflow.Multipart.Queue.Reply) catch _class, _reason -> Openflow.Multipart.Queue.Reply end def to_int(Openflow.Multipart.Group.Reply, :multipart_reply_codec) do multipart_reply_codec_to_int(Openflow.Multipart.Group.Reply) catch _class, _reason -> Openflow.Multipart.Group.Reply end def to_int(Openflow.Multipart.GroupDesc.Reply, :multipart_reply_codec) do multipart_reply_codec_to_int(Openflow.Multipart.GroupDesc.Reply) catch _class, _reason -> Openflow.Multipart.GroupDesc.Reply end def to_int(Openflow.Multipart.GroupFeatures.Reply, :multipart_reply_codec) do multipart_reply_codec_to_int(Openflow.Multipart.GroupFeatures.Reply) catch _class, _reason -> Openflow.Multipart.GroupFeatures.Reply end def to_int(Openflow.Multipart.Meter.Reply, :multipart_reply_codec) do multipart_reply_codec_to_int(Openflow.Multipart.Meter.Reply) catch _class, _reason -> Openflow.Multipart.Meter.Reply end def to_int(Openflow.Multipart.MeterConfig.Reply, :multipart_reply_codec) do multipart_reply_codec_to_int(Openflow.Multipart.MeterConfig.Reply) catch _class, _reason -> Openflow.Multipart.MeterConfig.Reply end def to_int(Openflow.Multipart.MeterFeatures.Reply, :multipart_reply_codec) do multipart_reply_codec_to_int(Openflow.Multipart.MeterFeatures.Reply) catch _class, _reason -> Openflow.Multipart.MeterFeatures.Reply end def to_int(Openflow.Multipart.TableFeatures.Reply, :multipart_reply_codec) do multipart_reply_codec_to_int(Openflow.Multipart.TableFeatures.Reply) catch _class, _reason -> Openflow.Multipart.TableFeatures.Reply end def to_int(Openflow.Multipart.PortDesc.Reply, :multipart_reply_codec) do multipart_reply_codec_to_int(Openflow.Multipart.PortDesc.Reply) catch _class, _reason -> Openflow.Multipart.PortDesc.Reply end def to_int(Openflow.Multipart.Experimenter.Reply, :multipart_reply_codec) do multipart_reply_codec_to_int(Openflow.Multipart.Experimenter.Reply) catch _class, _reason -> Openflow.Multipart.Experimenter.Reply end def to_int(_int, :multipart_reply_codec) do throw(:bad_enum) end def to_int(Openflow.Multipart.NxFlow, :nicira_ext_stats) do nicira_ext_stats_to_int(Openflow.Multipart.NxFlow) catch _class, _reason -> Openflow.Multipart.NxFlow end def to_int(Openflow.Multipart.NxAggregate, :nicira_ext_stats) do nicira_ext_stats_to_int(Openflow.Multipart.NxAggregate) catch _class, _reason -> Openflow.Multipart.NxAggregate end def to_int(Openflow.Multipart.NxFlowMonitor, :nicira_ext_stats) do nicira_ext_stats_to_int(Openflow.Multipart.NxFlowMonitor) catch _class, _reason -> Openflow.Multipart.NxFlowMonitor end def to_int(Openflow.Multipart.NxIPFIXBridge, :nicira_ext_stats) do nicira_ext_stats_to_int(Openflow.Multipart.NxIPFIXBridge) catch _class, _reason -> Openflow.Multipart.NxIPFIXBridge end def to_int(Openflow.Multipart.NxIPFIXFlow, :nicira_ext_stats) do nicira_ext_stats_to_int(Openflow.Multipart.NxIPFIXFlow) catch _class, _reason -> Openflow.Multipart.NxIPFIXFlow end def to_int(_int, :nicira_ext_stats) do throw(:bad_enum) end def to_int(:versionbitmap, :hello_elem) do hello_elem_to_int(:versionbitmap) catch _class, _reason -> :versionbitmap end def to_int(_int, :hello_elem) do throw(:bad_enum) end def to_int(:hello_failed, :error_type) do error_type_to_int(:hello_failed) catch _class, _reason -> :hello_failed end def to_int(:bad_request, :error_type) do error_type_to_int(:bad_request) catch _class, _reason -> :bad_request end def to_int(:bad_action, :error_type) do error_type_to_int(:bad_action) catch _class, _reason -> :bad_action end def to_int(:bad_instruction, :error_type) do error_type_to_int(:bad_instruction) catch _class, _reason -> :bad_instruction end def to_int(:bad_match, :error_type) do error_type_to_int(:bad_match) catch _class, _reason -> :bad_match end def to_int(:flow_mod_failed, :error_type) do error_type_to_int(:flow_mod_failed) catch _class, _reason -> :flow_mod_failed end def to_int(:group_mod_failed, :error_type) do error_type_to_int(:group_mod_failed) catch _class, _reason -> :group_mod_failed end def to_int(:port_mod_failed, :error_type) do error_type_to_int(:port_mod_failed) catch _class, _reason -> :port_mod_failed end def to_int(:table_mod_failed, :error_type) do error_type_to_int(:table_mod_failed) catch _class, _reason -> :table_mod_failed end def to_int(:queue_op_failed, :error_type) do error_type_to_int(:queue_op_failed) catch _class, _reason -> :queue_op_failed end def to_int(:switch_config_failed, :error_type) do error_type_to_int(:switch_config_failed) catch _class, _reason -> :switch_config_failed end def to_int(:role_request_failed, :error_type) do error_type_to_int(:role_request_failed) catch _class, _reason -> :role_request_failed end def to_int(:meter_mod_failed, :error_type) do error_type_to_int(:meter_mod_failed) catch _class, _reason -> :meter_mod_failed end def to_int(:table_features_failed, :error_type) do error_type_to_int(:table_features_failed) catch _class, _reason -> :table_features_failed end def to_int(:experimenter, :error_type) do error_type_to_int(:experimenter) catch _class, _reason -> :experimenter end def to_int(_int, :error_type) do throw(:bad_enum) end def to_int(:inconpatible, :hello_failed) do hello_failed_to_int(:inconpatible) catch _class, _reason -> :inconpatible end def to_int(:eperm, :hello_failed) do hello_failed_to_int(:eperm) catch _class, _reason -> :eperm end def to_int(_int, :hello_failed) do throw(:bad_enum) end def to_int(:bad_version, :bad_request) do bad_request_to_int(:bad_version) catch _class, _reason -> :bad_version end def to_int(:bad_type, :bad_request) do bad_request_to_int(:bad_type) catch _class, _reason -> :bad_type end def to_int(:bad_multipart, :bad_request) do bad_request_to_int(:bad_multipart) catch _class, _reason -> :bad_multipart end def to_int(:bad_experimeter, :bad_request) do bad_request_to_int(:bad_experimeter) catch _class, _reason -> :bad_experimeter end def to_int(:bad_exp_type, :bad_request) do bad_request_to_int(:bad_exp_type) catch _class, _reason -> :bad_exp_type end def to_int(:eperm, :bad_request) do bad_request_to_int(:eperm) catch _class, _reason -> :eperm end def to_int(:bad_len, :bad_request) do bad_request_to_int(:bad_len) catch _class, _reason -> :bad_len end def to_int(:buffer_empty, :bad_request) do bad_request_to_int(:buffer_empty) catch _class, _reason -> :buffer_empty end def to_int(:buffer_unknown, :bad_request) do bad_request_to_int(:buffer_unknown) catch _class, _reason -> :buffer_unknown end def to_int(:bad_table_id, :bad_request) do bad_request_to_int(:bad_table_id) catch _class, _reason -> :bad_table_id end def to_int(:is_slave, :bad_request) do bad_request_to_int(:is_slave) catch _class, _reason -> :is_slave end def to_int(:bad_port, :bad_request) do bad_request_to_int(:bad_port) catch _class, _reason -> :bad_port end def to_int(:bad_packet, :bad_request) do bad_request_to_int(:bad_packet) catch _class, _reason -> :bad_packet end def to_int(:multipart_buffer_overflow, :bad_request) do bad_request_to_int(:multipart_buffer_overflow) catch _class, _reason -> :multipart_buffer_overflow end def to_int(:multipart_request_timeout, :bad_request) do bad_request_to_int(:multipart_request_timeout) catch _class, _reason -> :multipart_request_timeout end def to_int(:multipart_reply_timeout, :bad_request) do bad_request_to_int(:multipart_reply_timeout) catch _class, _reason -> :multipart_reply_timeout end def to_int(:nxm_invalid, :bad_request) do bad_request_to_int(:nxm_invalid) catch _class, _reason -> :nxm_invalid end def to_int(:nxm_bad_type, :bad_request) do bad_request_to_int(:nxm_bad_type) catch _class, _reason -> :nxm_bad_type end def to_int(:must_be_zero, :bad_request) do bad_request_to_int(:must_be_zero) catch _class, _reason -> :must_be_zero end def to_int(:bad_reason, :bad_request) do bad_request_to_int(:bad_reason) catch _class, _reason -> :bad_reason end def to_int(:flow_monitor_bad_event, :bad_request) do bad_request_to_int(:flow_monitor_bad_event) catch _class, _reason -> :flow_monitor_bad_event end def to_int(:undecodable_error, :bad_request) do bad_request_to_int(:undecodable_error) catch _class, _reason -> :undecodable_error end def to_int(:resume_not_supported, :bad_request) do bad_request_to_int(:resume_not_supported) catch _class, _reason -> :resume_not_supported end def to_int(:resume_stale, :bad_request) do bad_request_to_int(:resume_stale) catch _class, _reason -> :resume_stale end def to_int(_int, :bad_request) do throw(:bad_enum) end def to_int(:bad_type, :bad_action) do bad_action_to_int(:bad_type) catch _class, _reason -> :bad_type end def to_int(:bad_len, :bad_action) do bad_action_to_int(:bad_len) catch _class, _reason -> :bad_len end def to_int(:bad_experimeter, :bad_action) do bad_action_to_int(:bad_experimeter) catch _class, _reason -> :bad_experimeter end def to_int(:bad_exp_type, :bad_action) do bad_action_to_int(:bad_exp_type) catch _class, _reason -> :bad_exp_type end def to_int(:bad_out_port, :bad_action) do bad_action_to_int(:bad_out_port) catch _class, _reason -> :bad_out_port end def to_int(:bad_argument, :bad_action) do bad_action_to_int(:bad_argument) catch _class, _reason -> :bad_argument end def to_int(:eperm, :bad_action) do bad_action_to_int(:eperm) catch _class, _reason -> :eperm end def to_int(:too_many, :bad_action) do bad_action_to_int(:too_many) catch _class, _reason -> :too_many end def to_int(:bad_queue, :bad_action) do bad_action_to_int(:bad_queue) catch _class, _reason -> :bad_queue end def to_int(:bad_out_group, :bad_action) do bad_action_to_int(:bad_out_group) catch _class, _reason -> :bad_out_group end def to_int(:match_inconsistent, :bad_action) do bad_action_to_int(:match_inconsistent) catch _class, _reason -> :match_inconsistent end def to_int(:unsupported_order, :bad_action) do bad_action_to_int(:unsupported_order) catch _class, _reason -> :unsupported_order end def to_int(:bad_tag, :bad_action) do bad_action_to_int(:bad_tag) catch _class, _reason -> :bad_tag end def to_int(:bad_set_type, :bad_action) do bad_action_to_int(:bad_set_type) catch _class, _reason -> :bad_set_type end def to_int(:bad_set_len, :bad_action) do bad_action_to_int(:bad_set_len) catch _class, _reason -> :bad_set_len end def to_int(:bad_set_argument, :bad_action) do bad_action_to_int(:bad_set_argument) catch _class, _reason -> :bad_set_argument end def to_int(:must_be_zero, :bad_action) do bad_action_to_int(:must_be_zero) catch _class, _reason -> :must_be_zero end def to_int(:conntrack_datapath_support, :bad_action) do bad_action_to_int(:conntrack_datapath_support) catch _class, _reason -> :conntrack_datapath_support end def to_int(:bad_conjunction, :bad_action) do bad_action_to_int(:bad_conjunction) catch _class, _reason -> :bad_conjunction end def to_int(_int, :bad_action) do throw(:bad_enum) end def to_int(:unknown_instruction, :bad_instruction) do bad_instruction_to_int(:unknown_instruction) catch _class, _reason -> :unknown_instruction end def to_int(:unsupported_instruction, :bad_instruction) do bad_instruction_to_int(:unsupported_instruction) catch _class, _reason -> :unsupported_instruction end def to_int(:bad_table_id, :bad_instruction) do bad_instruction_to_int(:bad_table_id) catch _class, _reason -> :bad_table_id end def to_int(:unsupported_metadata, :bad_instruction) do bad_instruction_to_int(:unsupported_metadata) catch _class, _reason -> :unsupported_metadata end def to_int(:unsupported_metadata_mask, :bad_instruction) do bad_instruction_to_int(:unsupported_metadata_mask) catch _class, _reason -> :unsupported_metadata_mask end def to_int(:bad_experimeter, :bad_instruction) do bad_instruction_to_int(:bad_experimeter) catch _class, _reason -> :bad_experimeter end def to_int(:bad_exp_type, :bad_instruction) do bad_instruction_to_int(:bad_exp_type) catch _class, _reason -> :bad_exp_type end def to_int(:bad_len, :bad_instruction) do bad_instruction_to_int(:bad_len) catch _class, _reason -> :bad_len end def to_int(:eperm, :bad_instruction) do bad_instruction_to_int(:eperm) catch _class, _reason -> :eperm end def to_int(:dup_inst, :bad_instruction) do bad_instruction_to_int(:dup_inst) catch _class, _reason -> :dup_inst end def to_int(_int, :bad_instruction) do throw(:bad_enum) end def to_int(:bad_type, :bad_match) do bad_match_to_int(:bad_type) catch _class, _reason -> :bad_type end def to_int(:bad_len, :bad_match) do bad_match_to_int(:bad_len) catch _class, _reason -> :bad_len end def to_int(:bad_tag, :bad_match) do bad_match_to_int(:bad_tag) catch _class, _reason -> :bad_tag end def to_int(:bad_dl_addr_mask, :bad_match) do bad_match_to_int(:bad_dl_addr_mask) catch _class, _reason -> :bad_dl_addr_mask end def to_int(:bad_nw_addr_mask, :bad_match) do bad_match_to_int(:bad_nw_addr_mask) catch _class, _reason -> :bad_nw_addr_mask end def to_int(:bad_wildcards, :bad_match) do bad_match_to_int(:bad_wildcards) catch _class, _reason -> :bad_wildcards end def to_int(:bad_field, :bad_match) do bad_match_to_int(:bad_field) catch _class, _reason -> :bad_field end def to_int(:bad_value, :bad_match) do bad_match_to_int(:bad_value) catch _class, _reason -> :bad_value end def to_int(:bad_mask, :bad_match) do bad_match_to_int(:bad_mask) catch _class, _reason -> :bad_mask end def to_int(:bad_prereq, :bad_match) do bad_match_to_int(:bad_prereq) catch _class, _reason -> :bad_prereq end def to_int(:dup_field, :bad_match) do bad_match_to_int(:dup_field) catch _class, _reason -> :dup_field end def to_int(:eperm, :bad_match) do bad_match_to_int(:eperm) catch _class, _reason -> :eperm end def to_int(:conntrack_datapath_support, :bad_match) do bad_match_to_int(:conntrack_datapath_support) catch _class, _reason -> :conntrack_datapath_support end def to_int(_int, :bad_match) do throw(:bad_enum) end def to_int(:unknown, :flow_mod_failed) do flow_mod_failed_to_int(:unknown) catch _class, _reason -> :unknown end def to_int(:table_full, :flow_mod_failed) do flow_mod_failed_to_int(:table_full) catch _class, _reason -> :table_full end def to_int(:bad_table_id, :flow_mod_failed) do flow_mod_failed_to_int(:bad_table_id) catch _class, _reason -> :bad_table_id end def to_int(:overlap, :flow_mod_failed) do flow_mod_failed_to_int(:overlap) catch _class, _reason -> :overlap end def to_int(:eperm, :flow_mod_failed) do flow_mod_failed_to_int(:eperm) catch _class, _reason -> :eperm end def to_int(:bad_timeout, :flow_mod_failed) do flow_mod_failed_to_int(:bad_timeout) catch _class, _reason -> :bad_timeout end def to_int(:bad_command, :flow_mod_failed) do flow_mod_failed_to_int(:bad_command) catch _class, _reason -> :bad_command end def to_int(:bad_flags, :flow_mod_failed) do flow_mod_failed_to_int(:bad_flags) catch _class, _reason -> :bad_flags end def to_int(_int, :flow_mod_failed) do throw(:bad_enum) end def to_int(:group_exists, :group_mod_failed) do group_mod_failed_to_int(:group_exists) catch _class, _reason -> :group_exists end def to_int(:invalid_group, :group_mod_failed) do group_mod_failed_to_int(:invalid_group) catch _class, _reason -> :invalid_group end def to_int(:weight_unsupported, :group_mod_failed) do group_mod_failed_to_int(:weight_unsupported) catch _class, _reason -> :weight_unsupported end def to_int(:out_of_groups, :group_mod_failed) do group_mod_failed_to_int(:out_of_groups) catch _class, _reason -> :out_of_groups end def to_int(:ouf_of_buckets, :group_mod_failed) do group_mod_failed_to_int(:ouf_of_buckets) catch _class, _reason -> :ouf_of_buckets end def to_int(:chaining_unsupported, :group_mod_failed) do group_mod_failed_to_int(:chaining_unsupported) catch _class, _reason -> :chaining_unsupported end def to_int(:watch_unsupported, :group_mod_failed) do group_mod_failed_to_int(:watch_unsupported) catch _class, _reason -> :watch_unsupported end def to_int(:loop, :group_mod_failed) do group_mod_failed_to_int(:loop) catch _class, _reason -> :loop end def to_int(:unknown_group, :group_mod_failed) do group_mod_failed_to_int(:unknown_group) catch _class, _reason -> :unknown_group end def to_int(:chained_group, :group_mod_failed) do group_mod_failed_to_int(:chained_group) catch _class, _reason -> :chained_group end def to_int(:bad_type, :group_mod_failed) do group_mod_failed_to_int(:bad_type) catch _class, _reason -> :bad_type end def to_int(:bad_command, :group_mod_failed) do group_mod_failed_to_int(:bad_command) catch _class, _reason -> :bad_command end def to_int(:bad_bucket, :group_mod_failed) do group_mod_failed_to_int(:bad_bucket) catch _class, _reason -> :bad_bucket end def to_int(:bad_watch, :group_mod_failed) do group_mod_failed_to_int(:bad_watch) catch _class, _reason -> :bad_watch end def to_int(:eperm, :group_mod_failed) do group_mod_failed_to_int(:eperm) catch _class, _reason -> :eperm end def to_int(:unknown_bucket, :group_mod_failed) do group_mod_failed_to_int(:unknown_bucket) catch _class, _reason -> :unknown_bucket end def to_int(:bucket_exists, :group_mod_failed) do group_mod_failed_to_int(:bucket_exists) catch _class, _reason -> :bucket_exists end def to_int(_int, :group_mod_failed) do throw(:bad_enum) end def to_int(:bad_port, :port_mod_failed) do port_mod_failed_to_int(:bad_port) catch _class, _reason -> :bad_port end def to_int(:bad_hw_addr, :port_mod_failed) do port_mod_failed_to_int(:bad_hw_addr) catch _class, _reason -> :bad_hw_addr end def to_int(:bad_config, :port_mod_failed) do port_mod_failed_to_int(:bad_config) catch _class, _reason -> :bad_config end def to_int(:bad_advertise, :port_mod_failed) do port_mod_failed_to_int(:bad_advertise) catch _class, _reason -> :bad_advertise end def to_int(:eperm, :port_mod_failed) do port_mod_failed_to_int(:eperm) catch _class, _reason -> :eperm end def to_int(_int, :port_mod_failed) do throw(:bad_enum) end def to_int(:bad_table, :table_mod_failed) do table_mod_failed_to_int(:bad_table) catch _class, _reason -> :bad_table end def to_int(:bad_config, :table_mod_failed) do table_mod_failed_to_int(:bad_config) catch _class, _reason -> :bad_config end def to_int(:eperm, :table_mod_failed) do table_mod_failed_to_int(:eperm) catch _class, _reason -> :eperm end def to_int(_int, :table_mod_failed) do throw(:bad_enum) end def to_int(:bad_port, :queue_op_failed) do queue_op_failed_to_int(:bad_port) catch _class, _reason -> :bad_port end def to_int(:bad_queue, :queue_op_failed) do queue_op_failed_to_int(:bad_queue) catch _class, _reason -> :bad_queue end def to_int(:eperm, :queue_op_failed) do queue_op_failed_to_int(:eperm) catch _class, _reason -> :eperm end def to_int(_int, :queue_op_failed) do throw(:bad_enum) end def to_int(:bad_flags, :switch_config_failed) do switch_config_failed_to_int(:bad_flags) catch _class, _reason -> :bad_flags end def to_int(:bad_len, :switch_config_failed) do switch_config_failed_to_int(:bad_len) catch _class, _reason -> :bad_len end def to_int(:eperm, :switch_config_failed) do switch_config_failed_to_int(:eperm) catch _class, _reason -> :eperm end def to_int(_int, :switch_config_failed) do throw(:bad_enum) end def to_int(:stale, :role_request_failed) do role_request_failed_to_int(:stale) catch _class, _reason -> :stale end def to_int(:unsup, :role_request_failed) do role_request_failed_to_int(:unsup) catch _class, _reason -> :unsup end def to_int(:bad_role, :role_request_failed) do role_request_failed_to_int(:bad_role) catch _class, _reason -> :bad_role end def to_int(_int, :role_request_failed) do throw(:bad_enum) end def to_int(:unknown, :meter_mod_failed) do meter_mod_failed_to_int(:unknown) catch _class, _reason -> :unknown end def to_int(:meter_exists, :meter_mod_failed) do meter_mod_failed_to_int(:meter_exists) catch _class, _reason -> :meter_exists end def to_int(:invalid_meter, :meter_mod_failed) do meter_mod_failed_to_int(:invalid_meter) catch _class, _reason -> :invalid_meter end def to_int(:unknown_meter, :meter_mod_failed) do meter_mod_failed_to_int(:unknown_meter) catch _class, _reason -> :unknown_meter end def to_int(:bad_command, :meter_mod_failed) do meter_mod_failed_to_int(:bad_command) catch _class, _reason -> :bad_command end def to_int(:bad_flags, :meter_mod_failed) do meter_mod_failed_to_int(:bad_flags) catch _class, _reason -> :bad_flags end def to_int(:bad_rate, :meter_mod_failed) do meter_mod_failed_to_int(:bad_rate) catch _class, _reason -> :bad_rate end def to_int(:bad_burst, :meter_mod_failed) do meter_mod_failed_to_int(:bad_burst) catch _class, _reason -> :bad_burst end def to_int(:bad_band, :meter_mod_failed) do meter_mod_failed_to_int(:bad_band) catch _class, _reason -> :bad_band end def to_int(:bad_band_value, :meter_mod_failed) do meter_mod_failed_to_int(:bad_band_value) catch _class, _reason -> :bad_band_value end def to_int(:out_of_meters, :meter_mod_failed) do meter_mod_failed_to_int(:out_of_meters) catch _class, _reason -> :out_of_meters end def to_int(:out_of_bands, :meter_mod_failed) do meter_mod_failed_to_int(:out_of_bands) catch _class, _reason -> :out_of_bands end def to_int(_int, :meter_mod_failed) do throw(:bad_enum) end def to_int(:bad_table, :table_features_failed) do table_features_failed_to_int(:bad_table) catch _class, _reason -> :bad_table end def to_int(:bad_metadata, :table_features_failed) do table_features_failed_to_int(:bad_metadata) catch _class, _reason -> :bad_metadata end def to_int(:bad_type, :table_features_failed) do table_features_failed_to_int(:bad_type) catch _class, _reason -> :bad_type end def to_int(:bad_len, :table_features_failed) do table_features_failed_to_int(:bad_len) catch _class, _reason -> :bad_len end def to_int(:bad_argument, :table_features_failed) do table_features_failed_to_int(:bad_argument) catch _class, _reason -> :bad_argument end def to_int(:eperm, :table_features_failed) do table_features_failed_to_int(:eperm) catch _class, _reason -> :eperm end def to_int(_int, :table_features_failed) do throw(:bad_enum) end def to_int(:flow_stats, :switch_capabilities) do switch_capabilities_to_int(:flow_stats) catch _class, _reason -> :flow_stats end def to_int(:table_stats, :switch_capabilities) do switch_capabilities_to_int(:table_stats) catch _class, _reason -> :table_stats end def to_int(:port_stats, :switch_capabilities) do switch_capabilities_to_int(:port_stats) catch _class, _reason -> :port_stats end def to_int(:group_stats, :switch_capabilities) do switch_capabilities_to_int(:group_stats) catch _class, _reason -> :group_stats end def to_int(:ip_reasm, :switch_capabilities) do switch_capabilities_to_int(:ip_reasm) catch _class, _reason -> :ip_reasm end def to_int(:queue_stats, :switch_capabilities) do switch_capabilities_to_int(:queue_stats) catch _class, _reason -> :queue_stats end def to_int(:arp_match_ip, :switch_capabilities) do switch_capabilities_to_int(:arp_match_ip) catch _class, _reason -> :arp_match_ip end def to_int(:port_blocked, :switch_capabilities) do switch_capabilities_to_int(:port_blocked) catch _class, _reason -> :port_blocked end def to_int(_int, :switch_capabilities) do throw(:bad_enum) end def to_int(:fragment_drop, :config_flags) do config_flags_to_int(:fragment_drop) catch _class, _reason -> :fragment_drop end def to_int(:fragment_reassemble, :config_flags) do config_flags_to_int(:fragment_reassemble) catch _class, _reason -> :fragment_reassemble end def to_int(_int, :config_flags) do throw(:bad_enum) end def to_int(:max, :controller_max_len) do controller_max_len_to_int(:max) catch _class, _reason -> :max end def to_int(:no_buffer, :controller_max_len) do controller_max_len_to_int(:no_buffer) catch _class, _reason -> :no_buffer end def to_int(_int, :controller_max_len) do throw(:bad_enum) end def to_int(:nxoxm_nsh_match, :experimenter_oxm_vendors) do experimenter_oxm_vendors_to_int(:nxoxm_nsh_match) catch _class, _reason -> :nxoxm_nsh_match end def to_int(:nxoxm_match, :experimenter_oxm_vendors) do experimenter_oxm_vendors_to_int(:nxoxm_match) catch _class, _reason -> :nxoxm_match end def to_int(:hp_ext_match, :experimenter_oxm_vendors) do experimenter_oxm_vendors_to_int(:hp_ext_match) catch _class, _reason -> :hp_ext_match end def to_int(:onf_ext_match, :experimenter_oxm_vendors) do experimenter_oxm_vendors_to_int(:onf_ext_match) catch _class, _reason -> :onf_ext_match end def to_int(_int, :experimenter_oxm_vendors) do throw(:bad_enum) end def to_int(:standard, :match_type) do match_type_to_int(:standard) catch _class, _reason -> :standard end def to_int(:oxm, :match_type) do match_type_to_int(:oxm) catch _class, _reason -> :oxm end def to_int(_int, :match_type) do throw(:bad_enum) end def to_int(:nxm_0, :oxm_class) do oxm_class_to_int(:nxm_0) catch _class, _reason -> :nxm_0 end def to_int(:nxm_1, :oxm_class) do oxm_class_to_int(:nxm_1) catch _class, _reason -> :nxm_1 end def to_int(:openflow_basic, :oxm_class) do oxm_class_to_int(:openflow_basic) catch _class, _reason -> :openflow_basic end def to_int(:packet_register, :oxm_class) do oxm_class_to_int(:packet_register) catch _class, _reason -> :packet_register end def to_int(:experimenter, :oxm_class) do oxm_class_to_int(:experimenter) catch _class, _reason -> :experimenter end def to_int(_int, :oxm_class) do throw(:bad_enum) end def to_int(:nx_in_port, :nxm_0) do nxm_0_to_int(:nx_in_port) catch _class, _reason -> :nx_in_port end def to_int(:nx_eth_dst, :nxm_0) do nxm_0_to_int(:nx_eth_dst) catch _class, _reason -> :nx_eth_dst end def to_int(:nx_eth_src, :nxm_0) do nxm_0_to_int(:nx_eth_src) catch _class, _reason -> :nx_eth_src end def to_int(:nx_eth_type, :nxm_0) do nxm_0_to_int(:nx_eth_type) catch _class, _reason -> :nx_eth_type end def to_int(:nx_vlan_tci, :nxm_0) do nxm_0_to_int(:nx_vlan_tci) catch _class, _reason -> :nx_vlan_tci end def to_int(:nx_ip_tos, :nxm_0) do nxm_0_to_int(:nx_ip_tos) catch _class, _reason -> :nx_ip_tos end def to_int(:nx_ip_proto, :nxm_0) do nxm_0_to_int(:nx_ip_proto) catch _class, _reason -> :nx_ip_proto end def to_int(:nx_ipv4_src, :nxm_0) do nxm_0_to_int(:nx_ipv4_src) catch _class, _reason -> :nx_ipv4_src end def to_int(:nx_ipv4_dst, :nxm_0) do nxm_0_to_int(:nx_ipv4_dst) catch _class, _reason -> :nx_ipv4_dst end def to_int(:nx_tcp_src, :nxm_0) do nxm_0_to_int(:nx_tcp_src) catch _class, _reason -> :nx_tcp_src end def to_int(:nx_tcp_dst, :nxm_0) do nxm_0_to_int(:nx_tcp_dst) catch _class, _reason -> :nx_tcp_dst end def to_int(:nx_udp_src, :nxm_0) do nxm_0_to_int(:nx_udp_src) catch _class, _reason -> :nx_udp_src end def to_int(:nx_udp_dst, :nxm_0) do nxm_0_to_int(:nx_udp_dst) catch _class, _reason -> :nx_udp_dst end def to_int(:nx_icmpv4_type, :nxm_0) do nxm_0_to_int(:nx_icmpv4_type) catch _class, _reason -> :nx_icmpv4_type end def to_int(:nx_icmpv4_code, :nxm_0) do nxm_0_to_int(:nx_icmpv4_code) catch _class, _reason -> :nx_icmpv4_code end def to_int(:nx_arp_op, :nxm_0) do nxm_0_to_int(:nx_arp_op) catch _class, _reason -> :nx_arp_op end def to_int(:nx_arp_spa, :nxm_0) do nxm_0_to_int(:nx_arp_spa) catch _class, _reason -> :nx_arp_spa end def to_int(:nx_arp_tpa, :nxm_0) do nxm_0_to_int(:nx_arp_tpa) catch _class, _reason -> :nx_arp_tpa end def to_int(:nx_tcp_flags, :nxm_0) do nxm_0_to_int(:nx_tcp_flags) catch _class, _reason -> :nx_tcp_flags end def to_int(_int, :nxm_0) do throw(:bad_enum) end def to_int(:reg0, :nxm_1) do nxm_1_to_int(:reg0) catch _class, _reason -> :reg0 end def to_int(:reg1, :nxm_1) do nxm_1_to_int(:reg1) catch _class, _reason -> :reg1 end def to_int(:reg2, :nxm_1) do nxm_1_to_int(:reg2) catch _class, _reason -> :reg2 end def to_int(:reg3, :nxm_1) do nxm_1_to_int(:reg3) catch _class, _reason -> :reg3 end def to_int(:reg4, :nxm_1) do nxm_1_to_int(:reg4) catch _class, _reason -> :reg4 end def to_int(:reg5, :nxm_1) do nxm_1_to_int(:reg5) catch _class, _reason -> :reg5 end def to_int(:reg6, :nxm_1) do nxm_1_to_int(:reg6) catch _class, _reason -> :reg6 end def to_int(:reg7, :nxm_1) do nxm_1_to_int(:reg7) catch _class, _reason -> :reg7 end def to_int(:reg8, :nxm_1) do nxm_1_to_int(:reg8) catch _class, _reason -> :reg8 end def to_int(:reg9, :nxm_1) do nxm_1_to_int(:reg9) catch _class, _reason -> :reg9 end def to_int(:reg10, :nxm_1) do nxm_1_to_int(:reg10) catch _class, _reason -> :reg10 end def to_int(:reg11, :nxm_1) do nxm_1_to_int(:reg11) catch _class, _reason -> :reg11 end def to_int(:reg12, :nxm_1) do nxm_1_to_int(:reg12) catch _class, _reason -> :reg12 end def to_int(:reg13, :nxm_1) do nxm_1_to_int(:reg13) catch _class, _reason -> :reg13 end def to_int(:reg14, :nxm_1) do nxm_1_to_int(:reg14) catch _class, _reason -> :reg14 end def to_int(:reg15, :nxm_1) do nxm_1_to_int(:reg15) catch _class, _reason -> :reg15 end def to_int(:tun_id, :nxm_1) do nxm_1_to_int(:tun_id) catch _class, _reason -> :tun_id end def to_int(:nx_arp_sha, :nxm_1) do nxm_1_to_int(:nx_arp_sha) catch _class, _reason -> :nx_arp_sha end def to_int(:nx_arp_tha, :nxm_1) do nxm_1_to_int(:nx_arp_tha) catch _class, _reason -> :nx_arp_tha end def to_int(:nx_ipv6_src, :nxm_1) do nxm_1_to_int(:nx_ipv6_src) catch _class, _reason -> :nx_ipv6_src end def to_int(:nx_ipv6_dst, :nxm_1) do nxm_1_to_int(:nx_ipv6_dst) catch _class, _reason -> :nx_ipv6_dst end def to_int(:nx_icmpv6_type, :nxm_1) do nxm_1_to_int(:nx_icmpv6_type) catch _class, _reason -> :nx_icmpv6_type end def to_int(:nx_icmpv6_code, :nxm_1) do nxm_1_to_int(:nx_icmpv6_code) catch _class, _reason -> :nx_icmpv6_code end def to_int(:nx_ipv6_nd_target, :nxm_1) do nxm_1_to_int(:nx_ipv6_nd_target) catch _class, _reason -> :nx_ipv6_nd_target end def to_int(:nx_ipv6_nd_sll, :nxm_1) do nxm_1_to_int(:nx_ipv6_nd_sll) catch _class, _reason -> :nx_ipv6_nd_sll end def to_int(:nx_ipv6_nd_tll, :nxm_1) do nxm_1_to_int(:nx_ipv6_nd_tll) catch _class, _reason -> :nx_ipv6_nd_tll end def to_int(:nx_ip_frag, :nxm_1) do nxm_1_to_int(:nx_ip_frag) catch _class, _reason -> :nx_ip_frag end def to_int(:nx_ipv6_label, :nxm_1) do nxm_1_to_int(:nx_ipv6_label) catch _class, _reason -> :nx_ipv6_label end def to_int(:nx_ip_ecn, :nxm_1) do nxm_1_to_int(:nx_ip_ecn) catch _class, _reason -> :nx_ip_ecn end def to_int(:nx_ip_ttl, :nxm_1) do nxm_1_to_int(:nx_ip_ttl) catch _class, _reason -> :nx_ip_ttl end def to_int(:nx_mpls_ttl, :nxm_1) do nxm_1_to_int(:nx_mpls_ttl) catch _class, _reason -> :nx_mpls_ttl end def to_int(:tun_src, :nxm_1) do nxm_1_to_int(:tun_src) catch _class, _reason -> :tun_src end def to_int(:tun_dst, :nxm_1) do nxm_1_to_int(:tun_dst) catch _class, _reason -> :tun_dst end def to_int(:pkt_mark, :nxm_1) do nxm_1_to_int(:pkt_mark) catch _class, _reason -> :pkt_mark end def to_int(:dp_hash, :nxm_1) do nxm_1_to_int(:dp_hash) catch _class, _reason -> :dp_hash end def to_int(:recirc_id, :nxm_1) do nxm_1_to_int(:recirc_id) catch _class, _reason -> :recirc_id end def to_int(:conj_id, :nxm_1) do nxm_1_to_int(:conj_id) catch _class, _reason -> :conj_id end def to_int(:tun_gbp_id, :nxm_1) do nxm_1_to_int(:tun_gbp_id) catch _class, _reason -> :tun_gbp_id end def to_int(:tun_gbp_flags, :nxm_1) do nxm_1_to_int(:tun_gbp_flags) catch _class, _reason -> :tun_gbp_flags end def to_int(:tun_metadata0, :nxm_1) do nxm_1_to_int(:tun_metadata0) catch _class, _reason -> :tun_metadata0 end def to_int(:tun_metadata1, :nxm_1) do nxm_1_to_int(:tun_metadata1) catch _class, _reason -> :tun_metadata1 end def to_int(:tun_metadata2, :nxm_1) do nxm_1_to_int(:tun_metadata2) catch _class, _reason -> :tun_metadata2 end def to_int(:tun_metadata3, :nxm_1) do nxm_1_to_int(:tun_metadata3) catch _class, _reason -> :tun_metadata3 end def to_int(:tun_metadata4, :nxm_1) do nxm_1_to_int(:tun_metadata4) catch _class, _reason -> :tun_metadata4 end def to_int(:tun_metadata5, :nxm_1) do nxm_1_to_int(:tun_metadata5) catch _class, _reason -> :tun_metadata5 end def to_int(:tun_metadata6, :nxm_1) do nxm_1_to_int(:tun_metadata6) catch _class, _reason -> :tun_metadata6 end def to_int(:tun_metadata7, :nxm_1) do nxm_1_to_int(:tun_metadata7) catch _class, _reason -> :tun_metadata7 end def to_int(:tun_metadata8, :nxm_1) do nxm_1_to_int(:tun_metadata8) catch _class, _reason -> :tun_metadata8 end def to_int(:tun_metadata9, :nxm_1) do nxm_1_to_int(:tun_metadata9) catch _class, _reason -> :tun_metadata9 end def to_int(:tun_metadata10, :nxm_1) do nxm_1_to_int(:tun_metadata10) catch _class, _reason -> :tun_metadata10 end def to_int(:tun_metadata11, :nxm_1) do nxm_1_to_int(:tun_metadata11) catch _class, _reason -> :tun_metadata11 end def to_int(:tun_metadata12, :nxm_1) do nxm_1_to_int(:tun_metadata12) catch _class, _reason -> :tun_metadata12 end def to_int(:tun_metadata13, :nxm_1) do nxm_1_to_int(:tun_metadata13) catch _class, _reason -> :tun_metadata13 end def to_int(:tun_metadata14, :nxm_1) do nxm_1_to_int(:tun_metadata14) catch _class, _reason -> :tun_metadata14 end def to_int(:tun_metadata15, :nxm_1) do nxm_1_to_int(:tun_metadata15) catch _class, _reason -> :tun_metadata15 end def to_int(:tun_metadata16, :nxm_1) do nxm_1_to_int(:tun_metadata16) catch _class, _reason -> :tun_metadata16 end def to_int(:tun_metadata17, :nxm_1) do nxm_1_to_int(:tun_metadata17) catch _class, _reason -> :tun_metadata17 end def to_int(:tun_metadata18, :nxm_1) do nxm_1_to_int(:tun_metadata18) catch _class, _reason -> :tun_metadata18 end def to_int(:tun_metadata19, :nxm_1) do nxm_1_to_int(:tun_metadata19) catch _class, _reason -> :tun_metadata19 end def to_int(:tun_metadata20, :nxm_1) do nxm_1_to_int(:tun_metadata20) catch _class, _reason -> :tun_metadata20 end def to_int(:tun_metadata21, :nxm_1) do nxm_1_to_int(:tun_metadata21) catch _class, _reason -> :tun_metadata21 end def to_int(:tun_metadata22, :nxm_1) do nxm_1_to_int(:tun_metadata22) catch _class, _reason -> :tun_metadata22 end def to_int(:tun_metadata23, :nxm_1) do nxm_1_to_int(:tun_metadata23) catch _class, _reason -> :tun_metadata23 end def to_int(:tun_metadata24, :nxm_1) do nxm_1_to_int(:tun_metadata24) catch _class, _reason -> :tun_metadata24 end def to_int(:tun_metadata25, :nxm_1) do nxm_1_to_int(:tun_metadata25) catch _class, _reason -> :tun_metadata25 end def to_int(:tun_metadata26, :nxm_1) do nxm_1_to_int(:tun_metadata26) catch _class, _reason -> :tun_metadata26 end def to_int(:tun_metadata27, :nxm_1) do nxm_1_to_int(:tun_metadata27) catch _class, _reason -> :tun_metadata27 end def to_int(:tun_metadata28, :nxm_1) do nxm_1_to_int(:tun_metadata28) catch _class, _reason -> :tun_metadata28 end def to_int(:tun_metadata29, :nxm_1) do nxm_1_to_int(:tun_metadata29) catch _class, _reason -> :tun_metadata29 end def to_int(:tun_metadata30, :nxm_1) do nxm_1_to_int(:tun_metadata30) catch _class, _reason -> :tun_metadata30 end def to_int(:tun_metadata31, :nxm_1) do nxm_1_to_int(:tun_metadata31) catch _class, _reason -> :tun_metadata31 end def to_int(:tun_metadata32, :nxm_1) do nxm_1_to_int(:tun_metadata32) catch _class, _reason -> :tun_metadata32 end def to_int(:tun_metadata33, :nxm_1) do nxm_1_to_int(:tun_metadata33) catch _class, _reason -> :tun_metadata33 end def to_int(:tun_metadata34, :nxm_1) do nxm_1_to_int(:tun_metadata34) catch _class, _reason -> :tun_metadata34 end def to_int(:tun_metadata35, :nxm_1) do nxm_1_to_int(:tun_metadata35) catch _class, _reason -> :tun_metadata35 end def to_int(:tun_metadata36, :nxm_1) do nxm_1_to_int(:tun_metadata36) catch _class, _reason -> :tun_metadata36 end def to_int(:tun_metadata37, :nxm_1) do nxm_1_to_int(:tun_metadata37) catch _class, _reason -> :tun_metadata37 end def to_int(:tun_metadata38, :nxm_1) do nxm_1_to_int(:tun_metadata38) catch _class, _reason -> :tun_metadata38 end def to_int(:tun_metadata39, :nxm_1) do nxm_1_to_int(:tun_metadata39) catch _class, _reason -> :tun_metadata39 end def to_int(:tun_metadata40, :nxm_1) do nxm_1_to_int(:tun_metadata40) catch _class, _reason -> :tun_metadata40 end def to_int(:tun_metadata41, :nxm_1) do nxm_1_to_int(:tun_metadata41) catch _class, _reason -> :tun_metadata41 end def to_int(:tun_metadata42, :nxm_1) do nxm_1_to_int(:tun_metadata42) catch _class, _reason -> :tun_metadata42 end def to_int(:tun_metadata43, :nxm_1) do nxm_1_to_int(:tun_metadata43) catch _class, _reason -> :tun_metadata43 end def to_int(:tun_metadata44, :nxm_1) do nxm_1_to_int(:tun_metadata44) catch _class, _reason -> :tun_metadata44 end def to_int(:tun_metadata45, :nxm_1) do nxm_1_to_int(:tun_metadata45) catch _class, _reason -> :tun_metadata45 end def to_int(:tun_metadata46, :nxm_1) do nxm_1_to_int(:tun_metadata46) catch _class, _reason -> :tun_metadata46 end def to_int(:tun_metadata47, :nxm_1) do nxm_1_to_int(:tun_metadata47) catch _class, _reason -> :tun_metadata47 end def to_int(:tun_metadata48, :nxm_1) do nxm_1_to_int(:tun_metadata48) catch _class, _reason -> :tun_metadata48 end def to_int(:tun_metadata49, :nxm_1) do nxm_1_to_int(:tun_metadata49) catch _class, _reason -> :tun_metadata49 end def to_int(:tun_metadata50, :nxm_1) do nxm_1_to_int(:tun_metadata50) catch _class, _reason -> :tun_metadata50 end def to_int(:tun_metadata51, :nxm_1) do nxm_1_to_int(:tun_metadata51) catch _class, _reason -> :tun_metadata51 end def to_int(:tun_metadata52, :nxm_1) do nxm_1_to_int(:tun_metadata52) catch _class, _reason -> :tun_metadata52 end def to_int(:tun_metadata53, :nxm_1) do nxm_1_to_int(:tun_metadata53) catch _class, _reason -> :tun_metadata53 end def to_int(:tun_metadata54, :nxm_1) do nxm_1_to_int(:tun_metadata54) catch _class, _reason -> :tun_metadata54 end def to_int(:tun_metadata55, :nxm_1) do nxm_1_to_int(:tun_metadata55) catch _class, _reason -> :tun_metadata55 end def to_int(:tun_metadata56, :nxm_1) do nxm_1_to_int(:tun_metadata56) catch _class, _reason -> :tun_metadata56 end def to_int(:tun_metadata57, :nxm_1) do nxm_1_to_int(:tun_metadata57) catch _class, _reason -> :tun_metadata57 end def to_int(:tun_metadata58, :nxm_1) do nxm_1_to_int(:tun_metadata58) catch _class, _reason -> :tun_metadata58 end def to_int(:tun_metadata59, :nxm_1) do nxm_1_to_int(:tun_metadata59) catch _class, _reason -> :tun_metadata59 end def to_int(:tun_metadata60, :nxm_1) do nxm_1_to_int(:tun_metadata60) catch _class, _reason -> :tun_metadata60 end def to_int(:tun_metadata61, :nxm_1) do nxm_1_to_int(:tun_metadata61) catch _class, _reason -> :tun_metadata61 end def to_int(:tun_metadata62, :nxm_1) do nxm_1_to_int(:tun_metadata62) catch _class, _reason -> :tun_metadata62 end def to_int(:tun_metadata63, :nxm_1) do nxm_1_to_int(:tun_metadata63) catch _class, _reason -> :tun_metadata63 end def to_int(:tun_flags, :nxm_1) do nxm_1_to_int(:tun_flags) catch _class, _reason -> :tun_flags end def to_int(:ct_state, :nxm_1) do nxm_1_to_int(:ct_state) catch _class, _reason -> :ct_state end def to_int(:ct_zone, :nxm_1) do nxm_1_to_int(:ct_zone) catch _class, _reason -> :ct_zone end def to_int(:ct_mark, :nxm_1) do nxm_1_to_int(:ct_mark) catch _class, _reason -> :ct_mark end def to_int(:ct_label, :nxm_1) do nxm_1_to_int(:ct_label) catch _class, _reason -> :ct_label end def to_int(:tun_ipv6_src, :nxm_1) do nxm_1_to_int(:tun_ipv6_src) catch _class, _reason -> :tun_ipv6_src end def to_int(:tun_ipv6_dst, :nxm_1) do nxm_1_to_int(:tun_ipv6_dst) catch _class, _reason -> :tun_ipv6_dst end def to_int(:xxreg0, :nxm_1) do nxm_1_to_int(:xxreg0) catch _class, _reason -> :xxreg0 end def to_int(:xxreg1, :nxm_1) do nxm_1_to_int(:xxreg1) catch _class, _reason -> :xxreg1 end def to_int(:xxreg2, :nxm_1) do nxm_1_to_int(:xxreg2) catch _class, _reason -> :xxreg2 end def to_int(:xxreg3, :nxm_1) do nxm_1_to_int(:xxreg3) catch _class, _reason -> :xxreg3 end def to_int(:xxreg4, :nxm_1) do nxm_1_to_int(:xxreg4) catch _class, _reason -> :xxreg4 end def to_int(:xxreg5, :nxm_1) do nxm_1_to_int(:xxreg5) catch _class, _reason -> :xxreg5 end def to_int(:xxreg6, :nxm_1) do nxm_1_to_int(:xxreg6) catch _class, _reason -> :xxreg6 end def to_int(:xxreg7, :nxm_1) do nxm_1_to_int(:xxreg7) catch _class, _reason -> :xxreg7 end def to_int(:ct_nw_proto, :nxm_1) do nxm_1_to_int(:ct_nw_proto) catch _class, _reason -> :ct_nw_proto end def to_int(:ct_nw_src, :nxm_1) do nxm_1_to_int(:ct_nw_src) catch _class, _reason -> :ct_nw_src end def to_int(:ct_nw_dst, :nxm_1) do nxm_1_to_int(:ct_nw_dst) catch _class, _reason -> :ct_nw_dst end def to_int(:ct_ipv6_src, :nxm_1) do nxm_1_to_int(:ct_ipv6_src) catch _class, _reason -> :ct_ipv6_src end def to_int(:ct_ipv6_dst, :nxm_1) do nxm_1_to_int(:ct_ipv6_dst) catch _class, _reason -> :ct_ipv6_dst end def to_int(:ct_tp_src, :nxm_1) do nxm_1_to_int(:ct_tp_src) catch _class, _reason -> :ct_tp_src end def to_int(:ct_tp_dst, :nxm_1) do nxm_1_to_int(:ct_tp_dst) catch _class, _reason -> :ct_tp_dst end def to_int(_int, :nxm_1) do throw(:bad_enum) end def to_int(:in_port, :openflow_basic) do openflow_basic_to_int(:in_port) catch _class, _reason -> :in_port end def to_int(:in_phy_port, :openflow_basic) do openflow_basic_to_int(:in_phy_port) catch _class, _reason -> :in_phy_port end def to_int(:metadata, :openflow_basic) do openflow_basic_to_int(:metadata) catch _class, _reason -> :metadata end def to_int(:eth_dst, :openflow_basic) do openflow_basic_to_int(:eth_dst) catch _class, _reason -> :eth_dst end def to_int(:eth_src, :openflow_basic) do openflow_basic_to_int(:eth_src) catch _class, _reason -> :eth_src end def to_int(:eth_type, :openflow_basic) do openflow_basic_to_int(:eth_type) catch _class, _reason -> :eth_type end def to_int(:vlan_vid, :openflow_basic) do openflow_basic_to_int(:vlan_vid) catch _class, _reason -> :vlan_vid end def to_int(:vlan_pcp, :openflow_basic) do openflow_basic_to_int(:vlan_pcp) catch _class, _reason -> :vlan_pcp end def to_int(:ip_dscp, :openflow_basic) do openflow_basic_to_int(:ip_dscp) catch _class, _reason -> :ip_dscp end def to_int(:ip_ecn, :openflow_basic) do openflow_basic_to_int(:ip_ecn) catch _class, _reason -> :ip_ecn end def to_int(:ip_proto, :openflow_basic) do openflow_basic_to_int(:ip_proto) catch _class, _reason -> :ip_proto end def to_int(:ipv4_src, :openflow_basic) do openflow_basic_to_int(:ipv4_src) catch _class, _reason -> :ipv4_src end def to_int(:ipv4_dst, :openflow_basic) do openflow_basic_to_int(:ipv4_dst) catch _class, _reason -> :ipv4_dst end def to_int(:tcp_src, :openflow_basic) do openflow_basic_to_int(:tcp_src) catch _class, _reason -> :tcp_src end def to_int(:tcp_dst, :openflow_basic) do openflow_basic_to_int(:tcp_dst) catch _class, _reason -> :tcp_dst end def to_int(:udp_src, :openflow_basic) do openflow_basic_to_int(:udp_src) catch _class, _reason -> :udp_src end def to_int(:udp_dst, :openflow_basic) do openflow_basic_to_int(:udp_dst) catch _class, _reason -> :udp_dst end def to_int(:sctp_src, :openflow_basic) do openflow_basic_to_int(:sctp_src) catch _class, _reason -> :sctp_src end def to_int(:sctp_dst, :openflow_basic) do openflow_basic_to_int(:sctp_dst) catch _class, _reason -> :sctp_dst end def to_int(:icmpv4_type, :openflow_basic) do openflow_basic_to_int(:icmpv4_type) catch _class, _reason -> :icmpv4_type end def to_int(:icmpv4_code, :openflow_basic) do openflow_basic_to_int(:icmpv4_code) catch _class, _reason -> :icmpv4_code end def to_int(:arp_op, :openflow_basic) do openflow_basic_to_int(:arp_op) catch _class, _reason -> :arp_op end def to_int(:arp_spa, :openflow_basic) do openflow_basic_to_int(:arp_spa) catch _class, _reason -> :arp_spa end def to_int(:arp_tpa, :openflow_basic) do openflow_basic_to_int(:arp_tpa) catch _class, _reason -> :arp_tpa end def to_int(:arp_sha, :openflow_basic) do openflow_basic_to_int(:arp_sha) catch _class, _reason -> :arp_sha end def to_int(:arp_tha, :openflow_basic) do openflow_basic_to_int(:arp_tha) catch _class, _reason -> :arp_tha end def to_int(:ipv6_src, :openflow_basic) do openflow_basic_to_int(:ipv6_src) catch _class, _reason -> :ipv6_src end def to_int(:ipv6_dst, :openflow_basic) do openflow_basic_to_int(:ipv6_dst) catch _class, _reason -> :ipv6_dst end def to_int(:ipv6_flabel, :openflow_basic) do openflow_basic_to_int(:ipv6_flabel) catch _class, _reason -> :ipv6_flabel end def to_int(:icmpv6_type, :openflow_basic) do openflow_basic_to_int(:icmpv6_type) catch _class, _reason -> :icmpv6_type end def to_int(:icmpv6_code, :openflow_basic) do openflow_basic_to_int(:icmpv6_code) catch _class, _reason -> :icmpv6_code end def to_int(:ipv6_nd_target, :openflow_basic) do openflow_basic_to_int(:ipv6_nd_target) catch _class, _reason -> :ipv6_nd_target end def to_int(:ipv6_nd_sll, :openflow_basic) do openflow_basic_to_int(:ipv6_nd_sll) catch _class, _reason -> :ipv6_nd_sll end def to_int(:ipv6_nd_tll, :openflow_basic) do openflow_basic_to_int(:ipv6_nd_tll) catch _class, _reason -> :ipv6_nd_tll end def to_int(:mpls_label, :openflow_basic) do openflow_basic_to_int(:mpls_label) catch _class, _reason -> :mpls_label end def to_int(:mpls_tc, :openflow_basic) do openflow_basic_to_int(:mpls_tc) catch _class, _reason -> :mpls_tc end def to_int(:mpls_bos, :openflow_basic) do openflow_basic_to_int(:mpls_bos) catch _class, _reason -> :mpls_bos end def to_int(:pbb_isid, :openflow_basic) do openflow_basic_to_int(:pbb_isid) catch _class, _reason -> :pbb_isid end def to_int(:tunnel_id, :openflow_basic) do openflow_basic_to_int(:tunnel_id) catch _class, _reason -> :tunnel_id end def to_int(:ipv6_exthdr, :openflow_basic) do openflow_basic_to_int(:ipv6_exthdr) catch _class, _reason -> :ipv6_exthdr end def to_int(:pbb_uca, :openflow_basic) do openflow_basic_to_int(:pbb_uca) catch _class, _reason -> :pbb_uca end def to_int(:packet_type, :openflow_basic) do openflow_basic_to_int(:packet_type) catch _class, _reason -> :packet_type end def to_int(_int, :openflow_basic) do throw(:bad_enum) end def to_int(:vid_present, :vlan_id) do vlan_id_to_int(:vid_present) catch _class, _reason -> :vid_present end def to_int(:vid_none, :vlan_id) do vlan_id_to_int(:vid_none) catch _class, _reason -> :vid_none end def to_int(_int, :vlan_id) do throw(:bad_enum) end def to_int(:nonext, :ipv6exthdr_flags) do ipv6exthdr_flags_to_int(:nonext) catch _class, _reason -> :nonext end def to_int(:esp, :ipv6exthdr_flags) do ipv6exthdr_flags_to_int(:esp) catch _class, _reason -> :esp end def to_int(:auth, :ipv6exthdr_flags) do ipv6exthdr_flags_to_int(:auth) catch _class, _reason -> :auth end def to_int(:dest, :ipv6exthdr_flags) do ipv6exthdr_flags_to_int(:dest) catch _class, _reason -> :dest end def to_int(:frag, :ipv6exthdr_flags) do ipv6exthdr_flags_to_int(:frag) catch _class, _reason -> :frag end def to_int(:router, :ipv6exthdr_flags) do ipv6exthdr_flags_to_int(:router) catch _class, _reason -> :router end def to_int(:hop, :ipv6exthdr_flags) do ipv6exthdr_flags_to_int(:hop) catch _class, _reason -> :hop end def to_int(:unrep, :ipv6exthdr_flags) do ipv6exthdr_flags_to_int(:unrep) catch _class, _reason -> :unrep end def to_int(:unseq, :ipv6exthdr_flags) do ipv6exthdr_flags_to_int(:unseq) catch _class, _reason -> :unseq end def to_int(_int, :ipv6exthdr_flags) do throw(:bad_enum) end def to_int(:fin, :tcp_flags) do tcp_flags_to_int(:fin) catch _class, _reason -> :fin end def to_int(:syn, :tcp_flags) do tcp_flags_to_int(:syn) catch _class, _reason -> :syn end def to_int(:rst, :tcp_flags) do tcp_flags_to_int(:rst) catch _class, _reason -> :rst end def to_int(:psh, :tcp_flags) do tcp_flags_to_int(:psh) catch _class, _reason -> :psh end def to_int(:ack, :tcp_flags) do tcp_flags_to_int(:ack) catch _class, _reason -> :ack end def to_int(:urg, :tcp_flags) do tcp_flags_to_int(:urg) catch _class, _reason -> :urg end def to_int(:ece, :tcp_flags) do tcp_flags_to_int(:ece) catch _class, _reason -> :ece end def to_int(:cwr, :tcp_flags) do tcp_flags_to_int(:cwr) catch _class, _reason -> :cwr end def to_int(:ns, :tcp_flags) do tcp_flags_to_int(:ns) catch _class, _reason -> :ns end def to_int(_int, :tcp_flags) do throw(:bad_enum) end def to_int(:policy_applied, :tun_gbp_flags) do tun_gbp_flags_to_int(:policy_applied) catch _class, _reason -> :policy_applied end def to_int(:dont_learn, :tun_gbp_flags) do tun_gbp_flags_to_int(:dont_learn) catch _class, _reason -> :dont_learn end def to_int(_int, :tun_gbp_flags) do throw(:bad_enum) end def to_int(:new, :ct_state_flags) do ct_state_flags_to_int(:new) catch _class, _reason -> :new end def to_int(:est, :ct_state_flags) do ct_state_flags_to_int(:est) catch _class, _reason -> :est end def to_int(:rel, :ct_state_flags) do ct_state_flags_to_int(:rel) catch _class, _reason -> :rel end def to_int(:rep, :ct_state_flags) do ct_state_flags_to_int(:rep) catch _class, _reason -> :rep end def to_int(:inv, :ct_state_flags) do ct_state_flags_to_int(:inv) catch _class, _reason -> :inv end def to_int(:trk, :ct_state_flags) do ct_state_flags_to_int(:trk) catch _class, _reason -> :trk end def to_int(:snat, :ct_state_flags) do ct_state_flags_to_int(:snat) catch _class, _reason -> :snat end def to_int(:dnat, :ct_state_flags) do ct_state_flags_to_int(:dnat) catch _class, _reason -> :dnat end def to_int(_int, :ct_state_flags) do throw(:bad_enum) end def to_int(:xreg0, :packet_register) do packet_register_to_int(:xreg0) catch _class, _reason -> :xreg0 end def to_int(:xreg1, :packet_register) do packet_register_to_int(:xreg1) catch _class, _reason -> :xreg1 end def to_int(:xreg2, :packet_register) do packet_register_to_int(:xreg2) catch _class, _reason -> :xreg2 end def to_int(:xreg3, :packet_register) do packet_register_to_int(:xreg3) catch _class, _reason -> :xreg3 end def to_int(:xreg4, :packet_register) do packet_register_to_int(:xreg4) catch _class, _reason -> :xreg4 end def to_int(:xreg5, :packet_register) do packet_register_to_int(:xreg5) catch _class, _reason -> :xreg5 end def to_int(:xreg6, :packet_register) do packet_register_to_int(:xreg6) catch _class, _reason -> :xreg6 end def to_int(:xreg7, :packet_register) do packet_register_to_int(:xreg7) catch _class, _reason -> :xreg7 end def to_int(_int, :packet_register) do throw(:bad_enum) end def to_int(:nsh_flags, :nxoxm_nsh_match) do nxoxm_nsh_match_to_int(:nsh_flags) catch _class, _reason -> :nsh_flags end def to_int(:nsh_mdtype, :nxoxm_nsh_match) do nxoxm_nsh_match_to_int(:nsh_mdtype) catch _class, _reason -> :nsh_mdtype end def to_int(:nsh_np, :nxoxm_nsh_match) do nxoxm_nsh_match_to_int(:nsh_np) catch _class, _reason -> :nsh_np end def to_int(:nsh_spi, :nxoxm_nsh_match) do nxoxm_nsh_match_to_int(:nsh_spi) catch _class, _reason -> :nsh_spi end def to_int(:nsh_si, :nxoxm_nsh_match) do nxoxm_nsh_match_to_int(:nsh_si) catch _class, _reason -> :nsh_si end def to_int(:nsh_c1, :nxoxm_nsh_match) do nxoxm_nsh_match_to_int(:nsh_c1) catch _class, _reason -> :nsh_c1 end def to_int(:nsh_c2, :nxoxm_nsh_match) do nxoxm_nsh_match_to_int(:nsh_c2) catch _class, _reason -> :nsh_c2 end def to_int(:nsh_c3, :nxoxm_nsh_match) do nxoxm_nsh_match_to_int(:nsh_c3) catch _class, _reason -> :nsh_c3 end def to_int(:nsh_c4, :nxoxm_nsh_match) do nxoxm_nsh_match_to_int(:nsh_c4) catch _class, _reason -> :nsh_c4 end def to_int(:nsh_ttl, :nxoxm_nsh_match) do nxoxm_nsh_match_to_int(:nsh_ttl) catch _class, _reason -> :nsh_ttl end def to_int(_int, :nxoxm_nsh_match) do throw(:bad_enum) end def to_int(:onf_tcp_flags, :onf_ext_match) do onf_ext_match_to_int(:onf_tcp_flags) catch _class, _reason -> :onf_tcp_flags end def to_int(:onf_actset_output, :onf_ext_match) do onf_ext_match_to_int(:onf_actset_output) catch _class, _reason -> :onf_actset_output end def to_int(:onf_pbb_uca, :onf_ext_match) do onf_ext_match_to_int(:onf_pbb_uca) catch _class, _reason -> :onf_pbb_uca end def to_int(_int, :onf_ext_match) do throw(:bad_enum) end def to_int(:nxoxm_dp_hash, :nxoxm_match) do nxoxm_match_to_int(:nxoxm_dp_hash) catch _class, _reason -> :nxoxm_dp_hash end def to_int(:tun_erspan_idx, :nxoxm_match) do nxoxm_match_to_int(:tun_erspan_idx) catch _class, _reason -> :tun_erspan_idx end def to_int(:tun_erspan_ver, :nxoxm_match) do nxoxm_match_to_int(:tun_erspan_ver) catch _class, _reason -> :tun_erspan_ver end def to_int(:tun_erspan_dir, :nxoxm_match) do nxoxm_match_to_int(:tun_erspan_dir) catch _class, _reason -> :tun_erspan_dir end def to_int(:tun_erspan_hwid, :nxoxm_match) do nxoxm_match_to_int(:tun_erspan_hwid) catch _class, _reason -> :tun_erspan_hwid end def to_int(_int, :nxoxm_match) do throw(:bad_enum) end def to_int(:no_buffer, :buffer_id) do buffer_id_to_int(:no_buffer) catch _class, _reason -> :no_buffer end def to_int(_int, :buffer_id) do throw(:bad_enum) end def to_int(:port_down, :port_config) do port_config_to_int(:port_down) catch _class, _reason -> :port_down end def to_int(:no_receive, :port_config) do port_config_to_int(:no_receive) catch _class, _reason -> :no_receive end def to_int(:no_forward, :port_config) do port_config_to_int(:no_forward) catch _class, _reason -> :no_forward end def to_int(:no_packet_in, :port_config) do port_config_to_int(:no_packet_in) catch _class, _reason -> :no_packet_in end def to_int(_int, :port_config) do throw(:bad_enum) end def to_int(:link_down, :port_state) do port_state_to_int(:link_down) catch _class, _reason -> :link_down end def to_int(:blocked, :port_state) do port_state_to_int(:blocked) catch _class, _reason -> :blocked end def to_int(:live, :port_state) do port_state_to_int(:live) catch _class, _reason -> :live end def to_int(_int, :port_state) do throw(:bad_enum) end def to_int(:"10mb_hd", :port_features) do port_features_to_int(:"10mb_hd") catch _class, _reason -> :"10mb_hd" end def to_int(:"10mb_fd", :port_features) do port_features_to_int(:"10mb_fd") catch _class, _reason -> :"10mb_fd" end def to_int(:"100mb_hd", :port_features) do port_features_to_int(:"100mb_hd") catch _class, _reason -> :"100mb_hd" end def to_int(:"100mb_fd", :port_features) do port_features_to_int(:"100mb_fd") catch _class, _reason -> :"100mb_fd" end def to_int(:"1gb_hd", :port_features) do port_features_to_int(:"1gb_hd") catch _class, _reason -> :"1gb_hd" end def to_int(:"1gb_fd", :port_features) do port_features_to_int(:"1gb_fd") catch _class, _reason -> :"1gb_fd" end def to_int(:"10gb_fd", :port_features) do port_features_to_int(:"10gb_fd") catch _class, _reason -> :"10gb_fd" end def to_int(:"40gb_fd", :port_features) do port_features_to_int(:"40gb_fd") catch _class, _reason -> :"40gb_fd" end def to_int(:"100gb_fd", :port_features) do port_features_to_int(:"100gb_fd") catch _class, _reason -> :"100gb_fd" end def to_int(:"1tb_fd", :port_features) do port_features_to_int(:"1tb_fd") catch _class, _reason -> :"1tb_fd" end def to_int(:other, :port_features) do port_features_to_int(:other) catch _class, _reason -> :other end def to_int(:copper, :port_features) do port_features_to_int(:copper) catch _class, _reason -> :copper end def to_int(:fiber, :port_features) do port_features_to_int(:fiber) catch _class, _reason -> :fiber end def to_int(:autoneg, :port_features) do port_features_to_int(:autoneg) catch _class, _reason -> :autoneg end def to_int(:pause, :port_features) do port_features_to_int(:pause) catch _class, _reason -> :pause end def to_int(:pause_asym, :port_features) do port_features_to_int(:pause_asym) catch _class, _reason -> :pause_asym end def to_int(_int, :port_features) do throw(:bad_enum) end def to_int(:max, :openflow10_port_no) do openflow10_port_no_to_int(:max) catch _class, _reason -> :max end def to_int(:in_port, :openflow10_port_no) do openflow10_port_no_to_int(:in_port) catch _class, _reason -> :in_port end def to_int(:table, :openflow10_port_no) do openflow10_port_no_to_int(:table) catch _class, _reason -> :table end def to_int(:normal, :openflow10_port_no) do openflow10_port_no_to_int(:normal) catch _class, _reason -> :normal end def to_int(:flood, :openflow10_port_no) do openflow10_port_no_to_int(:flood) catch _class, _reason -> :flood end def to_int(:all, :openflow10_port_no) do openflow10_port_no_to_int(:all) catch _class, _reason -> :all end def to_int(:controller, :openflow10_port_no) do openflow10_port_no_to_int(:controller) catch _class, _reason -> :controller end def to_int(:local, :openflow10_port_no) do openflow10_port_no_to_int(:local) catch _class, _reason -> :local end def to_int(:none, :openflow10_port_no) do openflow10_port_no_to_int(:none) catch _class, _reason -> :none end def to_int(_int, :openflow10_port_no) do throw(:bad_enum) end def to_int(:max, :openflow13_port_no) do openflow13_port_no_to_int(:max) catch _class, _reason -> :max end def to_int(:in_port, :openflow13_port_no) do openflow13_port_no_to_int(:in_port) catch _class, _reason -> :in_port end def to_int(:table, :openflow13_port_no) do openflow13_port_no_to_int(:table) catch _class, _reason -> :table end def to_int(:normal, :openflow13_port_no) do openflow13_port_no_to_int(:normal) catch _class, _reason -> :normal end def to_int(:flood, :openflow13_port_no) do openflow13_port_no_to_int(:flood) catch _class, _reason -> :flood end def to_int(:all, :openflow13_port_no) do openflow13_port_no_to_int(:all) catch _class, _reason -> :all end def to_int(:controller, :openflow13_port_no) do openflow13_port_no_to_int(:controller) catch _class, _reason -> :controller end def to_int(:local, :openflow13_port_no) do openflow13_port_no_to_int(:local) catch _class, _reason -> :local end def to_int(:any, :openflow13_port_no) do openflow13_port_no_to_int(:any) catch _class, _reason -> :any end def to_int(_int, :openflow13_port_no) do throw(:bad_enum) end def to_int(:no_match, :packet_in_reason) do packet_in_reason_to_int(:no_match) catch _class, _reason -> :no_match end def to_int(:action, :packet_in_reason) do packet_in_reason_to_int(:action) catch _class, _reason -> :action end def to_int(:invalid_ttl, :packet_in_reason) do packet_in_reason_to_int(:invalid_ttl) catch _class, _reason -> :invalid_ttl end def to_int(:action_set, :packet_in_reason) do packet_in_reason_to_int(:action_set) catch _class, _reason -> :action_set end def to_int(:group, :packet_in_reason) do packet_in_reason_to_int(:group) catch _class, _reason -> :group end def to_int(:packet_out, :packet_in_reason) do packet_in_reason_to_int(:packet_out) catch _class, _reason -> :packet_out end def to_int(_int, :packet_in_reason) do throw(:bad_enum) end def to_int(:no_match, :packet_in_reason_mask) do packet_in_reason_mask_to_int(:no_match) catch _class, _reason -> :no_match end def to_int(:action, :packet_in_reason_mask) do packet_in_reason_mask_to_int(:action) catch _class, _reason -> :action end def to_int(:invalid_ttl, :packet_in_reason_mask) do packet_in_reason_mask_to_int(:invalid_ttl) catch _class, _reason -> :invalid_ttl end def to_int(:action_set, :packet_in_reason_mask) do packet_in_reason_mask_to_int(:action_set) catch _class, _reason -> :action_set end def to_int(:group, :packet_in_reason_mask) do packet_in_reason_mask_to_int(:group) catch _class, _reason -> :group end def to_int(:packet_out, :packet_in_reason_mask) do packet_in_reason_mask_to_int(:packet_out) catch _class, _reason -> :packet_out end def to_int(_int, :packet_in_reason_mask) do throw(:bad_enum) end def to_int(:add, :flow_mod_command) do flow_mod_command_to_int(:add) catch _class, _reason -> :add end def to_int(:modify, :flow_mod_command) do flow_mod_command_to_int(:modify) catch _class, _reason -> :modify end def to_int(:modify_strict, :flow_mod_command) do flow_mod_command_to_int(:modify_strict) catch _class, _reason -> :modify_strict end def to_int(:delete, :flow_mod_command) do flow_mod_command_to_int(:delete) catch _class, _reason -> :delete end def to_int(:delete_strict, :flow_mod_command) do flow_mod_command_to_int(:delete_strict) catch _class, _reason -> :delete_strict end def to_int(_int, :flow_mod_command) do throw(:bad_enum) end def to_int(:send_flow_rem, :flow_mod_flags) do flow_mod_flags_to_int(:send_flow_rem) catch _class, _reason -> :send_flow_rem end def to_int(:check_overlap, :flow_mod_flags) do flow_mod_flags_to_int(:check_overlap) catch _class, _reason -> :check_overlap end def to_int(:reset_counts, :flow_mod_flags) do flow_mod_flags_to_int(:reset_counts) catch _class, _reason -> :reset_counts end def to_int(:no_packet_counts, :flow_mod_flags) do flow_mod_flags_to_int(:no_packet_counts) catch _class, _reason -> :no_packet_counts end def to_int(:no_byte_counts, :flow_mod_flags) do flow_mod_flags_to_int(:no_byte_counts) catch _class, _reason -> :no_byte_counts end def to_int(_int, :flow_mod_flags) do throw(:bad_enum) end def to_int(:idle_timeout, :flow_removed_reason) do flow_removed_reason_to_int(:idle_timeout) catch _class, _reason -> :idle_timeout end def to_int(:hard_timeout, :flow_removed_reason) do flow_removed_reason_to_int(:hard_timeout) catch _class, _reason -> :hard_timeout end def to_int(:delete, :flow_removed_reason) do flow_removed_reason_to_int(:delete) catch _class, _reason -> :delete end def to_int(:group_delete, :flow_removed_reason) do flow_removed_reason_to_int(:group_delete) catch _class, _reason -> :group_delete end def to_int(:meter_delete, :flow_removed_reason) do flow_removed_reason_to_int(:meter_delete) catch _class, _reason -> :meter_delete end def to_int(:eviction, :flow_removed_reason) do flow_removed_reason_to_int(:eviction) catch _class, _reason -> :eviction end def to_int(_int, :flow_removed_reason) do throw(:bad_enum) end def to_int(:idle_timeout, :flow_removed_reason_mask) do flow_removed_reason_mask_to_int(:idle_timeout) catch _class, _reason -> :idle_timeout end def to_int(:hard_timeout, :flow_removed_reason_mask) do flow_removed_reason_mask_to_int(:hard_timeout) catch _class, _reason -> :hard_timeout end def to_int(:delete, :flow_removed_reason_mask) do flow_removed_reason_mask_to_int(:delete) catch _class, _reason -> :delete end def to_int(:group_delete, :flow_removed_reason_mask) do flow_removed_reason_mask_to_int(:group_delete) catch _class, _reason -> :group_delete end def to_int(:meter_delete, :flow_removed_reason_mask) do flow_removed_reason_mask_to_int(:meter_delete) catch _class, _reason -> :meter_delete end def to_int(:eviction, :flow_removed_reason_mask) do flow_removed_reason_mask_to_int(:eviction) catch _class, _reason -> :eviction end def to_int(_int, :flow_removed_reason_mask) do throw(:bad_enum) end def to_int(:add, :port_reason) do port_reason_to_int(:add) catch _class, _reason -> :add end def to_int(:delete, :port_reason) do port_reason_to_int(:delete) catch _class, _reason -> :delete end def to_int(:modify, :port_reason) do port_reason_to_int(:modify) catch _class, _reason -> :modify end def to_int(_int, :port_reason) do throw(:bad_enum) end def to_int(:add, :port_reason_mask) do port_reason_mask_to_int(:add) catch _class, _reason -> :add end def to_int(:delete, :port_reason_mask) do port_reason_mask_to_int(:delete) catch _class, _reason -> :delete end def to_int(:modify, :port_reason_mask) do port_reason_mask_to_int(:modify) catch _class, _reason -> :modify end def to_int(_int, :port_reason_mask) do throw(:bad_enum) end def to_int(:add, :group_mod_command) do group_mod_command_to_int(:add) catch _class, _reason -> :add end def to_int(:modify, :group_mod_command) do group_mod_command_to_int(:modify) catch _class, _reason -> :modify end def to_int(:delete, :group_mod_command) do group_mod_command_to_int(:delete) catch _class, _reason -> :delete end def to_int(_int, :group_mod_command) do throw(:bad_enum) end def to_int(:all, :group_type) do group_type_to_int(:all) catch _class, _reason -> :all end def to_int(:select, :group_type) do group_type_to_int(:select) catch _class, _reason -> :select end def to_int(:indirect, :group_type) do group_type_to_int(:indirect) catch _class, _reason -> :indirect end def to_int(:fast_failover, :group_type) do group_type_to_int(:fast_failover) catch _class, _reason -> :fast_failover end def to_int(_int, :group_type) do throw(:bad_enum) end def to_int(:all, :group_type_flags) do group_type_flags_to_int(:all) catch _class, _reason -> :all end def to_int(:select, :group_type_flags) do group_type_flags_to_int(:select) catch _class, _reason -> :select end def to_int(:indirect, :group_type_flags) do group_type_flags_to_int(:indirect) catch _class, _reason -> :indirect end def to_int(:fast_failover, :group_type_flags) do group_type_flags_to_int(:fast_failover) catch _class, _reason -> :fast_failover end def to_int(_int, :group_type_flags) do throw(:bad_enum) end def to_int(:max, :group_id) do group_id_to_int(:max) catch _class, _reason -> :max end def to_int(:all, :group_id) do group_id_to_int(:all) catch _class, _reason -> :all end def to_int(:any, :group_id) do group_id_to_int(:any) catch _class, _reason -> :any end def to_int(_int, :group_id) do throw(:bad_enum) end def to_int(:select_weight, :group_capabilities) do group_capabilities_to_int(:select_weight) catch _class, _reason -> :select_weight end def to_int(:select_liveness, :group_capabilities) do group_capabilities_to_int(:select_liveness) catch _class, _reason -> :select_liveness end def to_int(:chaining, :group_capabilities) do group_capabilities_to_int(:chaining) catch _class, _reason -> :chaining end def to_int(:chaining_checks, :group_capabilities) do group_capabilities_to_int(:chaining_checks) catch _class, _reason -> :chaining_checks end def to_int(_int, :group_capabilities) do throw(:bad_enum) end def to_int(:max, :table_id) do table_id_to_int(:max) catch _class, _reason -> :max end def to_int(:all, :table_id) do table_id_to_int(:all) catch _class, _reason -> :all end def to_int(_int, :table_id) do throw(:bad_enum) end def to_int(:all, :queue_id) do queue_id_to_int(:all) catch _class, _reason -> :all end def to_int(_int, :queue_id) do throw(:bad_enum) end def to_int(:add, :meter_mod_command) do meter_mod_command_to_int(:add) catch _class, _reason -> :add end def to_int(:modify, :meter_mod_command) do meter_mod_command_to_int(:modify) catch _class, _reason -> :modify end def to_int(:delete, :meter_mod_command) do meter_mod_command_to_int(:delete) catch _class, _reason -> :delete end def to_int(_int, :meter_mod_command) do throw(:bad_enum) end def to_int(:max, :meter_id) do meter_id_to_int(:max) catch _class, _reason -> :max end def to_int(:slowpath, :meter_id) do meter_id_to_int(:slowpath) catch _class, _reason -> :slowpath end def to_int(:controller, :meter_id) do meter_id_to_int(:controller) catch _class, _reason -> :controller end def to_int(:all, :meter_id) do meter_id_to_int(:all) catch _class, _reason -> :all end def to_int(_int, :meter_id) do throw(:bad_enum) end def to_int(:kbps, :meter_flags) do meter_flags_to_int(:kbps) catch _class, _reason -> :kbps end def to_int(:pktps, :meter_flags) do meter_flags_to_int(:pktps) catch _class, _reason -> :pktps end def to_int(:burst, :meter_flags) do meter_flags_to_int(:burst) catch _class, _reason -> :burst end def to_int(:stats, :meter_flags) do meter_flags_to_int(:stats) catch _class, _reason -> :stats end def to_int(_int, :meter_flags) do throw(:bad_enum) end def to_int(Openflow.MeterBand.Drop, :meter_band_type) do meter_band_type_to_int(Openflow.MeterBand.Drop) catch _class, _reason -> Openflow.MeterBand.Drop end def to_int(Openflow.MeterBand.Remark, :meter_band_type) do meter_band_type_to_int(Openflow.MeterBand.Remark) catch _class, _reason -> Openflow.MeterBand.Remark end def to_int(Openflow.MeterBand.Experimenter, :meter_band_type) do meter_band_type_to_int(Openflow.MeterBand.Experimenter) catch _class, _reason -> Openflow.MeterBand.Experimenter end def to_int(_int, :meter_band_type) do throw(:bad_enum) end def to_int(:table_miss_controller, :table_config) do table_config_to_int(:table_miss_controller) catch _class, _reason -> :table_miss_controller end def to_int(:table_miss_continue, :table_config) do table_config_to_int(:table_miss_continue) catch _class, _reason -> :table_miss_continue end def to_int(:table_miss_drop, :table_config) do table_config_to_int(:table_miss_drop) catch _class, _reason -> :table_miss_drop end def to_int(:table_miss_mask, :table_config) do table_config_to_int(:table_miss_mask) catch _class, _reason -> :table_miss_mask end def to_int(:eviction, :table_config) do table_config_to_int(:eviction) catch _class, _reason -> :eviction end def to_int(:vacancy_events, :table_config) do table_config_to_int(:vacancy_events) catch _class, _reason -> :vacancy_events end def to_int(_int, :table_config) do throw(:bad_enum) end def to_int(Openflow.Action.Output, :action_type) do action_type_to_int(Openflow.Action.Output) catch _class, _reason -> Openflow.Action.Output end def to_int(Openflow.Action.CopyTtlOut, :action_type) do action_type_to_int(Openflow.Action.CopyTtlOut) catch _class, _reason -> Openflow.Action.CopyTtlOut end def to_int(Openflow.Action.CopyTtlIn, :action_type) do action_type_to_int(Openflow.Action.CopyTtlIn) catch _class, _reason -> Openflow.Action.CopyTtlIn end def to_int(Openflow.Action.SetMplsTtl, :action_type) do action_type_to_int(Openflow.Action.SetMplsTtl) catch _class, _reason -> Openflow.Action.SetMplsTtl end def to_int(Openflow.Action.DecMplsTtl, :action_type) do action_type_to_int(Openflow.Action.DecMplsTtl) catch _class, _reason -> Openflow.Action.DecMplsTtl end def to_int(Openflow.Action.PushVlan, :action_type) do action_type_to_int(Openflow.Action.PushVlan) catch _class, _reason -> Openflow.Action.PushVlan end def to_int(Openflow.Action.PopVlan, :action_type) do action_type_to_int(Openflow.Action.PopVlan) catch _class, _reason -> Openflow.Action.PopVlan end def to_int(Openflow.Action.PushMpls, :action_type) do action_type_to_int(Openflow.Action.PushMpls) catch _class, _reason -> Openflow.Action.PushMpls end def to_int(Openflow.Action.PopMpls, :action_type) do action_type_to_int(Openflow.Action.PopMpls) catch _class, _reason -> Openflow.Action.PopMpls end def to_int(Openflow.Action.SetQueue, :action_type) do action_type_to_int(Openflow.Action.SetQueue) catch _class, _reason -> Openflow.Action.SetQueue end def to_int(Openflow.Action.Group, :action_type) do action_type_to_int(Openflow.Action.Group) catch _class, _reason -> Openflow.Action.Group end def to_int(Openflow.Action.SetNwTtl, :action_type) do action_type_to_int(Openflow.Action.SetNwTtl) catch _class, _reason -> Openflow.Action.SetNwTtl end def to_int(Openflow.Action.DecNwTtl, :action_type) do action_type_to_int(Openflow.Action.DecNwTtl) catch _class, _reason -> Openflow.Action.DecNwTtl end def to_int(Openflow.Action.SetField, :action_type) do action_type_to_int(Openflow.Action.SetField) catch _class, _reason -> Openflow.Action.SetField end def to_int(Openflow.Action.PushPbb, :action_type) do action_type_to_int(Openflow.Action.PushPbb) catch _class, _reason -> Openflow.Action.PushPbb end def to_int(Openflow.Action.PopPbb, :action_type) do action_type_to_int(Openflow.Action.PopPbb) catch _class, _reason -> Openflow.Action.PopPbb end def to_int(Openflow.Action.Encap, :action_type) do action_type_to_int(Openflow.Action.Encap) catch _class, _reason -> Openflow.Action.Encap end def to_int(Openflow.Action.Decap, :action_type) do action_type_to_int(Openflow.Action.Decap) catch _class, _reason -> Openflow.Action.Decap end def to_int(Openflow.Action.SetSequence, :action_type) do action_type_to_int(Openflow.Action.SetSequence) catch _class, _reason -> Openflow.Action.SetSequence end def to_int(Openflow.Action.ValidateSequence, :action_type) do action_type_to_int(Openflow.Action.ValidateSequence) catch _class, _reason -> Openflow.Action.ValidateSequence end def to_int(Openflow.Action.Experimenter, :action_type) do action_type_to_int(Openflow.Action.Experimenter) catch _class, _reason -> Openflow.Action.Experimenter end def to_int(_int, :action_type) do throw(:bad_enum) end def to_int(Openflow.Action.Output, :action_flags) do action_flags_to_int(Openflow.Action.Output) catch _class, _reason -> Openflow.Action.Output end def to_int(Openflow.Action.CopyTtlOut, :action_flags) do action_flags_to_int(Openflow.Action.CopyTtlOut) catch _class, _reason -> Openflow.Action.CopyTtlOut end def to_int(Openflow.Action.CopyTtlIn, :action_flags) do action_flags_to_int(Openflow.Action.CopyTtlIn) catch _class, _reason -> Openflow.Action.CopyTtlIn end def to_int(Openflow.Action.SetMplsTtl, :action_flags) do action_flags_to_int(Openflow.Action.SetMplsTtl) catch _class, _reason -> Openflow.Action.SetMplsTtl end def to_int(Openflow.Action.DecMplsTtl, :action_flags) do action_flags_to_int(Openflow.Action.DecMplsTtl) catch _class, _reason -> Openflow.Action.DecMplsTtl end def to_int(Openflow.Action.PushVlan, :action_flags) do action_flags_to_int(Openflow.Action.PushVlan) catch _class, _reason -> Openflow.Action.PushVlan end def to_int(Openflow.Action.PopVlan, :action_flags) do action_flags_to_int(Openflow.Action.PopVlan) catch _class, _reason -> Openflow.Action.PopVlan end def to_int(Openflow.Action.PushMpls, :action_flags) do action_flags_to_int(Openflow.Action.PushMpls) catch _class, _reason -> Openflow.Action.PushMpls end def to_int(Openflow.Action.PopMpls, :action_flags) do action_flags_to_int(Openflow.Action.PopMpls) catch _class, _reason -> Openflow.Action.PopMpls end def to_int(Openflow.Action.SetQueue, :action_flags) do action_flags_to_int(Openflow.Action.SetQueue) catch _class, _reason -> Openflow.Action.SetQueue end def to_int(Openflow.Action.Group, :action_flags) do action_flags_to_int(Openflow.Action.Group) catch _class, _reason -> Openflow.Action.Group end def to_int(Openflow.Action.SetNwTtl, :action_flags) do action_flags_to_int(Openflow.Action.SetNwTtl) catch _class, _reason -> Openflow.Action.SetNwTtl end def to_int(Openflow.Action.DecNwTtl, :action_flags) do action_flags_to_int(Openflow.Action.DecNwTtl) catch _class, _reason -> Openflow.Action.DecNwTtl end def to_int(Openflow.Action.SetField, :action_flags) do action_flags_to_int(Openflow.Action.SetField) catch _class, _reason -> Openflow.Action.SetField end def to_int(Openflow.Action.PushPbb, :action_flags) do action_flags_to_int(Openflow.Action.PushPbb) catch _class, _reason -> Openflow.Action.PushPbb end def to_int(Openflow.Action.PopPbb, :action_flags) do action_flags_to_int(Openflow.Action.PopPbb) catch _class, _reason -> Openflow.Action.PopPbb end def to_int(Openflow.Action.Encap, :action_flags) do action_flags_to_int(Openflow.Action.Encap) catch _class, _reason -> Openflow.Action.Encap end def to_int(Openflow.Action.Decap, :action_flags) do action_flags_to_int(Openflow.Action.Decap) catch _class, _reason -> Openflow.Action.Decap end def to_int(Openflow.Action.SetSequence, :action_flags) do action_flags_to_int(Openflow.Action.SetSequence) catch _class, _reason -> Openflow.Action.SetSequence end def to_int(Openflow.Action.ValidateSequence, :action_flags) do action_flags_to_int(Openflow.Action.ValidateSequence) catch _class, _reason -> Openflow.Action.ValidateSequence end def to_int(Openflow.Action.Experimenter, :action_flags) do action_flags_to_int(Openflow.Action.Experimenter) catch _class, _reason -> Openflow.Action.Experimenter end def to_int(_int, :action_flags) do throw(:bad_enum) end def to_int(:nicira_ext_action, :action_vendor) do action_vendor_to_int(:nicira_ext_action) catch _class, _reason -> :nicira_ext_action end def to_int(:onf_ext_action, :action_vendor) do action_vendor_to_int(:onf_ext_action) catch _class, _reason -> :onf_ext_action end def to_int(_int, :action_vendor) do throw(:bad_enum) end def to_int(Openflow.Action.OnfCopyField, :onf_ext_action) do onf_ext_action_to_int(Openflow.Action.OnfCopyField) catch _class, _reason -> Openflow.Action.OnfCopyField end def to_int(_int, :onf_ext_action) do throw(:bad_enum) end def to_int(Openflow.Action.NxResubmit, :nicira_ext_action) do nicira_ext_action_to_int(Openflow.Action.NxResubmit) catch _class, _reason -> Openflow.Action.NxResubmit end def to_int(Openflow.Action.NxSetTunnel, :nicira_ext_action) do nicira_ext_action_to_int(Openflow.Action.NxSetTunnel) catch _class, _reason -> Openflow.Action.NxSetTunnel end def to_int(Openflow.Action.NxRegMove, :nicira_ext_action) do nicira_ext_action_to_int(Openflow.Action.NxRegMove) catch _class, _reason -> Openflow.Action.NxRegMove end def to_int(Openflow.Action.NxRegLoad, :nicira_ext_action) do nicira_ext_action_to_int(Openflow.Action.NxRegLoad) catch _class, _reason -> Openflow.Action.NxRegLoad end def to_int(Openflow.Action.NxNote, :nicira_ext_action) do nicira_ext_action_to_int(Openflow.Action.NxNote) catch _class, _reason -> Openflow.Action.NxNote end def to_int(Openflow.Action.NxSetTunnel64, :nicira_ext_action) do nicira_ext_action_to_int(Openflow.Action.NxSetTunnel64) catch _class, _reason -> Openflow.Action.NxSetTunnel64 end def to_int(Openflow.Action.NxMultipath, :nicira_ext_action) do nicira_ext_action_to_int(Openflow.Action.NxMultipath) catch _class, _reason -> Openflow.Action.NxMultipath end def to_int(Openflow.Action.NxBundle, :nicira_ext_action) do nicira_ext_action_to_int(Openflow.Action.NxBundle) catch _class, _reason -> Openflow.Action.NxBundle end def to_int(Openflow.Action.NxBundleLoad, :nicira_ext_action) do nicira_ext_action_to_int(Openflow.Action.NxBundleLoad) catch _class, _reason -> Openflow.Action.NxBundleLoad end def to_int(Openflow.Action.NxResubmitTable, :nicira_ext_action) do nicira_ext_action_to_int(Openflow.Action.NxResubmitTable) catch _class, _reason -> Openflow.Action.NxResubmitTable end def to_int(Openflow.Action.NxOutputReg, :nicira_ext_action) do nicira_ext_action_to_int(Openflow.Action.NxOutputReg) catch _class, _reason -> Openflow.Action.NxOutputReg end def to_int(Openflow.Action.NxLearn, :nicira_ext_action) do nicira_ext_action_to_int(Openflow.Action.NxLearn) catch _class, _reason -> Openflow.Action.NxLearn end def to_int(Openflow.Action.NxExit, :nicira_ext_action) do nicira_ext_action_to_int(Openflow.Action.NxExit) catch _class, _reason -> Openflow.Action.NxExit end def to_int(Openflow.Action.NxDecTtl, :nicira_ext_action) do nicira_ext_action_to_int(Openflow.Action.NxDecTtl) catch _class, _reason -> Openflow.Action.NxDecTtl end def to_int(Openflow.Action.NxFinTimeout, :nicira_ext_action) do nicira_ext_action_to_int(Openflow.Action.NxFinTimeout) catch _class, _reason -> Openflow.Action.NxFinTimeout end def to_int(Openflow.Action.NxController, :nicira_ext_action) do nicira_ext_action_to_int(Openflow.Action.NxController) catch _class, _reason -> Openflow.Action.NxController end def to_int(Openflow.Action.NxDecTtlCntIds, :nicira_ext_action) do nicira_ext_action_to_int(Openflow.Action.NxDecTtlCntIds) catch _class, _reason -> Openflow.Action.NxDecTtlCntIds end def to_int(Openflow.Action.NxWriteMetadata, :nicira_ext_action) do nicira_ext_action_to_int(Openflow.Action.NxWriteMetadata) catch _class, _reason -> Openflow.Action.NxWriteMetadata end def to_int(Openflow.Action.NxStackPush, :nicira_ext_action) do nicira_ext_action_to_int(Openflow.Action.NxStackPush) catch _class, _reason -> Openflow.Action.NxStackPush end def to_int(Openflow.Action.NxStackPop, :nicira_ext_action) do nicira_ext_action_to_int(Openflow.Action.NxStackPop) catch _class, _reason -> Openflow.Action.NxStackPop end def to_int(Openflow.Action.NxSample, :nicira_ext_action) do nicira_ext_action_to_int(Openflow.Action.NxSample) catch _class, _reason -> Openflow.Action.NxSample end def to_int(Openflow.Action.NxOutputReg2, :nicira_ext_action) do nicira_ext_action_to_int(Openflow.Action.NxOutputReg2) catch _class, _reason -> Openflow.Action.NxOutputReg2 end def to_int(Openflow.Action.NxRegLoad2, :nicira_ext_action) do nicira_ext_action_to_int(Openflow.Action.NxRegLoad2) catch _class, _reason -> Openflow.Action.NxRegLoad2 end def to_int(Openflow.Action.NxConjunction, :nicira_ext_action) do nicira_ext_action_to_int(Openflow.Action.NxConjunction) catch _class, _reason -> Openflow.Action.NxConjunction end def to_int(Openflow.Action.NxConntrack, :nicira_ext_action) do nicira_ext_action_to_int(Openflow.Action.NxConntrack) catch _class, _reason -> Openflow.Action.NxConntrack end def to_int(Openflow.Action.NxNat, :nicira_ext_action) do nicira_ext_action_to_int(Openflow.Action.NxNat) catch _class, _reason -> Openflow.Action.NxNat end def to_int(Openflow.Action.NxController2, :nicira_ext_action) do nicira_ext_action_to_int(Openflow.Action.NxController2) catch _class, _reason -> Openflow.Action.NxController2 end def to_int(Openflow.Action.NxSample2, :nicira_ext_action) do nicira_ext_action_to_int(Openflow.Action.NxSample2) catch _class, _reason -> Openflow.Action.NxSample2 end def to_int(Openflow.Action.NxOutputTrunc, :nicira_ext_action) do nicira_ext_action_to_int(Openflow.Action.NxOutputTrunc) catch _class, _reason -> Openflow.Action.NxOutputTrunc end def to_int(Openflow.Action.NxGroup, :nicira_ext_action) do nicira_ext_action_to_int(Openflow.Action.NxGroup) catch _class, _reason -> Openflow.Action.NxGroup end def to_int(Openflow.Action.NxSample3, :nicira_ext_action) do nicira_ext_action_to_int(Openflow.Action.NxSample3) catch _class, _reason -> Openflow.Action.NxSample3 end def to_int(Openflow.Action.NxClone, :nicira_ext_action) do nicira_ext_action_to_int(Openflow.Action.NxClone) catch _class, _reason -> Openflow.Action.NxClone end def to_int(Openflow.Action.NxCtClear, :nicira_ext_action) do nicira_ext_action_to_int(Openflow.Action.NxCtClear) catch _class, _reason -> Openflow.Action.NxCtClear end def to_int(Openflow.Action.NxResubmitTableCt, :nicira_ext_action) do nicira_ext_action_to_int(Openflow.Action.NxResubmitTableCt) catch _class, _reason -> Openflow.Action.NxResubmitTableCt end def to_int(Openflow.Action.NxLearn2, :nicira_ext_action) do nicira_ext_action_to_int(Openflow.Action.NxLearn2) catch _class, _reason -> Openflow.Action.NxLearn2 end def to_int(Openflow.Action.NxEncap, :nicira_ext_action) do nicira_ext_action_to_int(Openflow.Action.NxEncap) catch _class, _reason -> Openflow.Action.NxEncap end def to_int(Openflow.Action.NxDecap, :nicira_ext_action) do nicira_ext_action_to_int(Openflow.Action.NxDecap) catch _class, _reason -> Openflow.Action.NxDecap end def to_int(Openflow.Action.NxCheckPktLarger, :nicira_ext_action) do nicira_ext_action_to_int(Openflow.Action.NxCheckPktLarger) catch _class, _reason -> Openflow.Action.NxCheckPktLarger end def to_int(Openflow.Action.NxDebugRecirc, :nicira_ext_action) do nicira_ext_action_to_int(Openflow.Action.NxDebugRecirc) catch _class, _reason -> Openflow.Action.NxDebugRecirc end def to_int(_int, :nicira_ext_action) do throw(:bad_enum) end def to_int(:modulo_n, :nx_mp_algorithm) do nx_mp_algorithm_to_int(:modulo_n) catch _class, _reason -> :modulo_n end def to_int(:hash_threshold, :nx_mp_algorithm) do nx_mp_algorithm_to_int(:hash_threshold) catch _class, _reason -> :hash_threshold end def to_int(:highest_random_weight, :nx_mp_algorithm) do nx_mp_algorithm_to_int(:highest_random_weight) catch _class, _reason -> :highest_random_weight end def to_int(:iterative_hash, :nx_mp_algorithm) do nx_mp_algorithm_to_int(:iterative_hash) catch _class, _reason -> :iterative_hash end def to_int(_int, :nx_mp_algorithm) do throw(:bad_enum) end def to_int(:eth_src, :nx_hash_fields) do nx_hash_fields_to_int(:eth_src) catch _class, _reason -> :eth_src end def to_int(:symmetric_l4, :nx_hash_fields) do nx_hash_fields_to_int(:symmetric_l4) catch _class, _reason -> :symmetric_l4 end def to_int(:symmetric_l3l4, :nx_hash_fields) do nx_hash_fields_to_int(:symmetric_l3l4) catch _class, _reason -> :symmetric_l3l4 end def to_int(:symmetric_l3l4_udp, :nx_hash_fields) do nx_hash_fields_to_int(:symmetric_l3l4_udp) catch _class, _reason -> :symmetric_l3l4_udp end def to_int(:nw_src, :nx_hash_fields) do nx_hash_fields_to_int(:nw_src) catch _class, _reason -> :nw_src end def to_int(:nw_dst, :nx_hash_fields) do nx_hash_fields_to_int(:nw_dst) catch _class, _reason -> :nw_dst end def to_int(_int, :nx_hash_fields) do throw(:bad_enum) end def to_int(:active_backup, :nx_bd_algorithm) do nx_bd_algorithm_to_int(:active_backup) catch _class, _reason -> :active_backup end def to_int(:highest_random_weight, :nx_bd_algorithm) do nx_bd_algorithm_to_int(:highest_random_weight) catch _class, _reason -> :highest_random_weight end def to_int(_int, :nx_bd_algorithm) do throw(:bad_enum) end def to_int(:send_flow_rem, :nx_learn_flag) do nx_learn_flag_to_int(:send_flow_rem) catch _class, _reason -> :send_flow_rem end def to_int(:delete_learned, :nx_learn_flag) do nx_learn_flag_to_int(:delete_learned) catch _class, _reason -> :delete_learned end def to_int(:write_result, :nx_learn_flag) do nx_learn_flag_to_int(:write_result) catch _class, _reason -> :write_result end def to_int(_int, :nx_learn_flag) do throw(:bad_enum) end def to_int(:commit, :nx_conntrack_flags) do nx_conntrack_flags_to_int(:commit) catch _class, _reason -> :commit end def to_int(:force, :nx_conntrack_flags) do nx_conntrack_flags_to_int(:force) catch _class, _reason -> :force end def to_int(_int, :nx_conntrack_flags) do throw(:bad_enum) end def to_int(:src, :nx_nat_flags) do nx_nat_flags_to_int(:src) catch _class, _reason -> :src end def to_int(:dst, :nx_nat_flags) do nx_nat_flags_to_int(:dst) catch _class, _reason -> :dst end def to_int(:persistent, :nx_nat_flags) do nx_nat_flags_to_int(:persistent) catch _class, _reason -> :persistent end def to_int(:protocol_hash, :nx_nat_flags) do nx_nat_flags_to_int(:protocol_hash) catch _class, _reason -> :protocol_hash end def to_int(:protocol_random, :nx_nat_flags) do nx_nat_flags_to_int(:protocol_random) catch _class, _reason -> :protocol_random end def to_int(_int, :nx_nat_flags) do throw(:bad_enum) end def to_int(:ipv4_min, :nx_nat_range) do nx_nat_range_to_int(:ipv4_min) catch _class, _reason -> :ipv4_min end def to_int(:ipv4_max, :nx_nat_range) do nx_nat_range_to_int(:ipv4_max) catch _class, _reason -> :ipv4_max end def to_int(:ipv6_min, :nx_nat_range) do nx_nat_range_to_int(:ipv6_min) catch _class, _reason -> :ipv6_min end def to_int(:ipv6_max, :nx_nat_range) do nx_nat_range_to_int(:ipv6_max) catch _class, _reason -> :ipv6_max end def to_int(:proto_min, :nx_nat_range) do nx_nat_range_to_int(:proto_min) catch _class, _reason -> :proto_min end def to_int(:proto_max, :nx_nat_range) do nx_nat_range_to_int(:proto_max) catch _class, _reason -> :proto_max end def to_int(_int, :nx_nat_range) do throw(:bad_enum) end def to_int(:max_len, :nx_action_controller2_prop_type) do nx_action_controller2_prop_type_to_int(:max_len) catch _class, _reason -> :max_len end def to_int(:controller_id, :nx_action_controller2_prop_type) do nx_action_controller2_prop_type_to_int(:controller_id) catch _class, _reason -> :controller_id end def to_int(:reason, :nx_action_controller2_prop_type) do nx_action_controller2_prop_type_to_int(:reason) catch _class, _reason -> :reason end def to_int(:userdata, :nx_action_controller2_prop_type) do nx_action_controller2_prop_type_to_int(:userdata) catch _class, _reason -> :userdata end def to_int(:pause, :nx_action_controller2_prop_type) do nx_action_controller2_prop_type_to_int(:pause) catch _class, _reason -> :pause end def to_int(_int, :nx_action_controller2_prop_type) do throw(:bad_enum) end def to_int(:default, :nx_action_sample_direction) do nx_action_sample_direction_to_int(:default) catch _class, _reason -> :default end def to_int(:ingress, :nx_action_sample_direction) do nx_action_sample_direction_to_int(:ingress) catch _class, _reason -> :ingress end def to_int(:egress, :nx_action_sample_direction) do nx_action_sample_direction_to_int(:egress) catch _class, _reason -> :egress end def to_int(_int, :nx_action_sample_direction) do throw(:bad_enum) end def to_int(Openflow.Action.NxFlowSpecMatch, :nx_flow_spec_type) do nx_flow_spec_type_to_int(Openflow.Action.NxFlowSpecMatch) catch _class, _reason -> Openflow.Action.NxFlowSpecMatch end def to_int(Openflow.Action.NxFlowSpecLoad, :nx_flow_spec_type) do nx_flow_spec_type_to_int(Openflow.Action.NxFlowSpecLoad) catch _class, _reason -> Openflow.Action.NxFlowSpecLoad end def to_int(Openflow.Action.NxFlowSpecOutput, :nx_flow_spec_type) do nx_flow_spec_type_to_int(Openflow.Action.NxFlowSpecOutput) catch _class, _reason -> Openflow.Action.NxFlowSpecOutput end def to_int(_int, :nx_flow_spec_type) do throw(:bad_enum) end def to_int(Openflow.Instruction.GotoTable, :instruction_type) do instruction_type_to_int(Openflow.Instruction.GotoTable) catch _class, _reason -> Openflow.Instruction.GotoTable end def to_int(Openflow.Instruction.WriteMetadata, :instruction_type) do instruction_type_to_int(Openflow.Instruction.WriteMetadata) catch _class, _reason -> Openflow.Instruction.WriteMetadata end def to_int(Openflow.Instruction.WriteActions, :instruction_type) do instruction_type_to_int(Openflow.Instruction.WriteActions) catch _class, _reason -> Openflow.Instruction.WriteActions end def to_int(Openflow.Instruction.ApplyActions, :instruction_type) do instruction_type_to_int(Openflow.Instruction.ApplyActions) catch _class, _reason -> Openflow.Instruction.ApplyActions end def to_int(Openflow.Instruction.ClearActions, :instruction_type) do instruction_type_to_int(Openflow.Instruction.ClearActions) catch _class, _reason -> Openflow.Instruction.ClearActions end def to_int(Openflow.Instruction.Meter, :instruction_type) do instruction_type_to_int(Openflow.Instruction.Meter) catch _class, _reason -> Openflow.Instruction.Meter end def to_int(Openflow.Instruction.Experimenter, :instruction_type) do instruction_type_to_int(Openflow.Instruction.Experimenter) catch _class, _reason -> Openflow.Instruction.Experimenter end def to_int(_int, :instruction_type) do throw(:bad_enum) end def to_int(:nochange, :controller_role) do controller_role_to_int(:nochange) catch _class, _reason -> :nochange end def to_int(:equal, :controller_role) do controller_role_to_int(:equal) catch _class, _reason -> :equal end def to_int(:master, :controller_role) do controller_role_to_int(:master) catch _class, _reason -> :master end def to_int(:slave, :controller_role) do controller_role_to_int(:slave) catch _class, _reason -> :slave end def to_int(_int, :controller_role) do throw(:bad_enum) end def to_int(:other, :nx_role) do nx_role_to_int(:other) catch _class, _reason -> :other end def to_int(:master, :nx_role) do nx_role_to_int(:master) catch _class, _reason -> :master end def to_int(:slave, :nx_role) do nx_role_to_int(:slave) catch _class, _reason -> :slave end def to_int(_int, :nx_role) do throw(:bad_enum) end def to_int(:standard, :packet_in_format) do packet_in_format_to_int(:standard) catch _class, _reason -> :standard end def to_int(:nxt_packet_in, :packet_in_format) do packet_in_format_to_int(:nxt_packet_in) catch _class, _reason -> :nxt_packet_in end def to_int(:nxt_packet_in2, :packet_in_format) do packet_in_format_to_int(:nxt_packet_in2) catch _class, _reason -> :nxt_packet_in2 end def to_int(_int, :packet_in_format) do throw(:bad_enum) end def to_int(:openflow10, :flow_format) do flow_format_to_int(:openflow10) catch _class, _reason -> :openflow10 end def to_int(:nxm, :flow_format) do flow_format_to_int(:nxm) catch _class, _reason -> :nxm end def to_int(_int, :flow_format) do throw(:bad_enum) end def to_int(:packet, :packet_in2_prop_type) do packet_in2_prop_type_to_int(:packet) catch _class, _reason -> :packet end def to_int(:full_len, :packet_in2_prop_type) do packet_in2_prop_type_to_int(:full_len) catch _class, _reason -> :full_len end def to_int(:buffer_id, :packet_in2_prop_type) do packet_in2_prop_type_to_int(:buffer_id) catch _class, _reason -> :buffer_id end def to_int(:table_id, :packet_in2_prop_type) do packet_in2_prop_type_to_int(:table_id) catch _class, _reason -> :table_id end def to_int(:cookie, :packet_in2_prop_type) do packet_in2_prop_type_to_int(:cookie) catch _class, _reason -> :cookie end def to_int(:reason, :packet_in2_prop_type) do packet_in2_prop_type_to_int(:reason) catch _class, _reason -> :reason end def to_int(:metadata, :packet_in2_prop_type) do packet_in2_prop_type_to_int(:metadata) catch _class, _reason -> :metadata end def to_int(:userdata, :packet_in2_prop_type) do packet_in2_prop_type_to_int(:userdata) catch _class, _reason -> :userdata end def to_int(:continuation, :packet_in2_prop_type) do packet_in2_prop_type_to_int(:continuation) catch _class, _reason -> :continuation end def to_int(_int, :packet_in2_prop_type) do throw(:bad_enum) end def to_int(:bridge, :continuation_prop_type) do continuation_prop_type_to_int(:bridge) catch _class, _reason -> :bridge end def to_int(:stack, :continuation_prop_type) do continuation_prop_type_to_int(:stack) catch _class, _reason -> :stack end def to_int(:mirrors, :continuation_prop_type) do continuation_prop_type_to_int(:mirrors) catch _class, _reason -> :mirrors end def to_int(:conntracked, :continuation_prop_type) do continuation_prop_type_to_int(:conntracked) catch _class, _reason -> :conntracked end def to_int(:table_id, :continuation_prop_type) do continuation_prop_type_to_int(:table_id) catch _class, _reason -> :table_id end def to_int(:cookie, :continuation_prop_type) do continuation_prop_type_to_int(:cookie) catch _class, _reason -> :cookie end def to_int(:actions, :continuation_prop_type) do continuation_prop_type_to_int(:actions) catch _class, _reason -> :actions end def to_int(:action_set, :continuation_prop_type) do continuation_prop_type_to_int(:action_set) catch _class, _reason -> :action_set end def to_int(_int, :continuation_prop_type) do throw(:bad_enum) end def to_int(:initial, :flow_monitor_flag) do flow_monitor_flag_to_int(:initial) catch _class, _reason -> :initial end def to_int(:add, :flow_monitor_flag) do flow_monitor_flag_to_int(:add) catch _class, _reason -> :add end def to_int(:delete, :flow_monitor_flag) do flow_monitor_flag_to_int(:delete) catch _class, _reason -> :delete end def to_int(:modify, :flow_monitor_flag) do flow_monitor_flag_to_int(:modify) catch _class, _reason -> :modify end def to_int(:actions, :flow_monitor_flag) do flow_monitor_flag_to_int(:actions) catch _class, _reason -> :actions end def to_int(:own, :flow_monitor_flag) do flow_monitor_flag_to_int(:own) catch _class, _reason -> :own end def to_int(_int, :flow_monitor_flag) do throw(:bad_enum) end def to_int(:added, :flow_update_event) do flow_update_event_to_int(:added) catch _class, _reason -> :added end def to_int(:deleted, :flow_update_event) do flow_update_event_to_int(:deleted) catch _class, _reason -> :deleted end def to_int(:modified, :flow_update_event) do flow_update_event_to_int(:modified) catch _class, _reason -> :modified end def to_int(:abbrev, :flow_update_event) do flow_update_event_to_int(:abbrev) catch _class, _reason -> :abbrev end def to_int(_int, :flow_update_event) do throw(:bad_enum) end def to_int(:add, :tlv_table_mod_command) do tlv_table_mod_command_to_int(:add) catch _class, _reason -> :add end def to_int(:delete, :tlv_table_mod_command) do tlv_table_mod_command_to_int(:delete) catch _class, _reason -> :delete end def to_int(:clear, :tlv_table_mod_command) do tlv_table_mod_command_to_int(:clear) catch _class, _reason -> :clear end def to_int(_int, :tlv_table_mod_command) do throw(:bad_enum) end def to_int(:instructions, :table_feature_prop_type) do table_feature_prop_type_to_int(:instructions) catch _class, _reason -> :instructions end def to_int(:instructions_miss, :table_feature_prop_type) do table_feature_prop_type_to_int(:instructions_miss) catch _class, _reason -> :instructions_miss end def to_int(:next_tables, :table_feature_prop_type) do table_feature_prop_type_to_int(:next_tables) catch _class, _reason -> :next_tables end def to_int(:next_tables_miss, :table_feature_prop_type) do table_feature_prop_type_to_int(:next_tables_miss) catch _class, _reason -> :next_tables_miss end def to_int(:write_actions, :table_feature_prop_type) do table_feature_prop_type_to_int(:write_actions) catch _class, _reason -> :write_actions end def to_int(:write_actions_miss, :table_feature_prop_type) do table_feature_prop_type_to_int(:write_actions_miss) catch _class, _reason -> :write_actions_miss end def to_int(:apply_actions, :table_feature_prop_type) do table_feature_prop_type_to_int(:apply_actions) catch _class, _reason -> :apply_actions end def to_int(:apply_actions_miss, :table_feature_prop_type) do table_feature_prop_type_to_int(:apply_actions_miss) catch _class, _reason -> :apply_actions_miss end def to_int(:match, :table_feature_prop_type) do table_feature_prop_type_to_int(:match) catch _class, _reason -> :match end def to_int(:wildcards, :table_feature_prop_type) do table_feature_prop_type_to_int(:wildcards) catch _class, _reason -> :wildcards end def to_int(:write_setfield, :table_feature_prop_type) do table_feature_prop_type_to_int(:write_setfield) catch _class, _reason -> :write_setfield end def to_int(:write_setfield_miss, :table_feature_prop_type) do table_feature_prop_type_to_int(:write_setfield_miss) catch _class, _reason -> :write_setfield_miss end def to_int(:apply_setfield, :table_feature_prop_type) do table_feature_prop_type_to_int(:apply_setfield) catch _class, _reason -> :apply_setfield end def to_int(:apply_setfield_miss, :table_feature_prop_type) do table_feature_prop_type_to_int(:apply_setfield_miss) catch _class, _reason -> :apply_setfield_miss end def to_int(:experimenter, :table_feature_prop_type) do table_feature_prop_type_to_int(:experimenter) catch _class, _reason -> :experimenter end def to_int(:experimenter_miss, :table_feature_prop_type) do table_feature_prop_type_to_int(:experimenter_miss) catch _class, _reason -> :experimenter_miss end def to_int(_int, :table_feature_prop_type) do throw(:bad_enum) end def to_int(:open_request, :bundle_ctrl_type) do bundle_ctrl_type_to_int(:open_request) catch _class, _reason -> :open_request end def to_int(:open_reply, :bundle_ctrl_type) do bundle_ctrl_type_to_int(:open_reply) catch _class, _reason -> :open_reply end def to_int(:close_request, :bundle_ctrl_type) do bundle_ctrl_type_to_int(:close_request) catch _class, _reason -> :close_request end def to_int(:close_reply, :bundle_ctrl_type) do bundle_ctrl_type_to_int(:close_reply) catch _class, _reason -> :close_reply end def to_int(:commit_request, :bundle_ctrl_type) do bundle_ctrl_type_to_int(:commit_request) catch _class, _reason -> :commit_request end def to_int(:commit_reply, :bundle_ctrl_type) do bundle_ctrl_type_to_int(:commit_reply) catch _class, _reason -> :commit_reply end def to_int(:discard_request, :bundle_ctrl_type) do bundle_ctrl_type_to_int(:discard_request) catch _class, _reason -> :discard_request end def to_int(:discard_reply, :bundle_ctrl_type) do bundle_ctrl_type_to_int(:discard_reply) catch _class, _reason -> :discard_reply end def to_int(_int, :bundle_ctrl_type) do throw(:bad_enum) end def to_int(:atomic, :bundle_flags) do bundle_flags_to_int(:atomic) catch _class, _reason -> :atomic end def to_int(:ordered, :bundle_flags) do bundle_flags_to_int(:ordered) catch _class, _reason -> :ordered end def to_int(_int, :bundle_flags) do throw(:bad_enum) end def to_atom(0x0, :openflow_codec) do openflow_codec_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :openflow_codec) do openflow_codec_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :openflow_codec) do openflow_codec_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x3, :openflow_codec) do openflow_codec_to_atom(0x3) catch _class, _reason -> 3 end def to_atom(0x4, :openflow_codec) do openflow_codec_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x5, :openflow_codec) do openflow_codec_to_atom(0x5) catch _class, _reason -> 5 end def to_atom(0x6, :openflow_codec) do openflow_codec_to_atom(0x6) catch _class, _reason -> 6 end def to_atom(0x7, :openflow_codec) do openflow_codec_to_atom(0x7) catch _class, _reason -> 7 end def to_atom(0x8, :openflow_codec) do openflow_codec_to_atom(0x8) catch _class, _reason -> 8 end def to_atom(0x9, :openflow_codec) do openflow_codec_to_atom(0x9) catch _class, _reason -> 9 end def to_atom(0xA, :openflow_codec) do openflow_codec_to_atom(0xA) catch _class, _reason -> 10 end def to_atom(0xB, :openflow_codec) do openflow_codec_to_atom(0xB) catch _class, _reason -> 11 end def to_atom(0xC, :openflow_codec) do openflow_codec_to_atom(0xC) catch _class, _reason -> 12 end def to_atom(0xD, :openflow_codec) do openflow_codec_to_atom(0xD) catch _class, _reason -> 13 end def to_atom(0xE, :openflow_codec) do openflow_codec_to_atom(0xE) catch _class, _reason -> 14 end def to_atom(0xF, :openflow_codec) do openflow_codec_to_atom(0xF) catch _class, _reason -> 15 end def to_atom(0x10, :openflow_codec) do openflow_codec_to_atom(0x10) catch _class, _reason -> 16 end def to_atom(0x11, :openflow_codec) do openflow_codec_to_atom(0x11) catch _class, _reason -> 17 end def to_atom(0x12, :openflow_codec) do openflow_codec_to_atom(0x12) catch _class, _reason -> 18 end def to_atom(0x13, :openflow_codec) do openflow_codec_to_atom(0x13) catch _class, _reason -> 19 end def to_atom(0x14, :openflow_codec) do openflow_codec_to_atom(0x14) catch _class, _reason -> 20 end def to_atom(0x15, :openflow_codec) do openflow_codec_to_atom(0x15) catch _class, _reason -> 21 end def to_atom(0x18, :openflow_codec) do openflow_codec_to_atom(0x18) catch _class, _reason -> 24 end def to_atom(0x19, :openflow_codec) do openflow_codec_to_atom(0x19) catch _class, _reason -> 25 end def to_atom(0x1A, :openflow_codec) do openflow_codec_to_atom(0x1A) catch _class, _reason -> 26 end def to_atom(0x1B, :openflow_codec) do openflow_codec_to_atom(0x1B) catch _class, _reason -> 27 end def to_atom(0x1C, :openflow_codec) do openflow_codec_to_atom(0x1C) catch _class, _reason -> 28 end def to_atom(0x1D, :openflow_codec) do openflow_codec_to_atom(0x1D) catch _class, _reason -> 29 end def to_atom(_, :openflow_codec) do throw(:bad_enum) end def to_atom(0x2320, :experimenter_id) do experimenter_id_to_atom(0x2320) catch _class, _reason -> 8992 end def to_atom(0x4F4E4600, :experimenter_id) do experimenter_id_to_atom(0x4F4E4600) catch _class, _reason -> 1_330_529_792 end def to_atom(_, :experimenter_id) do throw(:bad_enum) end def to_atom(0x10, :nicira_ext_message) do nicira_ext_message_to_atom(0x10) catch _class, _reason -> 16 end def to_atom(0x14, :nicira_ext_message) do nicira_ext_message_to_atom(0x14) catch _class, _reason -> 20 end def to_atom(0x15, :nicira_ext_message) do nicira_ext_message_to_atom(0x15) catch _class, _reason -> 21 end def to_atom(0x16, :nicira_ext_message) do nicira_ext_message_to_atom(0x16) catch _class, _reason -> 22 end def to_atom(0x17, :nicira_ext_message) do nicira_ext_message_to_atom(0x17) catch _class, _reason -> 23 end def to_atom(0x18, :nicira_ext_message) do nicira_ext_message_to_atom(0x18) catch _class, _reason -> 24 end def to_atom(0x19, :nicira_ext_message) do nicira_ext_message_to_atom(0x19) catch _class, _reason -> 25 end def to_atom(0x1A, :nicira_ext_message) do nicira_ext_message_to_atom(0x1A) catch _class, _reason -> 26 end def to_atom(0x1B, :nicira_ext_message) do nicira_ext_message_to_atom(0x1B) catch _class, _reason -> 27 end def to_atom(0x1C, :nicira_ext_message) do nicira_ext_message_to_atom(0x1C) catch _class, _reason -> 28 end def to_atom(0x1D, :nicira_ext_message) do nicira_ext_message_to_atom(0x1D) catch _class, _reason -> 29 end def to_atom(0x1E, :nicira_ext_message) do nicira_ext_message_to_atom(0x1E) catch _class, _reason -> 30 end def to_atom(_, :nicira_ext_message) do throw(:bad_enum) end def to_atom(0x8FC, :onf_ext_message) do onf_ext_message_to_atom(0x8FC) catch _class, _reason -> 2300 end def to_atom(0x8FD, :onf_ext_message) do onf_ext_message_to_atom(0x8FD) catch _class, _reason -> 2301 end def to_atom(_, :onf_ext_message) do throw(:bad_enum) end def to_atom(0x1, :multipart_request_flags) do multipart_request_flags_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(_, :multipart_request_flags) do throw(:bad_enum) end def to_atom(0x1, :multipart_reply_flags) do multipart_reply_flags_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(_, :multipart_reply_flags) do throw(:bad_enum) end def to_atom(0x0, :multipart_request_codec) do multipart_request_codec_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :multipart_request_codec) do multipart_request_codec_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :multipart_request_codec) do multipart_request_codec_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x3, :multipart_request_codec) do multipart_request_codec_to_atom(0x3) catch _class, _reason -> 3 end def to_atom(0x4, :multipart_request_codec) do multipart_request_codec_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x5, :multipart_request_codec) do multipart_request_codec_to_atom(0x5) catch _class, _reason -> 5 end def to_atom(0x6, :multipart_request_codec) do multipart_request_codec_to_atom(0x6) catch _class, _reason -> 6 end def to_atom(0x7, :multipart_request_codec) do multipart_request_codec_to_atom(0x7) catch _class, _reason -> 7 end def to_atom(0x8, :multipart_request_codec) do multipart_request_codec_to_atom(0x8) catch _class, _reason -> 8 end def to_atom(0x9, :multipart_request_codec) do multipart_request_codec_to_atom(0x9) catch _class, _reason -> 9 end def to_atom(0xA, :multipart_request_codec) do multipart_request_codec_to_atom(0xA) catch _class, _reason -> 10 end def to_atom(0xB, :multipart_request_codec) do multipart_request_codec_to_atom(0xB) catch _class, _reason -> 11 end def to_atom(0xC, :multipart_request_codec) do multipart_request_codec_to_atom(0xC) catch _class, _reason -> 12 end def to_atom(0xD, :multipart_request_codec) do multipart_request_codec_to_atom(0xD) catch _class, _reason -> 13 end def to_atom(0xFFFF, :multipart_request_codec) do multipart_request_codec_to_atom(0xFFFF) catch _class, _reason -> 65535 end def to_atom(_, :multipart_request_codec) do throw(:bad_enum) end def to_atom(0x0, :multipart_reply_codec) do multipart_reply_codec_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :multipart_reply_codec) do multipart_reply_codec_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :multipart_reply_codec) do multipart_reply_codec_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x3, :multipart_reply_codec) do multipart_reply_codec_to_atom(0x3) catch _class, _reason -> 3 end def to_atom(0x4, :multipart_reply_codec) do multipart_reply_codec_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x5, :multipart_reply_codec) do multipart_reply_codec_to_atom(0x5) catch _class, _reason -> 5 end def to_atom(0x6, :multipart_reply_codec) do multipart_reply_codec_to_atom(0x6) catch _class, _reason -> 6 end def to_atom(0x7, :multipart_reply_codec) do multipart_reply_codec_to_atom(0x7) catch _class, _reason -> 7 end def to_atom(0x8, :multipart_reply_codec) do multipart_reply_codec_to_atom(0x8) catch _class, _reason -> 8 end def to_atom(0x9, :multipart_reply_codec) do multipart_reply_codec_to_atom(0x9) catch _class, _reason -> 9 end def to_atom(0xA, :multipart_reply_codec) do multipart_reply_codec_to_atom(0xA) catch _class, _reason -> 10 end def to_atom(0xB, :multipart_reply_codec) do multipart_reply_codec_to_atom(0xB) catch _class, _reason -> 11 end def to_atom(0xC, :multipart_reply_codec) do multipart_reply_codec_to_atom(0xC) catch _class, _reason -> 12 end def to_atom(0xD, :multipart_reply_codec) do multipart_reply_codec_to_atom(0xD) catch _class, _reason -> 13 end def to_atom(0xFFFF, :multipart_reply_codec) do multipart_reply_codec_to_atom(0xFFFF) catch _class, _reason -> 65535 end def to_atom(_, :multipart_reply_codec) do throw(:bad_enum) end def to_atom(0x0, :nicira_ext_stats) do nicira_ext_stats_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :nicira_ext_stats) do nicira_ext_stats_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :nicira_ext_stats) do nicira_ext_stats_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x3, :nicira_ext_stats) do nicira_ext_stats_to_atom(0x3) catch _class, _reason -> 3 end def to_atom(0x4, :nicira_ext_stats) do nicira_ext_stats_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(_, :nicira_ext_stats) do throw(:bad_enum) end def to_atom(0x1, :hello_elem) do hello_elem_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(_, :hello_elem) do throw(:bad_enum) end def to_atom(0x0, :error_type) do error_type_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :error_type) do error_type_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :error_type) do error_type_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x3, :error_type) do error_type_to_atom(0x3) catch _class, _reason -> 3 end def to_atom(0x4, :error_type) do error_type_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x5, :error_type) do error_type_to_atom(0x5) catch _class, _reason -> 5 end def to_atom(0x6, :error_type) do error_type_to_atom(0x6) catch _class, _reason -> 6 end def to_atom(0x7, :error_type) do error_type_to_atom(0x7) catch _class, _reason -> 7 end def to_atom(0x8, :error_type) do error_type_to_atom(0x8) catch _class, _reason -> 8 end def to_atom(0x9, :error_type) do error_type_to_atom(0x9) catch _class, _reason -> 9 end def to_atom(0xA, :error_type) do error_type_to_atom(0xA) catch _class, _reason -> 10 end def to_atom(0xB, :error_type) do error_type_to_atom(0xB) catch _class, _reason -> 11 end def to_atom(0xC, :error_type) do error_type_to_atom(0xC) catch _class, _reason -> 12 end def to_atom(0xD, :error_type) do error_type_to_atom(0xD) catch _class, _reason -> 13 end def to_atom(0xFFFF, :error_type) do error_type_to_atom(0xFFFF) catch _class, _reason -> 65535 end def to_atom(_, :error_type) do throw(:bad_enum) end def to_atom(0x0, :hello_failed) do hello_failed_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :hello_failed) do hello_failed_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(_, :hello_failed) do throw(:bad_enum) end def to_atom(0x0, :bad_request) do bad_request_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :bad_request) do bad_request_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :bad_request) do bad_request_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x3, :bad_request) do bad_request_to_atom(0x3) catch _class, _reason -> 3 end def to_atom(0x4, :bad_request) do bad_request_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x5, :bad_request) do bad_request_to_atom(0x5) catch _class, _reason -> 5 end def to_atom(0x6, :bad_request) do bad_request_to_atom(0x6) catch _class, _reason -> 6 end def to_atom(0x7, :bad_request) do bad_request_to_atom(0x7) catch _class, _reason -> 7 end def to_atom(0x8, :bad_request) do bad_request_to_atom(0x8) catch _class, _reason -> 8 end def to_atom(0x9, :bad_request) do bad_request_to_atom(0x9) catch _class, _reason -> 9 end def to_atom(0xA, :bad_request) do bad_request_to_atom(0xA) catch _class, _reason -> 10 end def to_atom(0xB, :bad_request) do bad_request_to_atom(0xB) catch _class, _reason -> 11 end def to_atom(0xC, :bad_request) do bad_request_to_atom(0xC) catch _class, _reason -> 12 end def to_atom(0xD, :bad_request) do bad_request_to_atom(0xD) catch _class, _reason -> 13 end def to_atom(0xE, :bad_request) do bad_request_to_atom(0xE) catch _class, _reason -> 14 end def to_atom(0xF, :bad_request) do bad_request_to_atom(0xF) catch _class, _reason -> 15 end def to_atom(0x100, :bad_request) do bad_request_to_atom(0x100) catch _class, _reason -> 256 end def to_atom(0x101, :bad_request) do bad_request_to_atom(0x101) catch _class, _reason -> 257 end def to_atom(0x203, :bad_request) do bad_request_to_atom(0x203) catch _class, _reason -> 515 end def to_atom(0x204, :bad_request) do bad_request_to_atom(0x204) catch _class, _reason -> 516 end def to_atom(0x208, :bad_request) do bad_request_to_atom(0x208) catch _class, _reason -> 520 end def to_atom(0x209, :bad_request) do bad_request_to_atom(0x209) catch _class, _reason -> 521 end def to_atom(0x215, :bad_request) do bad_request_to_atom(0x215) catch _class, _reason -> 533 end def to_atom(0x216, :bad_request) do bad_request_to_atom(0x216) catch _class, _reason -> 534 end def to_atom(_, :bad_request) do throw(:bad_enum) end def to_atom(0x0, :bad_action) do bad_action_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :bad_action) do bad_action_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :bad_action) do bad_action_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x3, :bad_action) do bad_action_to_atom(0x3) catch _class, _reason -> 3 end def to_atom(0x4, :bad_action) do bad_action_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x5, :bad_action) do bad_action_to_atom(0x5) catch _class, _reason -> 5 end def to_atom(0x6, :bad_action) do bad_action_to_atom(0x6) catch _class, _reason -> 6 end def to_atom(0x7, :bad_action) do bad_action_to_atom(0x7) catch _class, _reason -> 7 end def to_atom(0x8, :bad_action) do bad_action_to_atom(0x8) catch _class, _reason -> 8 end def to_atom(0x9, :bad_action) do bad_action_to_atom(0x9) catch _class, _reason -> 9 end def to_atom(0xA, :bad_action) do bad_action_to_atom(0xA) catch _class, _reason -> 10 end def to_atom(0xB, :bad_action) do bad_action_to_atom(0xB) catch _class, _reason -> 11 end def to_atom(0xC, :bad_action) do bad_action_to_atom(0xC) catch _class, _reason -> 12 end def to_atom(0xD, :bad_action) do bad_action_to_atom(0xD) catch _class, _reason -> 13 end def to_atom(0xE, :bad_action) do bad_action_to_atom(0xE) catch _class, _reason -> 14 end def to_atom(0xF, :bad_action) do bad_action_to_atom(0xF) catch _class, _reason -> 15 end def to_atom(0x100, :bad_action) do bad_action_to_atom(0x100) catch _class, _reason -> 256 end def to_atom(0x109, :bad_action) do bad_action_to_atom(0x109) catch _class, _reason -> 265 end def to_atom(0x20E, :bad_action) do bad_action_to_atom(0x20E) catch _class, _reason -> 526 end def to_atom(_, :bad_action) do throw(:bad_enum) end def to_atom(0x0, :bad_instruction) do bad_instruction_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :bad_instruction) do bad_instruction_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :bad_instruction) do bad_instruction_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x3, :bad_instruction) do bad_instruction_to_atom(0x3) catch _class, _reason -> 3 end def to_atom(0x4, :bad_instruction) do bad_instruction_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x5, :bad_instruction) do bad_instruction_to_atom(0x5) catch _class, _reason -> 5 end def to_atom(0x6, :bad_instruction) do bad_instruction_to_atom(0x6) catch _class, _reason -> 6 end def to_atom(0x7, :bad_instruction) do bad_instruction_to_atom(0x7) catch _class, _reason -> 7 end def to_atom(0x8, :bad_instruction) do bad_instruction_to_atom(0x8) catch _class, _reason -> 8 end def to_atom(0x100, :bad_instruction) do bad_instruction_to_atom(0x100) catch _class, _reason -> 256 end def to_atom(_, :bad_instruction) do throw(:bad_enum) end def to_atom(0x0, :bad_match) do bad_match_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :bad_match) do bad_match_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :bad_match) do bad_match_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x3, :bad_match) do bad_match_to_atom(0x3) catch _class, _reason -> 3 end def to_atom(0x4, :bad_match) do bad_match_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x5, :bad_match) do bad_match_to_atom(0x5) catch _class, _reason -> 5 end def to_atom(0x6, :bad_match) do bad_match_to_atom(0x6) catch _class, _reason -> 6 end def to_atom(0x7, :bad_match) do bad_match_to_atom(0x7) catch _class, _reason -> 7 end def to_atom(0x8, :bad_match) do bad_match_to_atom(0x8) catch _class, _reason -> 8 end def to_atom(0x9, :bad_match) do bad_match_to_atom(0x9) catch _class, _reason -> 9 end def to_atom(0xA, :bad_match) do bad_match_to_atom(0xA) catch _class, _reason -> 10 end def to_atom(0xB, :bad_match) do bad_match_to_atom(0xB) catch _class, _reason -> 11 end def to_atom(0x108, :bad_match) do bad_match_to_atom(0x108) catch _class, _reason -> 264 end def to_atom(_, :bad_match) do throw(:bad_enum) end def to_atom(0x0, :flow_mod_failed) do flow_mod_failed_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :flow_mod_failed) do flow_mod_failed_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :flow_mod_failed) do flow_mod_failed_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x3, :flow_mod_failed) do flow_mod_failed_to_atom(0x3) catch _class, _reason -> 3 end def to_atom(0x4, :flow_mod_failed) do flow_mod_failed_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x5, :flow_mod_failed) do flow_mod_failed_to_atom(0x5) catch _class, _reason -> 5 end def to_atom(0x6, :flow_mod_failed) do flow_mod_failed_to_atom(0x6) catch _class, _reason -> 6 end def to_atom(0x7, :flow_mod_failed) do flow_mod_failed_to_atom(0x7) catch _class, _reason -> 7 end def to_atom(_, :flow_mod_failed) do throw(:bad_enum) end def to_atom(0x0, :group_mod_failed) do group_mod_failed_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :group_mod_failed) do group_mod_failed_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :group_mod_failed) do group_mod_failed_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x3, :group_mod_failed) do group_mod_failed_to_atom(0x3) catch _class, _reason -> 3 end def to_atom(0x4, :group_mod_failed) do group_mod_failed_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x5, :group_mod_failed) do group_mod_failed_to_atom(0x5) catch _class, _reason -> 5 end def to_atom(0x6, :group_mod_failed) do group_mod_failed_to_atom(0x6) catch _class, _reason -> 6 end def to_atom(0x7, :group_mod_failed) do group_mod_failed_to_atom(0x7) catch _class, _reason -> 7 end def to_atom(0x8, :group_mod_failed) do group_mod_failed_to_atom(0x8) catch _class, _reason -> 8 end def to_atom(0x9, :group_mod_failed) do group_mod_failed_to_atom(0x9) catch _class, _reason -> 9 end def to_atom(0xA, :group_mod_failed) do group_mod_failed_to_atom(0xA) catch _class, _reason -> 10 end def to_atom(0xB, :group_mod_failed) do group_mod_failed_to_atom(0xB) catch _class, _reason -> 11 end def to_atom(0xC, :group_mod_failed) do group_mod_failed_to_atom(0xC) catch _class, _reason -> 12 end def to_atom(0xD, :group_mod_failed) do group_mod_failed_to_atom(0xD) catch _class, _reason -> 13 end def to_atom(0xE, :group_mod_failed) do group_mod_failed_to_atom(0xE) catch _class, _reason -> 14 end def to_atom(0xF, :group_mod_failed) do group_mod_failed_to_atom(0xF) catch _class, _reason -> 15 end def to_atom(0x10, :group_mod_failed) do group_mod_failed_to_atom(0x10) catch _class, _reason -> 16 end def to_atom(_, :group_mod_failed) do throw(:bad_enum) end def to_atom(0x0, :port_mod_failed) do port_mod_failed_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :port_mod_failed) do port_mod_failed_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :port_mod_failed) do port_mod_failed_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x3, :port_mod_failed) do port_mod_failed_to_atom(0x3) catch _class, _reason -> 3 end def to_atom(0x4, :port_mod_failed) do port_mod_failed_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(_, :port_mod_failed) do throw(:bad_enum) end def to_atom(0x0, :table_mod_failed) do table_mod_failed_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :table_mod_failed) do table_mod_failed_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :table_mod_failed) do table_mod_failed_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(_, :table_mod_failed) do throw(:bad_enum) end def to_atom(0x0, :queue_op_failed) do queue_op_failed_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :queue_op_failed) do queue_op_failed_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :queue_op_failed) do queue_op_failed_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(_, :queue_op_failed) do throw(:bad_enum) end def to_atom(0x0, :switch_config_failed) do switch_config_failed_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :switch_config_failed) do switch_config_failed_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :switch_config_failed) do switch_config_failed_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(_, :switch_config_failed) do throw(:bad_enum) end def to_atom(0x0, :role_request_failed) do role_request_failed_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :role_request_failed) do role_request_failed_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :role_request_failed) do role_request_failed_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(_, :role_request_failed) do throw(:bad_enum) end def to_atom(0x0, :meter_mod_failed) do meter_mod_failed_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :meter_mod_failed) do meter_mod_failed_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :meter_mod_failed) do meter_mod_failed_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x3, :meter_mod_failed) do meter_mod_failed_to_atom(0x3) catch _class, _reason -> 3 end def to_atom(0x4, :meter_mod_failed) do meter_mod_failed_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x5, :meter_mod_failed) do meter_mod_failed_to_atom(0x5) catch _class, _reason -> 5 end def to_atom(0x6, :meter_mod_failed) do meter_mod_failed_to_atom(0x6) catch _class, _reason -> 6 end def to_atom(0x7, :meter_mod_failed) do meter_mod_failed_to_atom(0x7) catch _class, _reason -> 7 end def to_atom(0x8, :meter_mod_failed) do meter_mod_failed_to_atom(0x8) catch _class, _reason -> 8 end def to_atom(0x9, :meter_mod_failed) do meter_mod_failed_to_atom(0x9) catch _class, _reason -> 9 end def to_atom(0xA, :meter_mod_failed) do meter_mod_failed_to_atom(0xA) catch _class, _reason -> 10 end def to_atom(0xB, :meter_mod_failed) do meter_mod_failed_to_atom(0xB) catch _class, _reason -> 11 end def to_atom(_, :meter_mod_failed) do throw(:bad_enum) end def to_atom(0x0, :table_features_failed) do table_features_failed_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :table_features_failed) do table_features_failed_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :table_features_failed) do table_features_failed_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x3, :table_features_failed) do table_features_failed_to_atom(0x3) catch _class, _reason -> 3 end def to_atom(0x4, :table_features_failed) do table_features_failed_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x5, :table_features_failed) do table_features_failed_to_atom(0x5) catch _class, _reason -> 5 end def to_atom(_, :table_features_failed) do throw(:bad_enum) end def to_atom(0x1, :switch_capabilities) do switch_capabilities_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :switch_capabilities) do switch_capabilities_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x4, :switch_capabilities) do switch_capabilities_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x8, :switch_capabilities) do switch_capabilities_to_atom(0x8) catch _class, _reason -> 8 end def to_atom(0x20, :switch_capabilities) do switch_capabilities_to_atom(0x20) catch _class, _reason -> 32 end def to_atom(0x40, :switch_capabilities) do switch_capabilities_to_atom(0x40) catch _class, _reason -> 64 end def to_atom(0x80, :switch_capabilities) do switch_capabilities_to_atom(0x80) catch _class, _reason -> 128 end def to_atom(0x100, :switch_capabilities) do switch_capabilities_to_atom(0x100) catch _class, _reason -> 256 end def to_atom(_, :switch_capabilities) do throw(:bad_enum) end def to_atom(0x1, :config_flags) do config_flags_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :config_flags) do config_flags_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(_, :config_flags) do throw(:bad_enum) end def to_atom(0xFFE5, :controller_max_len) do controller_max_len_to_atom(0xFFE5) catch _class, _reason -> 65509 end def to_atom(0xFFFF, :controller_max_len) do controller_max_len_to_atom(0xFFFF) catch _class, _reason -> 65535 end def to_atom(_, :controller_max_len) do throw(:bad_enum) end def to_atom(0x5AD650, :experimenter_oxm_vendors) do experimenter_oxm_vendors_to_atom(0x5AD650) catch _class, _reason -> 5_953_104 end def to_atom(0x2320, :experimenter_oxm_vendors) do experimenter_oxm_vendors_to_atom(0x2320) catch _class, _reason -> 8992 end def to_atom(0x2428, :experimenter_oxm_vendors) do experimenter_oxm_vendors_to_atom(0x2428) catch _class, _reason -> 9256 end def to_atom(0x4F4E4600, :experimenter_oxm_vendors) do experimenter_oxm_vendors_to_atom(0x4F4E4600) catch _class, _reason -> 1_330_529_792 end def to_atom(_, :experimenter_oxm_vendors) do throw(:bad_enum) end def to_atom(0x0, :match_type) do match_type_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :match_type) do match_type_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(_, :match_type) do throw(:bad_enum) end def to_atom(0x0, :oxm_class) do oxm_class_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :oxm_class) do oxm_class_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x8000, :oxm_class) do oxm_class_to_atom(0x8000) catch _class, _reason -> 32768 end def to_atom(0x8001, :oxm_class) do oxm_class_to_atom(0x8001) catch _class, _reason -> 32769 end def to_atom(0xFFFF, :oxm_class) do oxm_class_to_atom(0xFFFF) catch _class, _reason -> 65535 end def to_atom(_, :oxm_class) do throw(:bad_enum) end def to_atom(0x0, :nxm_0) do nxm_0_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :nxm_0) do nxm_0_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :nxm_0) do nxm_0_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x3, :nxm_0) do nxm_0_to_atom(0x3) catch _class, _reason -> 3 end def to_atom(0x4, :nxm_0) do nxm_0_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x5, :nxm_0) do nxm_0_to_atom(0x5) catch _class, _reason -> 5 end def to_atom(0x6, :nxm_0) do nxm_0_to_atom(0x6) catch _class, _reason -> 6 end def to_atom(0x7, :nxm_0) do nxm_0_to_atom(0x7) catch _class, _reason -> 7 end def to_atom(0x8, :nxm_0) do nxm_0_to_atom(0x8) catch _class, _reason -> 8 end def to_atom(0x9, :nxm_0) do nxm_0_to_atom(0x9) catch _class, _reason -> 9 end def to_atom(0xA, :nxm_0) do nxm_0_to_atom(0xA) catch _class, _reason -> 10 end def to_atom(0xB, :nxm_0) do nxm_0_to_atom(0xB) catch _class, _reason -> 11 end def to_atom(0xC, :nxm_0) do nxm_0_to_atom(0xC) catch _class, _reason -> 12 end def to_atom(0xD, :nxm_0) do nxm_0_to_atom(0xD) catch _class, _reason -> 13 end def to_atom(0xE, :nxm_0) do nxm_0_to_atom(0xE) catch _class, _reason -> 14 end def to_atom(0xF, :nxm_0) do nxm_0_to_atom(0xF) catch _class, _reason -> 15 end def to_atom(0x10, :nxm_0) do nxm_0_to_atom(0x10) catch _class, _reason -> 16 end def to_atom(0x11, :nxm_0) do nxm_0_to_atom(0x11) catch _class, _reason -> 17 end def to_atom(0x22, :nxm_0) do nxm_0_to_atom(0x22) catch _class, _reason -> 34 end def to_atom(_, :nxm_0) do throw(:bad_enum) end def to_atom(0x0, :nxm_1) do nxm_1_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :nxm_1) do nxm_1_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :nxm_1) do nxm_1_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x3, :nxm_1) do nxm_1_to_atom(0x3) catch _class, _reason -> 3 end def to_atom(0x4, :nxm_1) do nxm_1_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x5, :nxm_1) do nxm_1_to_atom(0x5) catch _class, _reason -> 5 end def to_atom(0x6, :nxm_1) do nxm_1_to_atom(0x6) catch _class, _reason -> 6 end def to_atom(0x7, :nxm_1) do nxm_1_to_atom(0x7) catch _class, _reason -> 7 end def to_atom(0x8, :nxm_1) do nxm_1_to_atom(0x8) catch _class, _reason -> 8 end def to_atom(0x9, :nxm_1) do nxm_1_to_atom(0x9) catch _class, _reason -> 9 end def to_atom(0xA, :nxm_1) do nxm_1_to_atom(0xA) catch _class, _reason -> 10 end def to_atom(0xB, :nxm_1) do nxm_1_to_atom(0xB) catch _class, _reason -> 11 end def to_atom(0xC, :nxm_1) do nxm_1_to_atom(0xC) catch _class, _reason -> 12 end def to_atom(0xD, :nxm_1) do nxm_1_to_atom(0xD) catch _class, _reason -> 13 end def to_atom(0xE, :nxm_1) do nxm_1_to_atom(0xE) catch _class, _reason -> 14 end def to_atom(0xF, :nxm_1) do nxm_1_to_atom(0xF) catch _class, _reason -> 15 end def to_atom(0x10, :nxm_1) do nxm_1_to_atom(0x10) catch _class, _reason -> 16 end def to_atom(0x11, :nxm_1) do nxm_1_to_atom(0x11) catch _class, _reason -> 17 end def to_atom(0x12, :nxm_1) do nxm_1_to_atom(0x12) catch _class, _reason -> 18 end def to_atom(0x13, :nxm_1) do nxm_1_to_atom(0x13) catch _class, _reason -> 19 end def to_atom(0x14, :nxm_1) do nxm_1_to_atom(0x14) catch _class, _reason -> 20 end def to_atom(0x15, :nxm_1) do nxm_1_to_atom(0x15) catch _class, _reason -> 21 end def to_atom(0x16, :nxm_1) do nxm_1_to_atom(0x16) catch _class, _reason -> 22 end def to_atom(0x17, :nxm_1) do nxm_1_to_atom(0x17) catch _class, _reason -> 23 end def to_atom(0x18, :nxm_1) do nxm_1_to_atom(0x18) catch _class, _reason -> 24 end def to_atom(0x19, :nxm_1) do nxm_1_to_atom(0x19) catch _class, _reason -> 25 end def to_atom(0x1A, :nxm_1) do nxm_1_to_atom(0x1A) catch _class, _reason -> 26 end def to_atom(0x1B, :nxm_1) do nxm_1_to_atom(0x1B) catch _class, _reason -> 27 end def to_atom(0x1C, :nxm_1) do nxm_1_to_atom(0x1C) catch _class, _reason -> 28 end def to_atom(0x1D, :nxm_1) do nxm_1_to_atom(0x1D) catch _class, _reason -> 29 end def to_atom(0x1E, :nxm_1) do nxm_1_to_atom(0x1E) catch _class, _reason -> 30 end def to_atom(0x1F, :nxm_1) do nxm_1_to_atom(0x1F) catch _class, _reason -> 31 end def to_atom(0x20, :nxm_1) do nxm_1_to_atom(0x20) catch _class, _reason -> 32 end def to_atom(0x21, :nxm_1) do nxm_1_to_atom(0x21) catch _class, _reason -> 33 end def to_atom(0x23, :nxm_1) do nxm_1_to_atom(0x23) catch _class, _reason -> 35 end def to_atom(0x24, :nxm_1) do nxm_1_to_atom(0x24) catch _class, _reason -> 36 end def to_atom(0x25, :nxm_1) do nxm_1_to_atom(0x25) catch _class, _reason -> 37 end def to_atom(0x26, :nxm_1) do nxm_1_to_atom(0x26) catch _class, _reason -> 38 end def to_atom(0x27, :nxm_1) do nxm_1_to_atom(0x27) catch _class, _reason -> 39 end def to_atom(0x28, :nxm_1) do nxm_1_to_atom(0x28) catch _class, _reason -> 40 end def to_atom(0x29, :nxm_1) do nxm_1_to_atom(0x29) catch _class, _reason -> 41 end def to_atom(0x2A, :nxm_1) do nxm_1_to_atom(0x2A) catch _class, _reason -> 42 end def to_atom(0x2B, :nxm_1) do nxm_1_to_atom(0x2B) catch _class, _reason -> 43 end def to_atom(0x2C, :nxm_1) do nxm_1_to_atom(0x2C) catch _class, _reason -> 44 end def to_atom(0x2D, :nxm_1) do nxm_1_to_atom(0x2D) catch _class, _reason -> 45 end def to_atom(0x2E, :nxm_1) do nxm_1_to_atom(0x2E) catch _class, _reason -> 46 end def to_atom(0x2F, :nxm_1) do nxm_1_to_atom(0x2F) catch _class, _reason -> 47 end def to_atom(0x30, :nxm_1) do nxm_1_to_atom(0x30) catch _class, _reason -> 48 end def to_atom(0x31, :nxm_1) do nxm_1_to_atom(0x31) catch _class, _reason -> 49 end def to_atom(0x32, :nxm_1) do nxm_1_to_atom(0x32) catch _class, _reason -> 50 end def to_atom(0x33, :nxm_1) do nxm_1_to_atom(0x33) catch _class, _reason -> 51 end def to_atom(0x34, :nxm_1) do nxm_1_to_atom(0x34) catch _class, _reason -> 52 end def to_atom(0x35, :nxm_1) do nxm_1_to_atom(0x35) catch _class, _reason -> 53 end def to_atom(0x36, :nxm_1) do nxm_1_to_atom(0x36) catch _class, _reason -> 54 end def to_atom(0x37, :nxm_1) do nxm_1_to_atom(0x37) catch _class, _reason -> 55 end def to_atom(0x38, :nxm_1) do nxm_1_to_atom(0x38) catch _class, _reason -> 56 end def to_atom(0x39, :nxm_1) do nxm_1_to_atom(0x39) catch _class, _reason -> 57 end def to_atom(0x3A, :nxm_1) do nxm_1_to_atom(0x3A) catch _class, _reason -> 58 end def to_atom(0x3B, :nxm_1) do nxm_1_to_atom(0x3B) catch _class, _reason -> 59 end def to_atom(0x3C, :nxm_1) do nxm_1_to_atom(0x3C) catch _class, _reason -> 60 end def to_atom(0x3D, :nxm_1) do nxm_1_to_atom(0x3D) catch _class, _reason -> 61 end def to_atom(0x3E, :nxm_1) do nxm_1_to_atom(0x3E) catch _class, _reason -> 62 end def to_atom(0x3F, :nxm_1) do nxm_1_to_atom(0x3F) catch _class, _reason -> 63 end def to_atom(0x40, :nxm_1) do nxm_1_to_atom(0x40) catch _class, _reason -> 64 end def to_atom(0x41, :nxm_1) do nxm_1_to_atom(0x41) catch _class, _reason -> 65 end def to_atom(0x42, :nxm_1) do nxm_1_to_atom(0x42) catch _class, _reason -> 66 end def to_atom(0x43, :nxm_1) do nxm_1_to_atom(0x43) catch _class, _reason -> 67 end def to_atom(0x44, :nxm_1) do nxm_1_to_atom(0x44) catch _class, _reason -> 68 end def to_atom(0x45, :nxm_1) do nxm_1_to_atom(0x45) catch _class, _reason -> 69 end def to_atom(0x46, :nxm_1) do nxm_1_to_atom(0x46) catch _class, _reason -> 70 end def to_atom(0x47, :nxm_1) do nxm_1_to_atom(0x47) catch _class, _reason -> 71 end def to_atom(0x48, :nxm_1) do nxm_1_to_atom(0x48) catch _class, _reason -> 72 end def to_atom(0x49, :nxm_1) do nxm_1_to_atom(0x49) catch _class, _reason -> 73 end def to_atom(0x4A, :nxm_1) do nxm_1_to_atom(0x4A) catch _class, _reason -> 74 end def to_atom(0x4B, :nxm_1) do nxm_1_to_atom(0x4B) catch _class, _reason -> 75 end def to_atom(0x4C, :nxm_1) do nxm_1_to_atom(0x4C) catch _class, _reason -> 76 end def to_atom(0x4D, :nxm_1) do nxm_1_to_atom(0x4D) catch _class, _reason -> 77 end def to_atom(0x4E, :nxm_1) do nxm_1_to_atom(0x4E) catch _class, _reason -> 78 end def to_atom(0x4F, :nxm_1) do nxm_1_to_atom(0x4F) catch _class, _reason -> 79 end def to_atom(0x50, :nxm_1) do nxm_1_to_atom(0x50) catch _class, _reason -> 80 end def to_atom(0x51, :nxm_1) do nxm_1_to_atom(0x51) catch _class, _reason -> 81 end def to_atom(0x52, :nxm_1) do nxm_1_to_atom(0x52) catch _class, _reason -> 82 end def to_atom(0x53, :nxm_1) do nxm_1_to_atom(0x53) catch _class, _reason -> 83 end def to_atom(0x54, :nxm_1) do nxm_1_to_atom(0x54) catch _class, _reason -> 84 end def to_atom(0x55, :nxm_1) do nxm_1_to_atom(0x55) catch _class, _reason -> 85 end def to_atom(0x56, :nxm_1) do nxm_1_to_atom(0x56) catch _class, _reason -> 86 end def to_atom(0x57, :nxm_1) do nxm_1_to_atom(0x57) catch _class, _reason -> 87 end def to_atom(0x58, :nxm_1) do nxm_1_to_atom(0x58) catch _class, _reason -> 88 end def to_atom(0x59, :nxm_1) do nxm_1_to_atom(0x59) catch _class, _reason -> 89 end def to_atom(0x5A, :nxm_1) do nxm_1_to_atom(0x5A) catch _class, _reason -> 90 end def to_atom(0x5B, :nxm_1) do nxm_1_to_atom(0x5B) catch _class, _reason -> 91 end def to_atom(0x5C, :nxm_1) do nxm_1_to_atom(0x5C) catch _class, _reason -> 92 end def to_atom(0x5D, :nxm_1) do nxm_1_to_atom(0x5D) catch _class, _reason -> 93 end def to_atom(0x5E, :nxm_1) do nxm_1_to_atom(0x5E) catch _class, _reason -> 94 end def to_atom(0x5F, :nxm_1) do nxm_1_to_atom(0x5F) catch _class, _reason -> 95 end def to_atom(0x60, :nxm_1) do nxm_1_to_atom(0x60) catch _class, _reason -> 96 end def to_atom(0x61, :nxm_1) do nxm_1_to_atom(0x61) catch _class, _reason -> 97 end def to_atom(0x62, :nxm_1) do nxm_1_to_atom(0x62) catch _class, _reason -> 98 end def to_atom(0x63, :nxm_1) do nxm_1_to_atom(0x63) catch _class, _reason -> 99 end def to_atom(0x64, :nxm_1) do nxm_1_to_atom(0x64) catch _class, _reason -> 100 end def to_atom(0x65, :nxm_1) do nxm_1_to_atom(0x65) catch _class, _reason -> 101 end def to_atom(0x66, :nxm_1) do nxm_1_to_atom(0x66) catch _class, _reason -> 102 end def to_atom(0x67, :nxm_1) do nxm_1_to_atom(0x67) catch _class, _reason -> 103 end def to_atom(0x68, :nxm_1) do nxm_1_to_atom(0x68) catch _class, _reason -> 104 end def to_atom(0x69, :nxm_1) do nxm_1_to_atom(0x69) catch _class, _reason -> 105 end def to_atom(0x6A, :nxm_1) do nxm_1_to_atom(0x6A) catch _class, _reason -> 106 end def to_atom(0x6B, :nxm_1) do nxm_1_to_atom(0x6B) catch _class, _reason -> 107 end def to_atom(0x6C, :nxm_1) do nxm_1_to_atom(0x6C) catch _class, _reason -> 108 end def to_atom(0x6D, :nxm_1) do nxm_1_to_atom(0x6D) catch _class, _reason -> 109 end def to_atom(0x6E, :nxm_1) do nxm_1_to_atom(0x6E) catch _class, _reason -> 110 end def to_atom(0x6F, :nxm_1) do nxm_1_to_atom(0x6F) catch _class, _reason -> 111 end def to_atom(0x70, :nxm_1) do nxm_1_to_atom(0x70) catch _class, _reason -> 112 end def to_atom(0x71, :nxm_1) do nxm_1_to_atom(0x71) catch _class, _reason -> 113 end def to_atom(0x72, :nxm_1) do nxm_1_to_atom(0x72) catch _class, _reason -> 114 end def to_atom(0x73, :nxm_1) do nxm_1_to_atom(0x73) catch _class, _reason -> 115 end def to_atom(0x74, :nxm_1) do nxm_1_to_atom(0x74) catch _class, _reason -> 116 end def to_atom(0x75, :nxm_1) do nxm_1_to_atom(0x75) catch _class, _reason -> 117 end def to_atom(0x76, :nxm_1) do nxm_1_to_atom(0x76) catch _class, _reason -> 118 end def to_atom(0x77, :nxm_1) do nxm_1_to_atom(0x77) catch _class, _reason -> 119 end def to_atom(0x78, :nxm_1) do nxm_1_to_atom(0x78) catch _class, _reason -> 120 end def to_atom(0x79, :nxm_1) do nxm_1_to_atom(0x79) catch _class, _reason -> 121 end def to_atom(0x7A, :nxm_1) do nxm_1_to_atom(0x7A) catch _class, _reason -> 122 end def to_atom(0x7B, :nxm_1) do nxm_1_to_atom(0x7B) catch _class, _reason -> 123 end def to_atom(0x7C, :nxm_1) do nxm_1_to_atom(0x7C) catch _class, _reason -> 124 end def to_atom(0x7D, :nxm_1) do nxm_1_to_atom(0x7D) catch _class, _reason -> 125 end def to_atom(_, :nxm_1) do throw(:bad_enum) end def to_atom(0x0, :openflow_basic) do openflow_basic_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :openflow_basic) do openflow_basic_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :openflow_basic) do openflow_basic_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x3, :openflow_basic) do openflow_basic_to_atom(0x3) catch _class, _reason -> 3 end def to_atom(0x4, :openflow_basic) do openflow_basic_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x5, :openflow_basic) do openflow_basic_to_atom(0x5) catch _class, _reason -> 5 end def to_atom(0x6, :openflow_basic) do openflow_basic_to_atom(0x6) catch _class, _reason -> 6 end def to_atom(0x7, :openflow_basic) do openflow_basic_to_atom(0x7) catch _class, _reason -> 7 end def to_atom(0x8, :openflow_basic) do openflow_basic_to_atom(0x8) catch _class, _reason -> 8 end def to_atom(0x9, :openflow_basic) do openflow_basic_to_atom(0x9) catch _class, _reason -> 9 end def to_atom(0xA, :openflow_basic) do openflow_basic_to_atom(0xA) catch _class, _reason -> 10 end def to_atom(0xB, :openflow_basic) do openflow_basic_to_atom(0xB) catch _class, _reason -> 11 end def to_atom(0xC, :openflow_basic) do openflow_basic_to_atom(0xC) catch _class, _reason -> 12 end def to_atom(0xD, :openflow_basic) do openflow_basic_to_atom(0xD) catch _class, _reason -> 13 end def to_atom(0xE, :openflow_basic) do openflow_basic_to_atom(0xE) catch _class, _reason -> 14 end def to_atom(0xF, :openflow_basic) do openflow_basic_to_atom(0xF) catch _class, _reason -> 15 end def to_atom(0x10, :openflow_basic) do openflow_basic_to_atom(0x10) catch _class, _reason -> 16 end def to_atom(0x11, :openflow_basic) do openflow_basic_to_atom(0x11) catch _class, _reason -> 17 end def to_atom(0x12, :openflow_basic) do openflow_basic_to_atom(0x12) catch _class, _reason -> 18 end def to_atom(0x13, :openflow_basic) do openflow_basic_to_atom(0x13) catch _class, _reason -> 19 end def to_atom(0x14, :openflow_basic) do openflow_basic_to_atom(0x14) catch _class, _reason -> 20 end def to_atom(0x15, :openflow_basic) do openflow_basic_to_atom(0x15) catch _class, _reason -> 21 end def to_atom(0x16, :openflow_basic) do openflow_basic_to_atom(0x16) catch _class, _reason -> 22 end def to_atom(0x17, :openflow_basic) do openflow_basic_to_atom(0x17) catch _class, _reason -> 23 end def to_atom(0x18, :openflow_basic) do openflow_basic_to_atom(0x18) catch _class, _reason -> 24 end def to_atom(0x19, :openflow_basic) do openflow_basic_to_atom(0x19) catch _class, _reason -> 25 end def to_atom(0x1A, :openflow_basic) do openflow_basic_to_atom(0x1A) catch _class, _reason -> 26 end def to_atom(0x1B, :openflow_basic) do openflow_basic_to_atom(0x1B) catch _class, _reason -> 27 end def to_atom(0x1C, :openflow_basic) do openflow_basic_to_atom(0x1C) catch _class, _reason -> 28 end def to_atom(0x1D, :openflow_basic) do openflow_basic_to_atom(0x1D) catch _class, _reason -> 29 end def to_atom(0x1E, :openflow_basic) do openflow_basic_to_atom(0x1E) catch _class, _reason -> 30 end def to_atom(0x1F, :openflow_basic) do openflow_basic_to_atom(0x1F) catch _class, _reason -> 31 end def to_atom(0x20, :openflow_basic) do openflow_basic_to_atom(0x20) catch _class, _reason -> 32 end def to_atom(0x21, :openflow_basic) do openflow_basic_to_atom(0x21) catch _class, _reason -> 33 end def to_atom(0x22, :openflow_basic) do openflow_basic_to_atom(0x22) catch _class, _reason -> 34 end def to_atom(0x23, :openflow_basic) do openflow_basic_to_atom(0x23) catch _class, _reason -> 35 end def to_atom(0x24, :openflow_basic) do openflow_basic_to_atom(0x24) catch _class, _reason -> 36 end def to_atom(0x25, :openflow_basic) do openflow_basic_to_atom(0x25) catch _class, _reason -> 37 end def to_atom(0x26, :openflow_basic) do openflow_basic_to_atom(0x26) catch _class, _reason -> 38 end def to_atom(0x27, :openflow_basic) do openflow_basic_to_atom(0x27) catch _class, _reason -> 39 end def to_atom(0x29, :openflow_basic) do openflow_basic_to_atom(0x29) catch _class, _reason -> 41 end def to_atom(0x2C, :openflow_basic) do openflow_basic_to_atom(0x2C) catch _class, _reason -> 44 end def to_atom(_, :openflow_basic) do throw(:bad_enum) end def to_atom(0x1000, :vlan_id) do vlan_id_to_atom(0x1000) catch _class, _reason -> 4096 end def to_atom(0x0, :vlan_id) do vlan_id_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(_, :vlan_id) do throw(:bad_enum) end def to_atom(0x1, :ipv6exthdr_flags) do ipv6exthdr_flags_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :ipv6exthdr_flags) do ipv6exthdr_flags_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x4, :ipv6exthdr_flags) do ipv6exthdr_flags_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x8, :ipv6exthdr_flags) do ipv6exthdr_flags_to_atom(0x8) catch _class, _reason -> 8 end def to_atom(0x10, :ipv6exthdr_flags) do ipv6exthdr_flags_to_atom(0x10) catch _class, _reason -> 16 end def to_atom(0x20, :ipv6exthdr_flags) do ipv6exthdr_flags_to_atom(0x20) catch _class, _reason -> 32 end def to_atom(0x40, :ipv6exthdr_flags) do ipv6exthdr_flags_to_atom(0x40) catch _class, _reason -> 64 end def to_atom(0x80, :ipv6exthdr_flags) do ipv6exthdr_flags_to_atom(0x80) catch _class, _reason -> 128 end def to_atom(0x100, :ipv6exthdr_flags) do ipv6exthdr_flags_to_atom(0x100) catch _class, _reason -> 256 end def to_atom(_, :ipv6exthdr_flags) do throw(:bad_enum) end def to_atom(0x1, :tcp_flags) do tcp_flags_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :tcp_flags) do tcp_flags_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x4, :tcp_flags) do tcp_flags_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x8, :tcp_flags) do tcp_flags_to_atom(0x8) catch _class, _reason -> 8 end def to_atom(0x10, :tcp_flags) do tcp_flags_to_atom(0x10) catch _class, _reason -> 16 end def to_atom(0x20, :tcp_flags) do tcp_flags_to_atom(0x20) catch _class, _reason -> 32 end def to_atom(0x40, :tcp_flags) do tcp_flags_to_atom(0x40) catch _class, _reason -> 64 end def to_atom(0x80, :tcp_flags) do tcp_flags_to_atom(0x80) catch _class, _reason -> 128 end def to_atom(0x100, :tcp_flags) do tcp_flags_to_atom(0x100) catch _class, _reason -> 256 end def to_atom(_, :tcp_flags) do throw(:bad_enum) end def to_atom(0x8, :tun_gbp_flags) do tun_gbp_flags_to_atom(0x8) catch _class, _reason -> 8 end def to_atom(0x40, :tun_gbp_flags) do tun_gbp_flags_to_atom(0x40) catch _class, _reason -> 64 end def to_atom(_, :tun_gbp_flags) do throw(:bad_enum) end def to_atom(0x1, :ct_state_flags) do ct_state_flags_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :ct_state_flags) do ct_state_flags_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x4, :ct_state_flags) do ct_state_flags_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x8, :ct_state_flags) do ct_state_flags_to_atom(0x8) catch _class, _reason -> 8 end def to_atom(0x10, :ct_state_flags) do ct_state_flags_to_atom(0x10) catch _class, _reason -> 16 end def to_atom(0x20, :ct_state_flags) do ct_state_flags_to_atom(0x20) catch _class, _reason -> 32 end def to_atom(0x40, :ct_state_flags) do ct_state_flags_to_atom(0x40) catch _class, _reason -> 64 end def to_atom(0x80, :ct_state_flags) do ct_state_flags_to_atom(0x80) catch _class, _reason -> 128 end def to_atom(_, :ct_state_flags) do throw(:bad_enum) end def to_atom(0x0, :packet_register) do packet_register_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :packet_register) do packet_register_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :packet_register) do packet_register_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x3, :packet_register) do packet_register_to_atom(0x3) catch _class, _reason -> 3 end def to_atom(0x4, :packet_register) do packet_register_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x5, :packet_register) do packet_register_to_atom(0x5) catch _class, _reason -> 5 end def to_atom(0x6, :packet_register) do packet_register_to_atom(0x6) catch _class, _reason -> 6 end def to_atom(0x7, :packet_register) do packet_register_to_atom(0x7) catch _class, _reason -> 7 end def to_atom(_, :packet_register) do throw(:bad_enum) end def to_atom(0x1, :nxoxm_nsh_match) do nxoxm_nsh_match_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :nxoxm_nsh_match) do nxoxm_nsh_match_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x3, :nxoxm_nsh_match) do nxoxm_nsh_match_to_atom(0x3) catch _class, _reason -> 3 end def to_atom(0x4, :nxoxm_nsh_match) do nxoxm_nsh_match_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x5, :nxoxm_nsh_match) do nxoxm_nsh_match_to_atom(0x5) catch _class, _reason -> 5 end def to_atom(0x6, :nxoxm_nsh_match) do nxoxm_nsh_match_to_atom(0x6) catch _class, _reason -> 6 end def to_atom(0x7, :nxoxm_nsh_match) do nxoxm_nsh_match_to_atom(0x7) catch _class, _reason -> 7 end def to_atom(0x8, :nxoxm_nsh_match) do nxoxm_nsh_match_to_atom(0x8) catch _class, _reason -> 8 end def to_atom(0x9, :nxoxm_nsh_match) do nxoxm_nsh_match_to_atom(0x9) catch _class, _reason -> 9 end def to_atom(0xA, :nxoxm_nsh_match) do nxoxm_nsh_match_to_atom(0xA) catch _class, _reason -> 10 end def to_atom(_, :nxoxm_nsh_match) do throw(:bad_enum) end def to_atom(0x2A, :onf_ext_match) do onf_ext_match_to_atom(0x2A) catch _class, _reason -> 42 end def to_atom(0x2B, :onf_ext_match) do onf_ext_match_to_atom(0x2B) catch _class, _reason -> 43 end def to_atom(0xA00, :onf_ext_match) do onf_ext_match_to_atom(0xA00) catch _class, _reason -> 2560 end def to_atom(_, :onf_ext_match) do throw(:bad_enum) end def to_atom(0x0, :nxoxm_match) do nxoxm_match_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0xB, :nxoxm_match) do nxoxm_match_to_atom(0xB) catch _class, _reason -> 11 end def to_atom(0xC, :nxoxm_match) do nxoxm_match_to_atom(0xC) catch _class, _reason -> 12 end def to_atom(0xD, :nxoxm_match) do nxoxm_match_to_atom(0xD) catch _class, _reason -> 13 end def to_atom(0xE, :nxoxm_match) do nxoxm_match_to_atom(0xE) catch _class, _reason -> 14 end def to_atom(_, :nxoxm_match) do throw(:bad_enum) end def to_atom(0xFFFFFFFF, :buffer_id) do buffer_id_to_atom(0xFFFFFFFF) catch _class, _reason -> 4_294_967_295 end def to_atom(_, :buffer_id) do throw(:bad_enum) end def to_atom(0x1, :port_config) do port_config_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x4, :port_config) do port_config_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x20, :port_config) do port_config_to_atom(0x20) catch _class, _reason -> 32 end def to_atom(0x40, :port_config) do port_config_to_atom(0x40) catch _class, _reason -> 64 end def to_atom(_, :port_config) do throw(:bad_enum) end def to_atom(0x1, :port_state) do port_state_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :port_state) do port_state_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x4, :port_state) do port_state_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(_, :port_state) do throw(:bad_enum) end def to_atom(0x1, :port_features) do port_features_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :port_features) do port_features_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x4, :port_features) do port_features_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x8, :port_features) do port_features_to_atom(0x8) catch _class, _reason -> 8 end def to_atom(0x10, :port_features) do port_features_to_atom(0x10) catch _class, _reason -> 16 end def to_atom(0x20, :port_features) do port_features_to_atom(0x20) catch _class, _reason -> 32 end def to_atom(0x40, :port_features) do port_features_to_atom(0x40) catch _class, _reason -> 64 end def to_atom(0x80, :port_features) do port_features_to_atom(0x80) catch _class, _reason -> 128 end def to_atom(0x100, :port_features) do port_features_to_atom(0x100) catch _class, _reason -> 256 end def to_atom(0x200, :port_features) do port_features_to_atom(0x200) catch _class, _reason -> 512 end def to_atom(0x400, :port_features) do port_features_to_atom(0x400) catch _class, _reason -> 1024 end def to_atom(0x800, :port_features) do port_features_to_atom(0x800) catch _class, _reason -> 2048 end def to_atom(0x1000, :port_features) do port_features_to_atom(0x1000) catch _class, _reason -> 4096 end def to_atom(0x2000, :port_features) do port_features_to_atom(0x2000) catch _class, _reason -> 8192 end def to_atom(0x4000, :port_features) do port_features_to_atom(0x4000) catch _class, _reason -> 16384 end def to_atom(0x8000, :port_features) do port_features_to_atom(0x8000) catch _class, _reason -> 32768 end def to_atom(_, :port_features) do throw(:bad_enum) end def to_atom(0xFF00, :openflow10_port_no) do openflow10_port_no_to_atom(0xFF00) catch _class, _reason -> 65280 end def to_atom(0xFFF8, :openflow10_port_no) do openflow10_port_no_to_atom(0xFFF8) catch _class, _reason -> 65528 end def to_atom(0xFFF9, :openflow10_port_no) do openflow10_port_no_to_atom(0xFFF9) catch _class, _reason -> 65529 end def to_atom(0xFFFA, :openflow10_port_no) do openflow10_port_no_to_atom(0xFFFA) catch _class, _reason -> 65530 end def to_atom(0xFFFB, :openflow10_port_no) do openflow10_port_no_to_atom(0xFFFB) catch _class, _reason -> 65531 end def to_atom(0xFFFC, :openflow10_port_no) do openflow10_port_no_to_atom(0xFFFC) catch _class, _reason -> 65532 end def to_atom(0xFFFD, :openflow10_port_no) do openflow10_port_no_to_atom(0xFFFD) catch _class, _reason -> 65533 end def to_atom(0xFFFE, :openflow10_port_no) do openflow10_port_no_to_atom(0xFFFE) catch _class, _reason -> 65534 end def to_atom(0xFFFF, :openflow10_port_no) do openflow10_port_no_to_atom(0xFFFF) catch _class, _reason -> 65535 end def to_atom(_, :openflow10_port_no) do throw(:bad_enum) end def to_atom(0xFFFFFF00, :openflow13_port_no) do openflow13_port_no_to_atom(0xFFFFFF00) catch _class, _reason -> 4_294_967_040 end def to_atom(0xFFFFFFF8, :openflow13_port_no) do openflow13_port_no_to_atom(0xFFFFFFF8) catch _class, _reason -> 4_294_967_288 end def to_atom(0xFFFFFFF9, :openflow13_port_no) do openflow13_port_no_to_atom(0xFFFFFFF9) catch _class, _reason -> 4_294_967_289 end def to_atom(0xFFFFFFFA, :openflow13_port_no) do openflow13_port_no_to_atom(0xFFFFFFFA) catch _class, _reason -> 4_294_967_290 end def to_atom(0xFFFFFFFB, :openflow13_port_no) do openflow13_port_no_to_atom(0xFFFFFFFB) catch _class, _reason -> 4_294_967_291 end def to_atom(0xFFFFFFFC, :openflow13_port_no) do openflow13_port_no_to_atom(0xFFFFFFFC) catch _class, _reason -> 4_294_967_292 end def to_atom(0xFFFFFFFD, :openflow13_port_no) do openflow13_port_no_to_atom(0xFFFFFFFD) catch _class, _reason -> 4_294_967_293 end def to_atom(0xFFFFFFFE, :openflow13_port_no) do openflow13_port_no_to_atom(0xFFFFFFFE) catch _class, _reason -> 4_294_967_294 end def to_atom(0xFFFFFFFF, :openflow13_port_no) do openflow13_port_no_to_atom(0xFFFFFFFF) catch _class, _reason -> 4_294_967_295 end def to_atom(_, :openflow13_port_no) do throw(:bad_enum) end def to_atom(0x0, :packet_in_reason) do packet_in_reason_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :packet_in_reason) do packet_in_reason_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :packet_in_reason) do packet_in_reason_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x3, :packet_in_reason) do packet_in_reason_to_atom(0x3) catch _class, _reason -> 3 end def to_atom(0x4, :packet_in_reason) do packet_in_reason_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x5, :packet_in_reason) do packet_in_reason_to_atom(0x5) catch _class, _reason -> 5 end def to_atom(_, :packet_in_reason) do throw(:bad_enum) end def to_atom(0x1, :packet_in_reason_mask) do packet_in_reason_mask_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :packet_in_reason_mask) do packet_in_reason_mask_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x4, :packet_in_reason_mask) do packet_in_reason_mask_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x8, :packet_in_reason_mask) do packet_in_reason_mask_to_atom(0x8) catch _class, _reason -> 8 end def to_atom(0x10, :packet_in_reason_mask) do packet_in_reason_mask_to_atom(0x10) catch _class, _reason -> 16 end def to_atom(0x20, :packet_in_reason_mask) do packet_in_reason_mask_to_atom(0x20) catch _class, _reason -> 32 end def to_atom(_, :packet_in_reason_mask) do throw(:bad_enum) end def to_atom(0x0, :flow_mod_command) do flow_mod_command_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :flow_mod_command) do flow_mod_command_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :flow_mod_command) do flow_mod_command_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x3, :flow_mod_command) do flow_mod_command_to_atom(0x3) catch _class, _reason -> 3 end def to_atom(0x4, :flow_mod_command) do flow_mod_command_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(_, :flow_mod_command) do throw(:bad_enum) end def to_atom(0x1, :flow_mod_flags) do flow_mod_flags_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :flow_mod_flags) do flow_mod_flags_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x4, :flow_mod_flags) do flow_mod_flags_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x8, :flow_mod_flags) do flow_mod_flags_to_atom(0x8) catch _class, _reason -> 8 end def to_atom(0x10, :flow_mod_flags) do flow_mod_flags_to_atom(0x10) catch _class, _reason -> 16 end def to_atom(_, :flow_mod_flags) do throw(:bad_enum) end def to_atom(0x0, :flow_removed_reason) do flow_removed_reason_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :flow_removed_reason) do flow_removed_reason_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :flow_removed_reason) do flow_removed_reason_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x3, :flow_removed_reason) do flow_removed_reason_to_atom(0x3) catch _class, _reason -> 3 end def to_atom(0x4, :flow_removed_reason) do flow_removed_reason_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x5, :flow_removed_reason) do flow_removed_reason_to_atom(0x5) catch _class, _reason -> 5 end def to_atom(_, :flow_removed_reason) do throw(:bad_enum) end def to_atom(0x1, :flow_removed_reason_mask) do flow_removed_reason_mask_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :flow_removed_reason_mask) do flow_removed_reason_mask_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x4, :flow_removed_reason_mask) do flow_removed_reason_mask_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x8, :flow_removed_reason_mask) do flow_removed_reason_mask_to_atom(0x8) catch _class, _reason -> 8 end def to_atom(0x10, :flow_removed_reason_mask) do flow_removed_reason_mask_to_atom(0x10) catch _class, _reason -> 16 end def to_atom(0x20, :flow_removed_reason_mask) do flow_removed_reason_mask_to_atom(0x20) catch _class, _reason -> 32 end def to_atom(_, :flow_removed_reason_mask) do throw(:bad_enum) end def to_atom(0x0, :port_reason) do port_reason_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :port_reason) do port_reason_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :port_reason) do port_reason_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(_, :port_reason) do throw(:bad_enum) end def to_atom(0x1, :port_reason_mask) do port_reason_mask_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :port_reason_mask) do port_reason_mask_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x4, :port_reason_mask) do port_reason_mask_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(_, :port_reason_mask) do throw(:bad_enum) end def to_atom(0x0, :group_mod_command) do group_mod_command_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :group_mod_command) do group_mod_command_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :group_mod_command) do group_mod_command_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(_, :group_mod_command) do throw(:bad_enum) end def to_atom(0x0, :group_type) do group_type_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :group_type) do group_type_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :group_type) do group_type_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x3, :group_type) do group_type_to_atom(0x3) catch _class, _reason -> 3 end def to_atom(_, :group_type) do throw(:bad_enum) end def to_atom(0x1, :group_type_flags) do group_type_flags_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :group_type_flags) do group_type_flags_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x4, :group_type_flags) do group_type_flags_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x8, :group_type_flags) do group_type_flags_to_atom(0x8) catch _class, _reason -> 8 end def to_atom(_, :group_type_flags) do throw(:bad_enum) end def to_atom(0xFFFFFF00, :group_id) do group_id_to_atom(0xFFFFFF00) catch _class, _reason -> 4_294_967_040 end def to_atom(0xFFFFFFFC, :group_id) do group_id_to_atom(0xFFFFFFFC) catch _class, _reason -> 4_294_967_292 end def to_atom(0xFFFFFFFF, :group_id) do group_id_to_atom(0xFFFFFFFF) catch _class, _reason -> 4_294_967_295 end def to_atom(_, :group_id) do throw(:bad_enum) end def to_atom(0x1, :group_capabilities) do group_capabilities_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :group_capabilities) do group_capabilities_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x4, :group_capabilities) do group_capabilities_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x8, :group_capabilities) do group_capabilities_to_atom(0x8) catch _class, _reason -> 8 end def to_atom(_, :group_capabilities) do throw(:bad_enum) end def to_atom(0xFE, :table_id) do table_id_to_atom(0xFE) catch _class, _reason -> 254 end def to_atom(0xFF, :table_id) do table_id_to_atom(0xFF) catch _class, _reason -> 255 end def to_atom(_, :table_id) do throw(:bad_enum) end def to_atom(0xFFFFFFFF, :queue_id) do queue_id_to_atom(0xFFFFFFFF) catch _class, _reason -> 4_294_967_295 end def to_atom(_, :queue_id) do throw(:bad_enum) end def to_atom(0x0, :meter_mod_command) do meter_mod_command_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :meter_mod_command) do meter_mod_command_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :meter_mod_command) do meter_mod_command_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(_, :meter_mod_command) do throw(:bad_enum) end def to_atom(0xFFFF0000, :meter_id) do meter_id_to_atom(0xFFFF0000) catch _class, _reason -> 4_294_901_760 end def to_atom(0xFFFFFFFD, :meter_id) do meter_id_to_atom(0xFFFFFFFD) catch _class, _reason -> 4_294_967_293 end def to_atom(0xFFFFFFFE, :meter_id) do meter_id_to_atom(0xFFFFFFFE) catch _class, _reason -> 4_294_967_294 end def to_atom(0xFFFFFFFF, :meter_id) do meter_id_to_atom(0xFFFFFFFF) catch _class, _reason -> 4_294_967_295 end def to_atom(_, :meter_id) do throw(:bad_enum) end def to_atom(0x1, :meter_flags) do meter_flags_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :meter_flags) do meter_flags_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x4, :meter_flags) do meter_flags_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x8, :meter_flags) do meter_flags_to_atom(0x8) catch _class, _reason -> 8 end def to_atom(_, :meter_flags) do throw(:bad_enum) end def to_atom(0x1, :meter_band_type) do meter_band_type_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :meter_band_type) do meter_band_type_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0xFFFF, :meter_band_type) do meter_band_type_to_atom(0xFFFF) catch _class, _reason -> 65535 end def to_atom(_, :meter_band_type) do throw(:bad_enum) end def to_atom(0x0, :table_config) do table_config_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :table_config) do table_config_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :table_config) do table_config_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x3, :table_config) do table_config_to_atom(0x3) catch _class, _reason -> 3 end def to_atom(0x4, :table_config) do table_config_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x8, :table_config) do table_config_to_atom(0x8) catch _class, _reason -> 8 end def to_atom(_, :table_config) do throw(:bad_enum) end def to_atom(0x0, :action_type) do action_type_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0xB, :action_type) do action_type_to_atom(0xB) catch _class, _reason -> 11 end def to_atom(0xC, :action_type) do action_type_to_atom(0xC) catch _class, _reason -> 12 end def to_atom(0xF, :action_type) do action_type_to_atom(0xF) catch _class, _reason -> 15 end def to_atom(0x10, :action_type) do action_type_to_atom(0x10) catch _class, _reason -> 16 end def to_atom(0x11, :action_type) do action_type_to_atom(0x11) catch _class, _reason -> 17 end def to_atom(0x12, :action_type) do action_type_to_atom(0x12) catch _class, _reason -> 18 end def to_atom(0x13, :action_type) do action_type_to_atom(0x13) catch _class, _reason -> 19 end def to_atom(0x14, :action_type) do action_type_to_atom(0x14) catch _class, _reason -> 20 end def to_atom(0x15, :action_type) do action_type_to_atom(0x15) catch _class, _reason -> 21 end def to_atom(0x16, :action_type) do action_type_to_atom(0x16) catch _class, _reason -> 22 end def to_atom(0x17, :action_type) do action_type_to_atom(0x17) catch _class, _reason -> 23 end def to_atom(0x18, :action_type) do action_type_to_atom(0x18) catch _class, _reason -> 24 end def to_atom(0x19, :action_type) do action_type_to_atom(0x19) catch _class, _reason -> 25 end def to_atom(0x1A, :action_type) do action_type_to_atom(0x1A) catch _class, _reason -> 26 end def to_atom(0x1B, :action_type) do action_type_to_atom(0x1B) catch _class, _reason -> 27 end def to_atom(0x1C, :action_type) do action_type_to_atom(0x1C) catch _class, _reason -> 28 end def to_atom(0x1D, :action_type) do action_type_to_atom(0x1D) catch _class, _reason -> 29 end def to_atom(0x1E, :action_type) do action_type_to_atom(0x1E) catch _class, _reason -> 30 end def to_atom(0x1F, :action_type) do action_type_to_atom(0x1F) catch _class, _reason -> 31 end def to_atom(0xFFFF, :action_type) do action_type_to_atom(0xFFFF) catch _class, _reason -> 65535 end def to_atom(_, :action_type) do throw(:bad_enum) end def to_atom(0x1, :action_flags) do action_flags_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x800, :action_flags) do action_flags_to_atom(0x800) catch _class, _reason -> 2048 end def to_atom(0x1000, :action_flags) do action_flags_to_atom(0x1000) catch _class, _reason -> 4096 end def to_atom(0x8000, :action_flags) do action_flags_to_atom(0x8000) catch _class, _reason -> 32768 end def to_atom(0x10000, :action_flags) do action_flags_to_atom(0x10000) catch _class, _reason -> 65536 end def to_atom(0x20000, :action_flags) do action_flags_to_atom(0x20000) catch _class, _reason -> 131_072 end def to_atom(0x40000, :action_flags) do action_flags_to_atom(0x40000) catch _class, _reason -> 262_144 end def to_atom(0x80000, :action_flags) do action_flags_to_atom(0x80000) catch _class, _reason -> 524_288 end def to_atom(0x100000, :action_flags) do action_flags_to_atom(0x100000) catch _class, _reason -> 1_048_576 end def to_atom(0x200000, :action_flags) do action_flags_to_atom(0x200000) catch _class, _reason -> 2_097_152 end def to_atom(0x400000, :action_flags) do action_flags_to_atom(0x400000) catch _class, _reason -> 4_194_304 end def to_atom(0x800000, :action_flags) do action_flags_to_atom(0x800000) catch _class, _reason -> 8_388_608 end def to_atom(0x1000000, :action_flags) do action_flags_to_atom(0x1000000) catch _class, _reason -> 16_777_216 end def to_atom(0x2000000, :action_flags) do action_flags_to_atom(0x2000000) catch _class, _reason -> 33_554_432 end def to_atom(0x4000000, :action_flags) do action_flags_to_atom(0x4000000) catch _class, _reason -> 67_108_864 end def to_atom(0x8000000, :action_flags) do action_flags_to_atom(0x8000000) catch _class, _reason -> 134_217_728 end def to_atom(0x10000000, :action_flags) do action_flags_to_atom(0x10000000) catch _class, _reason -> 268_435_456 end def to_atom(0x20000000, :action_flags) do action_flags_to_atom(0x20000000) catch _class, _reason -> 536_870_912 end def to_atom(0x40000000, :action_flags) do action_flags_to_atom(0x40000000) catch _class, _reason -> 1_073_741_824 end def to_atom(0x80000000, :action_flags) do action_flags_to_atom(0x80000000) catch _class, _reason -> 2_147_483_648 end def to_atom(0xFFFF, :action_flags) do action_flags_to_atom(0xFFFF) catch _class, _reason -> 65535 end def to_atom(_, :action_flags) do throw(:bad_enum) end def to_atom(0x2320, :action_vendor) do action_vendor_to_atom(0x2320) catch _class, _reason -> 8992 end def to_atom(0x4F4E4600, :action_vendor) do action_vendor_to_atom(0x4F4E4600) catch _class, _reason -> 1_330_529_792 end def to_atom(_, :action_vendor) do throw(:bad_enum) end def to_atom(0xC80, :onf_ext_action) do onf_ext_action_to_atom(0xC80) catch _class, _reason -> 3200 end def to_atom(_, :onf_ext_action) do throw(:bad_enum) end def to_atom(0x1, :nicira_ext_action) do nicira_ext_action_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :nicira_ext_action) do nicira_ext_action_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x6, :nicira_ext_action) do nicira_ext_action_to_atom(0x6) catch _class, _reason -> 6 end def to_atom(0x7, :nicira_ext_action) do nicira_ext_action_to_atom(0x7) catch _class, _reason -> 7 end def to_atom(0x8, :nicira_ext_action) do nicira_ext_action_to_atom(0x8) catch _class, _reason -> 8 end def to_atom(0x9, :nicira_ext_action) do nicira_ext_action_to_atom(0x9) catch _class, _reason -> 9 end def to_atom(0xA, :nicira_ext_action) do nicira_ext_action_to_atom(0xA) catch _class, _reason -> 10 end def to_atom(0xC, :nicira_ext_action) do nicira_ext_action_to_atom(0xC) catch _class, _reason -> 12 end def to_atom(0xD, :nicira_ext_action) do nicira_ext_action_to_atom(0xD) catch _class, _reason -> 13 end def to_atom(0xE, :nicira_ext_action) do nicira_ext_action_to_atom(0xE) catch _class, _reason -> 14 end def to_atom(0xF, :nicira_ext_action) do nicira_ext_action_to_atom(0xF) catch _class, _reason -> 15 end def to_atom(0x10, :nicira_ext_action) do nicira_ext_action_to_atom(0x10) catch _class, _reason -> 16 end def to_atom(0x11, :nicira_ext_action) do nicira_ext_action_to_atom(0x11) catch _class, _reason -> 17 end def to_atom(0x12, :nicira_ext_action) do nicira_ext_action_to_atom(0x12) catch _class, _reason -> 18 end def to_atom(0x13, :nicira_ext_action) do nicira_ext_action_to_atom(0x13) catch _class, _reason -> 19 end def to_atom(0x14, :nicira_ext_action) do nicira_ext_action_to_atom(0x14) catch _class, _reason -> 20 end def to_atom(0x15, :nicira_ext_action) do nicira_ext_action_to_atom(0x15) catch _class, _reason -> 21 end def to_atom(0x16, :nicira_ext_action) do nicira_ext_action_to_atom(0x16) catch _class, _reason -> 22 end def to_atom(0x1B, :nicira_ext_action) do nicira_ext_action_to_atom(0x1B) catch _class, _reason -> 27 end def to_atom(0x1C, :nicira_ext_action) do nicira_ext_action_to_atom(0x1C) catch _class, _reason -> 28 end def to_atom(0x1D, :nicira_ext_action) do nicira_ext_action_to_atom(0x1D) catch _class, _reason -> 29 end def to_atom(0x20, :nicira_ext_action) do nicira_ext_action_to_atom(0x20) catch _class, _reason -> 32 end def to_atom(0x21, :nicira_ext_action) do nicira_ext_action_to_atom(0x21) catch _class, _reason -> 33 end def to_atom(0x22, :nicira_ext_action) do nicira_ext_action_to_atom(0x22) catch _class, _reason -> 34 end def to_atom(0x23, :nicira_ext_action) do nicira_ext_action_to_atom(0x23) catch _class, _reason -> 35 end def to_atom(0x24, :nicira_ext_action) do nicira_ext_action_to_atom(0x24) catch _class, _reason -> 36 end def to_atom(0x25, :nicira_ext_action) do nicira_ext_action_to_atom(0x25) catch _class, _reason -> 37 end def to_atom(0x26, :nicira_ext_action) do nicira_ext_action_to_atom(0x26) catch _class, _reason -> 38 end def to_atom(0x27, :nicira_ext_action) do nicira_ext_action_to_atom(0x27) catch _class, _reason -> 39 end def to_atom(0x28, :nicira_ext_action) do nicira_ext_action_to_atom(0x28) catch _class, _reason -> 40 end def to_atom(0x29, :nicira_ext_action) do nicira_ext_action_to_atom(0x29) catch _class, _reason -> 41 end def to_atom(0x2A, :nicira_ext_action) do nicira_ext_action_to_atom(0x2A) catch _class, _reason -> 42 end def to_atom(0x2B, :nicira_ext_action) do nicira_ext_action_to_atom(0x2B) catch _class, _reason -> 43 end def to_atom(0x2C, :nicira_ext_action) do nicira_ext_action_to_atom(0x2C) catch _class, _reason -> 44 end def to_atom(0x2D, :nicira_ext_action) do nicira_ext_action_to_atom(0x2D) catch _class, _reason -> 45 end def to_atom(0x2E, :nicira_ext_action) do nicira_ext_action_to_atom(0x2E) catch _class, _reason -> 46 end def to_atom(0x2F, :nicira_ext_action) do nicira_ext_action_to_atom(0x2F) catch _class, _reason -> 47 end def to_atom(0x31, :nicira_ext_action) do nicira_ext_action_to_atom(0x31) catch _class, _reason -> 49 end def to_atom(0xFF, :nicira_ext_action) do nicira_ext_action_to_atom(0xFF) catch _class, _reason -> 255 end def to_atom(_, :nicira_ext_action) do throw(:bad_enum) end def to_atom(0x0, :nx_mp_algorithm) do nx_mp_algorithm_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :nx_mp_algorithm) do nx_mp_algorithm_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :nx_mp_algorithm) do nx_mp_algorithm_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x3, :nx_mp_algorithm) do nx_mp_algorithm_to_atom(0x3) catch _class, _reason -> 3 end def to_atom(_, :nx_mp_algorithm) do throw(:bad_enum) end def to_atom(0x0, :nx_hash_fields) do nx_hash_fields_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :nx_hash_fields) do nx_hash_fields_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :nx_hash_fields) do nx_hash_fields_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x3, :nx_hash_fields) do nx_hash_fields_to_atom(0x3) catch _class, _reason -> 3 end def to_atom(0x4, :nx_hash_fields) do nx_hash_fields_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x5, :nx_hash_fields) do nx_hash_fields_to_atom(0x5) catch _class, _reason -> 5 end def to_atom(_, :nx_hash_fields) do throw(:bad_enum) end def to_atom(0x0, :nx_bd_algorithm) do nx_bd_algorithm_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :nx_bd_algorithm) do nx_bd_algorithm_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(_, :nx_bd_algorithm) do throw(:bad_enum) end def to_atom(0x1, :nx_learn_flag) do nx_learn_flag_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :nx_learn_flag) do nx_learn_flag_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x4, :nx_learn_flag) do nx_learn_flag_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(_, :nx_learn_flag) do throw(:bad_enum) end def to_atom(0x1, :nx_conntrack_flags) do nx_conntrack_flags_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :nx_conntrack_flags) do nx_conntrack_flags_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(_, :nx_conntrack_flags) do throw(:bad_enum) end def to_atom(0x1, :nx_nat_flags) do nx_nat_flags_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :nx_nat_flags) do nx_nat_flags_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x4, :nx_nat_flags) do nx_nat_flags_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x8, :nx_nat_flags) do nx_nat_flags_to_atom(0x8) catch _class, _reason -> 8 end def to_atom(0x10, :nx_nat_flags) do nx_nat_flags_to_atom(0x10) catch _class, _reason -> 16 end def to_atom(_, :nx_nat_flags) do throw(:bad_enum) end def to_atom(0x1, :nx_nat_range) do nx_nat_range_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :nx_nat_range) do nx_nat_range_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x4, :nx_nat_range) do nx_nat_range_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x8, :nx_nat_range) do nx_nat_range_to_atom(0x8) catch _class, _reason -> 8 end def to_atom(0x10, :nx_nat_range) do nx_nat_range_to_atom(0x10) catch _class, _reason -> 16 end def to_atom(0x20, :nx_nat_range) do nx_nat_range_to_atom(0x20) catch _class, _reason -> 32 end def to_atom(_, :nx_nat_range) do throw(:bad_enum) end def to_atom(0x0, :nx_action_controller2_prop_type) do nx_action_controller2_prop_type_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :nx_action_controller2_prop_type) do nx_action_controller2_prop_type_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :nx_action_controller2_prop_type) do nx_action_controller2_prop_type_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x3, :nx_action_controller2_prop_type) do nx_action_controller2_prop_type_to_atom(0x3) catch _class, _reason -> 3 end def to_atom(0x4, :nx_action_controller2_prop_type) do nx_action_controller2_prop_type_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(_, :nx_action_controller2_prop_type) do throw(:bad_enum) end def to_atom(0x0, :nx_action_sample_direction) do nx_action_sample_direction_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :nx_action_sample_direction) do nx_action_sample_direction_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :nx_action_sample_direction) do nx_action_sample_direction_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(_, :nx_action_sample_direction) do throw(:bad_enum) end def to_atom(0x0, :nx_flow_spec_type) do nx_flow_spec_type_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :nx_flow_spec_type) do nx_flow_spec_type_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :nx_flow_spec_type) do nx_flow_spec_type_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(_, :nx_flow_spec_type) do throw(:bad_enum) end def to_atom(0x1, :instruction_type) do instruction_type_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :instruction_type) do instruction_type_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x3, :instruction_type) do instruction_type_to_atom(0x3) catch _class, _reason -> 3 end def to_atom(0x4, :instruction_type) do instruction_type_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x5, :instruction_type) do instruction_type_to_atom(0x5) catch _class, _reason -> 5 end def to_atom(0x6, :instruction_type) do instruction_type_to_atom(0x6) catch _class, _reason -> 6 end def to_atom(0xFFFF, :instruction_type) do instruction_type_to_atom(0xFFFF) catch _class, _reason -> 65535 end def to_atom(_, :instruction_type) do throw(:bad_enum) end def to_atom(0x0, :controller_role) do controller_role_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :controller_role) do controller_role_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :controller_role) do controller_role_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x3, :controller_role) do controller_role_to_atom(0x3) catch _class, _reason -> 3 end def to_atom(_, :controller_role) do throw(:bad_enum) end def to_atom(0x0, :nx_role) do nx_role_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :nx_role) do nx_role_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :nx_role) do nx_role_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(_, :nx_role) do throw(:bad_enum) end def to_atom(0x0, :packet_in_format) do packet_in_format_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :packet_in_format) do packet_in_format_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :packet_in_format) do packet_in_format_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(_, :packet_in_format) do throw(:bad_enum) end def to_atom(0x0, :flow_format) do flow_format_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :flow_format) do flow_format_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(_, :flow_format) do throw(:bad_enum) end def to_atom(0x0, :packet_in2_prop_type) do packet_in2_prop_type_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :packet_in2_prop_type) do packet_in2_prop_type_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :packet_in2_prop_type) do packet_in2_prop_type_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x3, :packet_in2_prop_type) do packet_in2_prop_type_to_atom(0x3) catch _class, _reason -> 3 end def to_atom(0x4, :packet_in2_prop_type) do packet_in2_prop_type_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x5, :packet_in2_prop_type) do packet_in2_prop_type_to_atom(0x5) catch _class, _reason -> 5 end def to_atom(0x6, :packet_in2_prop_type) do packet_in2_prop_type_to_atom(0x6) catch _class, _reason -> 6 end def to_atom(0x7, :packet_in2_prop_type) do packet_in2_prop_type_to_atom(0x7) catch _class, _reason -> 7 end def to_atom(0x8, :packet_in2_prop_type) do packet_in2_prop_type_to_atom(0x8) catch _class, _reason -> 8 end def to_atom(_, :packet_in2_prop_type) do throw(:bad_enum) end def to_atom(0x8000, :continuation_prop_type) do continuation_prop_type_to_atom(0x8000) catch _class, _reason -> 32768 end def to_atom(0x8001, :continuation_prop_type) do continuation_prop_type_to_atom(0x8001) catch _class, _reason -> 32769 end def to_atom(0x8002, :continuation_prop_type) do continuation_prop_type_to_atom(0x8002) catch _class, _reason -> 32770 end def to_atom(0x8003, :continuation_prop_type) do continuation_prop_type_to_atom(0x8003) catch _class, _reason -> 32771 end def to_atom(0x8004, :continuation_prop_type) do continuation_prop_type_to_atom(0x8004) catch _class, _reason -> 32772 end def to_atom(0x8005, :continuation_prop_type) do continuation_prop_type_to_atom(0x8005) catch _class, _reason -> 32773 end def to_atom(0x8006, :continuation_prop_type) do continuation_prop_type_to_atom(0x8006) catch _class, _reason -> 32774 end def to_atom(0x8007, :continuation_prop_type) do continuation_prop_type_to_atom(0x8007) catch _class, _reason -> 32775 end def to_atom(_, :continuation_prop_type) do throw(:bad_enum) end def to_atom(0x1, :flow_monitor_flag) do flow_monitor_flag_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :flow_monitor_flag) do flow_monitor_flag_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x4, :flow_monitor_flag) do flow_monitor_flag_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x8, :flow_monitor_flag) do flow_monitor_flag_to_atom(0x8) catch _class, _reason -> 8 end def to_atom(0x10, :flow_monitor_flag) do flow_monitor_flag_to_atom(0x10) catch _class, _reason -> 16 end def to_atom(0x20, :flow_monitor_flag) do flow_monitor_flag_to_atom(0x20) catch _class, _reason -> 32 end def to_atom(_, :flow_monitor_flag) do throw(:bad_enum) end def to_atom(0x0, :flow_update_event) do flow_update_event_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :flow_update_event) do flow_update_event_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :flow_update_event) do flow_update_event_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x3, :flow_update_event) do flow_update_event_to_atom(0x3) catch _class, _reason -> 3 end def to_atom(_, :flow_update_event) do throw(:bad_enum) end def to_atom(0x0, :tlv_table_mod_command) do tlv_table_mod_command_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :tlv_table_mod_command) do tlv_table_mod_command_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :tlv_table_mod_command) do tlv_table_mod_command_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(_, :tlv_table_mod_command) do throw(:bad_enum) end def to_atom(0x0, :table_feature_prop_type) do table_feature_prop_type_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :table_feature_prop_type) do table_feature_prop_type_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :table_feature_prop_type) do table_feature_prop_type_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x3, :table_feature_prop_type) do table_feature_prop_type_to_atom(0x3) catch _class, _reason -> 3 end def to_atom(0x4, :table_feature_prop_type) do table_feature_prop_type_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x5, :table_feature_prop_type) do table_feature_prop_type_to_atom(0x5) catch _class, _reason -> 5 end def to_atom(0x6, :table_feature_prop_type) do table_feature_prop_type_to_atom(0x6) catch _class, _reason -> 6 end def to_atom(0x7, :table_feature_prop_type) do table_feature_prop_type_to_atom(0x7) catch _class, _reason -> 7 end def to_atom(0x8, :table_feature_prop_type) do table_feature_prop_type_to_atom(0x8) catch _class, _reason -> 8 end def to_atom(0xA, :table_feature_prop_type) do table_feature_prop_type_to_atom(0xA) catch _class, _reason -> 10 end def to_atom(0xC, :table_feature_prop_type) do table_feature_prop_type_to_atom(0xC) catch _class, _reason -> 12 end def to_atom(0xD, :table_feature_prop_type) do table_feature_prop_type_to_atom(0xD) catch _class, _reason -> 13 end def to_atom(0xE, :table_feature_prop_type) do table_feature_prop_type_to_atom(0xE) catch _class, _reason -> 14 end def to_atom(0xF, :table_feature_prop_type) do table_feature_prop_type_to_atom(0xF) catch _class, _reason -> 15 end def to_atom(0xFFFE, :table_feature_prop_type) do table_feature_prop_type_to_atom(0xFFFE) catch _class, _reason -> 65534 end def to_atom(0xFFFF, :table_feature_prop_type) do table_feature_prop_type_to_atom(0xFFFF) catch _class, _reason -> 65535 end def to_atom(_, :table_feature_prop_type) do throw(:bad_enum) end def to_atom(0x0, :bundle_ctrl_type) do bundle_ctrl_type_to_atom(0x0) catch _class, _reason -> 0 end def to_atom(0x1, :bundle_ctrl_type) do bundle_ctrl_type_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :bundle_ctrl_type) do bundle_ctrl_type_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(0x3, :bundle_ctrl_type) do bundle_ctrl_type_to_atom(0x3) catch _class, _reason -> 3 end def to_atom(0x4, :bundle_ctrl_type) do bundle_ctrl_type_to_atom(0x4) catch _class, _reason -> 4 end def to_atom(0x5, :bundle_ctrl_type) do bundle_ctrl_type_to_atom(0x5) catch _class, _reason -> 5 end def to_atom(0x6, :bundle_ctrl_type) do bundle_ctrl_type_to_atom(0x6) catch _class, _reason -> 6 end def to_atom(0x7, :bundle_ctrl_type) do bundle_ctrl_type_to_atom(0x7) catch _class, _reason -> 7 end def to_atom(_, :bundle_ctrl_type) do throw(:bad_enum) end def to_atom(0x1, :bundle_flags) do bundle_flags_to_atom(0x1) catch _class, _reason -> 1 end def to_atom(0x2, :bundle_flags) do bundle_flags_to_atom(0x2) catch _class, _reason -> 2 end def to_atom(_, :bundle_flags) do throw(:bad_enum) end def openflow_codec_to_int(Openflow.Hello), do: 0x0 def openflow_codec_to_int(Openflow.ErrorMsg), do: 0x1 def openflow_codec_to_int(Openflow.Echo.Request), do: 0x2 def openflow_codec_to_int(Openflow.Echo.Reply), do: 0x3 def openflow_codec_to_int(Openflow.Experimenter), do: 0x4 def openflow_codec_to_int(Openflow.Features.Request), do: 0x5 def openflow_codec_to_int(Openflow.Features.Reply), do: 0x6 def openflow_codec_to_int(Openflow.GetConfig.Request), do: 0x7 def openflow_codec_to_int(Openflow.GetConfig.Reply), do: 0x8 def openflow_codec_to_int(Openflow.SetConfig), do: 0x9 def openflow_codec_to_int(Openflow.PacketIn), do: 0xA def openflow_codec_to_int(Openflow.FlowRemoved), do: 0xB def openflow_codec_to_int(Openflow.PortStatus), do: 0xC def openflow_codec_to_int(Openflow.PacketOut), do: 0xD def openflow_codec_to_int(Openflow.FlowMod), do: 0xE def openflow_codec_to_int(Openflow.GroupMod), do: 0xF def openflow_codec_to_int(Openflow.PortMod), do: 0x10 def openflow_codec_to_int(Openflow.TableMod), do: 0x11 def openflow_codec_to_int(Openflow.Multipart.Request), do: 0x12 def openflow_codec_to_int(Openflow.Multipart.Reply), do: 0x13 def openflow_codec_to_int(Openflow.Barrier.Request), do: 0x14 def openflow_codec_to_int(Openflow.Barrier.Reply), do: 0x15 def openflow_codec_to_int(Openflow.Role.Request), do: 0x18 def openflow_codec_to_int(Openflow.Role.Reply), do: 0x19 def openflow_codec_to_int(Openflow.GetAsync.Request), do: 0x1A def openflow_codec_to_int(Openflow.GetAsync.Reply), do: 0x1B def openflow_codec_to_int(Openflow.SetAsync), do: 0x1C def openflow_codec_to_int(Openflow.MeterMod), do: 0x1D def openflow_codec_to_int(_), do: throw(:bad_enum) def openflow_codec_to_atom(0x0), do: Openflow.Hello def openflow_codec_to_atom(0x1), do: Openflow.ErrorMsg def openflow_codec_to_atom(0x2), do: Openflow.Echo.Request def openflow_codec_to_atom(0x3), do: Openflow.Echo.Reply def openflow_codec_to_atom(0x4), do: Openflow.Experimenter def openflow_codec_to_atom(0x5), do: Openflow.Features.Request def openflow_codec_to_atom(0x6), do: Openflow.Features.Reply def openflow_codec_to_atom(0x7), do: Openflow.GetConfig.Request def openflow_codec_to_atom(0x8), do: Openflow.GetConfig.Reply def openflow_codec_to_atom(0x9), do: Openflow.SetConfig def openflow_codec_to_atom(0xA), do: Openflow.PacketIn def openflow_codec_to_atom(0xB), do: Openflow.FlowRemoved def openflow_codec_to_atom(0xC), do: Openflow.PortStatus def openflow_codec_to_atom(0xD), do: Openflow.PacketOut def openflow_codec_to_atom(0xE), do: Openflow.FlowMod def openflow_codec_to_atom(0xF), do: Openflow.GroupMod def openflow_codec_to_atom(0x10), do: Openflow.PortMod def openflow_codec_to_atom(0x11), do: Openflow.TableMod def openflow_codec_to_atom(0x12), do: Openflow.Multipart.Request def openflow_codec_to_atom(0x13), do: Openflow.Multipart.Reply def openflow_codec_to_atom(0x14), do: Openflow.Barrier.Request def openflow_codec_to_atom(0x15), do: Openflow.Barrier.Reply def openflow_codec_to_atom(0x18), do: Openflow.Role.Request def openflow_codec_to_atom(0x19), do: Openflow.Role.Reply def openflow_codec_to_atom(0x1A), do: Openflow.GetAsync.Request def openflow_codec_to_atom(0x1B), do: Openflow.GetAsync.Reply def openflow_codec_to_atom(0x1C), do: Openflow.SetAsync def openflow_codec_to_atom(0x1D), do: Openflow.MeterMod def openflow_codec_to_atom(_), do: throw(:bad_enum) def experimenter_id_to_int(:nicira_ext_message), do: 0x2320 def experimenter_id_to_int(:onf_ext_message), do: 0x4F4E4600 def experimenter_id_to_int(_), do: throw(:bad_enum) def experimenter_id_to_atom(0x2320), do: :nicira_ext_message def experimenter_id_to_atom(0x4F4E4600), do: :onf_ext_message def experimenter_id_to_atom(_), do: throw(:bad_enum) def nicira_ext_message_to_int(Openflow.NxSetPacketInFormat), do: 0x10 def nicira_ext_message_to_int(Openflow.NxSetControllerId), do: 0x14 def nicira_ext_message_to_int(Openflow.NxFlowMonitor.Cancel), do: 0x15 def nicira_ext_message_to_int(Openflow.NxFlowMonitor.Paused), do: 0x16 def nicira_ext_message_to_int(Openflow.NxFlowMonitor.Resumed), do: 0x17 def nicira_ext_message_to_int(Openflow.NxTLVTableMod), do: 0x18 def nicira_ext_message_to_int(Openflow.NxTLVTable.Request), do: 0x19 def nicira_ext_message_to_int(Openflow.NxTLVTable.Reply), do: 0x1A def nicira_ext_message_to_int(Openflow.NxSetAsyncConfig2), do: 0x1B def nicira_ext_message_to_int(Openflow.NxResume), do: 0x1C def nicira_ext_message_to_int(Openflow.NxCtFlushZone), do: 0x1D def nicira_ext_message_to_int(Openflow.NxPacketIn2), do: 0x1E def nicira_ext_message_to_int(_), do: throw(:bad_enum) def nicira_ext_message_to_atom(0x10), do: Openflow.NxSetPacketInFormat def nicira_ext_message_to_atom(0x14), do: Openflow.NxSetControllerId def nicira_ext_message_to_atom(0x15), do: Openflow.NxFlowMonitor.Cancel def nicira_ext_message_to_atom(0x16), do: Openflow.NxFlowMonitor.Paused def nicira_ext_message_to_atom(0x17), do: Openflow.NxFlowMonitor.Resumed def nicira_ext_message_to_atom(0x18), do: Openflow.NxTLVTableMod def nicira_ext_message_to_atom(0x19), do: Openflow.NxTLVTable.Request def nicira_ext_message_to_atom(0x1A), do: Openflow.NxTLVTable.Reply def nicira_ext_message_to_atom(0x1B), do: Openflow.NxSetAsyncConfig2 def nicira_ext_message_to_atom(0x1C), do: Openflow.NxResume def nicira_ext_message_to_atom(0x1D), do: Openflow.NxCtFlushZone def nicira_ext_message_to_atom(0x1E), do: Openflow.NxPacketIn2 def nicira_ext_message_to_atom(_), do: throw(:bad_enum) def onf_ext_message_to_int(Openflow.OnfBundleControl), do: 0x8FC def onf_ext_message_to_int(Openflow.OnfBundleAddMessage), do: 0x8FD def onf_ext_message_to_int(_), do: throw(:bad_enum) def onf_ext_message_to_atom(0x8FC), do: Openflow.OnfBundleControl def onf_ext_message_to_atom(0x8FD), do: Openflow.OnfBundleAddMessage def onf_ext_message_to_atom(_), do: throw(:bad_enum) def multipart_request_flags_to_int(:more), do: 0x1 def multipart_request_flags_to_int(_), do: throw(:bad_enum) def multipart_request_flags_to_atom(0x1), do: :more def multipart_request_flags_to_atom(_), do: throw(:bad_enum) def multipart_reply_flags_to_int(:more), do: 0x1 def multipart_reply_flags_to_int(_), do: throw(:bad_enum) def multipart_reply_flags_to_atom(0x1), do: :more def multipart_reply_flags_to_atom(_), do: throw(:bad_enum) def multipart_request_codec_to_int(Openflow.Multipart.Desc.Request), do: 0x0 def multipart_request_codec_to_int(Openflow.Multipart.Flow.Request), do: 0x1 def multipart_request_codec_to_int(Openflow.Multipart.Aggregate.Request), do: 0x2 def multipart_request_codec_to_int(Openflow.Multipart.Table.Request), do: 0x3 def multipart_request_codec_to_int(Openflow.Multipart.Port.Request), do: 0x4 def multipart_request_codec_to_int(Openflow.Multipart.Queue.Request), do: 0x5 def multipart_request_codec_to_int(Openflow.Multipart.Group.Request), do: 0x6 def multipart_request_codec_to_int(Openflow.Multipart.GroupDesc.Request), do: 0x7 def multipart_request_codec_to_int(Openflow.Multipart.GroupFeatures.Request), do: 0x8 def multipart_request_codec_to_int(Openflow.Multipart.Meter.Request), do: 0x9 def multipart_request_codec_to_int(Openflow.Multipart.MeterConfig.Request), do: 0xA def multipart_request_codec_to_int(Openflow.Multipart.MeterFeatures.Request), do: 0xB def multipart_request_codec_to_int(Openflow.Multipart.TableFeatures.Request), do: 0xC def multipart_request_codec_to_int(Openflow.Multipart.PortDesc.Request), do: 0xD def multipart_request_codec_to_int(Openflow.Multipart.Experimenter.Request), do: 0xFFFF def multipart_request_codec_to_int(_), do: throw(:bad_enum) def multipart_request_codec_to_atom(0x0), do: Openflow.Multipart.Desc.Request def multipart_request_codec_to_atom(0x1), do: Openflow.Multipart.Flow.Request def multipart_request_codec_to_atom(0x2), do: Openflow.Multipart.Aggregate.Request def multipart_request_codec_to_atom(0x3), do: Openflow.Multipart.Table.Request def multipart_request_codec_to_atom(0x4), do: Openflow.Multipart.Port.Request def multipart_request_codec_to_atom(0x5), do: Openflow.Multipart.Queue.Request def multipart_request_codec_to_atom(0x6), do: Openflow.Multipart.Group.Request def multipart_request_codec_to_atom(0x7), do: Openflow.Multipart.GroupDesc.Request def multipart_request_codec_to_atom(0x8), do: Openflow.Multipart.GroupFeatures.Request def multipart_request_codec_to_atom(0x9), do: Openflow.Multipart.Meter.Request def multipart_request_codec_to_atom(0xA), do: Openflow.Multipart.MeterConfig.Request def multipart_request_codec_to_atom(0xB), do: Openflow.Multipart.MeterFeatures.Request def multipart_request_codec_to_atom(0xC), do: Openflow.Multipart.TableFeatures.Request def multipart_request_codec_to_atom(0xD), do: Openflow.Multipart.PortDesc.Request def multipart_request_codec_to_atom(0xFFFF), do: Openflow.Multipart.Experimenter.Request def multipart_request_codec_to_atom(_), do: throw(:bad_enum) def multipart_reply_codec_to_int(Openflow.Multipart.Desc.Reply), do: 0x0 def multipart_reply_codec_to_int(Openflow.Multipart.Flow.Reply), do: 0x1 def multipart_reply_codec_to_int(Openflow.Multipart.Aggregate.Reply), do: 0x2 def multipart_reply_codec_to_int(Openflow.Multipart.Table.Reply), do: 0x3 def multipart_reply_codec_to_int(Openflow.Multipart.Port.Reply), do: 0x4 def multipart_reply_codec_to_int(Openflow.Multipart.Queue.Reply), do: 0x5 def multipart_reply_codec_to_int(Openflow.Multipart.Group.Reply), do: 0x6 def multipart_reply_codec_to_int(Openflow.Multipart.GroupDesc.Reply), do: 0x7 def multipart_reply_codec_to_int(Openflow.Multipart.GroupFeatures.Reply), do: 0x8 def multipart_reply_codec_to_int(Openflow.Multipart.Meter.Reply), do: 0x9 def multipart_reply_codec_to_int(Openflow.Multipart.MeterConfig.Reply), do: 0xA def multipart_reply_codec_to_int(Openflow.Multipart.MeterFeatures.Reply), do: 0xB def multipart_reply_codec_to_int(Openflow.Multipart.TableFeatures.Reply), do: 0xC def multipart_reply_codec_to_int(Openflow.Multipart.PortDesc.Reply), do: 0xD def multipart_reply_codec_to_int(Openflow.Multipart.Experimenter.Reply), do: 0xFFFF def multipart_reply_codec_to_int(_), do: throw(:bad_enum) def multipart_reply_codec_to_atom(0x0), do: Openflow.Multipart.Desc.Reply def multipart_reply_codec_to_atom(0x1), do: Openflow.Multipart.Flow.Reply def multipart_reply_codec_to_atom(0x2), do: Openflow.Multipart.Aggregate.Reply def multipart_reply_codec_to_atom(0x3), do: Openflow.Multipart.Table.Reply def multipart_reply_codec_to_atom(0x4), do: Openflow.Multipart.Port.Reply def multipart_reply_codec_to_atom(0x5), do: Openflow.Multipart.Queue.Reply def multipart_reply_codec_to_atom(0x6), do: Openflow.Multipart.Group.Reply def multipart_reply_codec_to_atom(0x7), do: Openflow.Multipart.GroupDesc.Reply def multipart_reply_codec_to_atom(0x8), do: Openflow.Multipart.GroupFeatures.Reply def multipart_reply_codec_to_atom(0x9), do: Openflow.Multipart.Meter.Reply def multipart_reply_codec_to_atom(0xA), do: Openflow.Multipart.MeterConfig.Reply def multipart_reply_codec_to_atom(0xB), do: Openflow.Multipart.MeterFeatures.Reply def multipart_reply_codec_to_atom(0xC), do: Openflow.Multipart.TableFeatures.Reply def multipart_reply_codec_to_atom(0xD), do: Openflow.Multipart.PortDesc.Reply def multipart_reply_codec_to_atom(0xFFFF), do: Openflow.Multipart.Experimenter.Reply def multipart_reply_codec_to_atom(_), do: throw(:bad_enum) def nicira_ext_stats_to_int(Openflow.Multipart.NxFlow), do: 0x0 def nicira_ext_stats_to_int(Openflow.Multipart.NxAggregate), do: 0x1 def nicira_ext_stats_to_int(Openflow.Multipart.NxFlowMonitor), do: 0x2 def nicira_ext_stats_to_int(Openflow.Multipart.NxIPFIXBridge), do: 0x3 def nicira_ext_stats_to_int(Openflow.Multipart.NxIPFIXFlow), do: 0x4 def nicira_ext_stats_to_int(_), do: throw(:bad_enum) def nicira_ext_stats_to_atom(0x0), do: Openflow.Multipart.NxFlow def nicira_ext_stats_to_atom(0x1), do: Openflow.Multipart.NxAggregate def nicira_ext_stats_to_atom(0x2), do: Openflow.Multipart.NxFlowMonitor def nicira_ext_stats_to_atom(0x3), do: Openflow.Multipart.NxIPFIXBridge def nicira_ext_stats_to_atom(0x4), do: Openflow.Multipart.NxIPFIXFlow def nicira_ext_stats_to_atom(_), do: throw(:bad_enum) def hello_elem_to_int(:versionbitmap), do: 0x1 def hello_elem_to_int(_), do: throw(:bad_enum) def hello_elem_to_atom(0x1), do: :versionbitmap def hello_elem_to_atom(_), do: throw(:bad_enum) def error_type_to_int(:hello_failed), do: 0x0 def error_type_to_int(:bad_request), do: 0x1 def error_type_to_int(:bad_action), do: 0x2 def error_type_to_int(:bad_instruction), do: 0x3 def error_type_to_int(:bad_match), do: 0x4 def error_type_to_int(:flow_mod_failed), do: 0x5 def error_type_to_int(:group_mod_failed), do: 0x6 def error_type_to_int(:port_mod_failed), do: 0x7 def error_type_to_int(:table_mod_failed), do: 0x8 def error_type_to_int(:queue_op_failed), do: 0x9 def error_type_to_int(:switch_config_failed), do: 0xA def error_type_to_int(:role_request_failed), do: 0xB def error_type_to_int(:meter_mod_failed), do: 0xC def error_type_to_int(:table_features_failed), do: 0xD def error_type_to_int(:experimenter), do: 0xFFFF def error_type_to_int(_), do: throw(:bad_enum) def error_type_to_atom(0x0), do: :hello_failed def error_type_to_atom(0x1), do: :bad_request def error_type_to_atom(0x2), do: :bad_action def error_type_to_atom(0x3), do: :bad_instruction def error_type_to_atom(0x4), do: :bad_match def error_type_to_atom(0x5), do: :flow_mod_failed def error_type_to_atom(0x6), do: :group_mod_failed def error_type_to_atom(0x7), do: :port_mod_failed def error_type_to_atom(0x8), do: :table_mod_failed def error_type_to_atom(0x9), do: :queue_op_failed def error_type_to_atom(0xA), do: :switch_config_failed def error_type_to_atom(0xB), do: :role_request_failed def error_type_to_atom(0xC), do: :meter_mod_failed def error_type_to_atom(0xD), do: :table_features_failed def error_type_to_atom(0xFFFF), do: :experimenter def error_type_to_atom(_), do: throw(:bad_enum) def hello_failed_to_int(:inconpatible), do: 0x0 def hello_failed_to_int(:eperm), do: 0x1 def hello_failed_to_int(_), do: throw(:bad_enum) def hello_failed_to_atom(0x0), do: :inconpatible def hello_failed_to_atom(0x1), do: :eperm def hello_failed_to_atom(_), do: throw(:bad_enum) def bad_request_to_int(:bad_version), do: 0x0 def bad_request_to_int(:bad_type), do: 0x1 def bad_request_to_int(:bad_multipart), do: 0x2 def bad_request_to_int(:bad_experimeter), do: 0x3 def bad_request_to_int(:bad_exp_type), do: 0x4 def bad_request_to_int(:eperm), do: 0x5 def bad_request_to_int(:bad_len), do: 0x6 def bad_request_to_int(:buffer_empty), do: 0x7 def bad_request_to_int(:buffer_unknown), do: 0x8 def bad_request_to_int(:bad_table_id), do: 0x9 def bad_request_to_int(:is_slave), do: 0xA def bad_request_to_int(:bad_port), do: 0xB def bad_request_to_int(:bad_packet), do: 0xC def bad_request_to_int(:multipart_buffer_overflow), do: 0xD def bad_request_to_int(:multipart_request_timeout), do: 0xE def bad_request_to_int(:multipart_reply_timeout), do: 0xF def bad_request_to_int(:nxm_invalid), do: 0x100 def bad_request_to_int(:nxm_bad_type), do: 0x101 def bad_request_to_int(:must_be_zero), do: 0x203 def bad_request_to_int(:bad_reason), do: 0x204 def bad_request_to_int(:flow_monitor_bad_event), do: 0x208 def bad_request_to_int(:undecodable_error), do: 0x209 def bad_request_to_int(:resume_not_supported), do: 0x215 def bad_request_to_int(:resume_stale), do: 0x216 def bad_request_to_int(_), do: throw(:bad_enum) def bad_request_to_atom(0x0), do: :bad_version def bad_request_to_atom(0x1), do: :bad_type def bad_request_to_atom(0x2), do: :bad_multipart def bad_request_to_atom(0x3), do: :bad_experimeter def bad_request_to_atom(0x4), do: :bad_exp_type def bad_request_to_atom(0x5), do: :eperm def bad_request_to_atom(0x6), do: :bad_len def bad_request_to_atom(0x7), do: :buffer_empty def bad_request_to_atom(0x8), do: :buffer_unknown def bad_request_to_atom(0x9), do: :bad_table_id def bad_request_to_atom(0xA), do: :is_slave def bad_request_to_atom(0xB), do: :bad_port def bad_request_to_atom(0xC), do: :bad_packet def bad_request_to_atom(0xD), do: :multipart_buffer_overflow def bad_request_to_atom(0xE), do: :multipart_request_timeout def bad_request_to_atom(0xF), do: :multipart_reply_timeout def bad_request_to_atom(0x100), do: :nxm_invalid def bad_request_to_atom(0x101), do: :nxm_bad_type def bad_request_to_atom(0x203), do: :must_be_zero def bad_request_to_atom(0x204), do: :bad_reason def bad_request_to_atom(0x208), do: :flow_monitor_bad_event def bad_request_to_atom(0x209), do: :undecodable_error def bad_request_to_atom(0x215), do: :resume_not_supported def bad_request_to_atom(0x216), do: :resume_stale def bad_request_to_atom(_), do: throw(:bad_enum) def bad_action_to_int(:bad_type), do: 0x0 def bad_action_to_int(:bad_len), do: 0x1 def bad_action_to_int(:bad_experimeter), do: 0x2 def bad_action_to_int(:bad_exp_type), do: 0x3 def bad_action_to_int(:bad_out_port), do: 0x4 def bad_action_to_int(:bad_argument), do: 0x5 def bad_action_to_int(:eperm), do: 0x6 def bad_action_to_int(:too_many), do: 0x7 def bad_action_to_int(:bad_queue), do: 0x8 def bad_action_to_int(:bad_out_group), do: 0x9 def bad_action_to_int(:match_inconsistent), do: 0xA def bad_action_to_int(:unsupported_order), do: 0xB def bad_action_to_int(:bad_tag), do: 0xC def bad_action_to_int(:bad_set_type), do: 0xD def bad_action_to_int(:bad_set_len), do: 0xE def bad_action_to_int(:bad_set_argument), do: 0xF def bad_action_to_int(:must_be_zero), do: 0x100 def bad_action_to_int(:conntrack_datapath_support), do: 0x109 def bad_action_to_int(:bad_conjunction), do: 0x20E def bad_action_to_int(_), do: throw(:bad_enum) def bad_action_to_atom(0x0), do: :bad_type def bad_action_to_atom(0x1), do: :bad_len def bad_action_to_atom(0x2), do: :bad_experimeter def bad_action_to_atom(0x3), do: :bad_exp_type def bad_action_to_atom(0x4), do: :bad_out_port def bad_action_to_atom(0x5), do: :bad_argument def bad_action_to_atom(0x6), do: :eperm def bad_action_to_atom(0x7), do: :too_many def bad_action_to_atom(0x8), do: :bad_queue def bad_action_to_atom(0x9), do: :bad_out_group def bad_action_to_atom(0xA), do: :match_inconsistent def bad_action_to_atom(0xB), do: :unsupported_order def bad_action_to_atom(0xC), do: :bad_tag def bad_action_to_atom(0xD), do: :bad_set_type def bad_action_to_atom(0xE), do: :bad_set_len def bad_action_to_atom(0xF), do: :bad_set_argument def bad_action_to_atom(0x100), do: :must_be_zero def bad_action_to_atom(0x109), do: :conntrack_datapath_support def bad_action_to_atom(0x20E), do: :bad_conjunction def bad_action_to_atom(_), do: throw(:bad_enum) def bad_instruction_to_int(:unknown_instruction), do: 0x0 def bad_instruction_to_int(:unsupported_instruction), do: 0x1 def bad_instruction_to_int(:bad_table_id), do: 0x2 def bad_instruction_to_int(:unsupported_metadata), do: 0x3 def bad_instruction_to_int(:unsupported_metadata_mask), do: 0x4 def bad_instruction_to_int(:bad_experimeter), do: 0x5 def bad_instruction_to_int(:bad_exp_type), do: 0x6 def bad_instruction_to_int(:bad_len), do: 0x7 def bad_instruction_to_int(:eperm), do: 0x8 def bad_instruction_to_int(:dup_inst), do: 0x100 def bad_instruction_to_int(_), do: throw(:bad_enum) def bad_instruction_to_atom(0x0), do: :unknown_instruction def bad_instruction_to_atom(0x1), do: :unsupported_instruction def bad_instruction_to_atom(0x2), do: :bad_table_id def bad_instruction_to_atom(0x3), do: :unsupported_metadata def bad_instruction_to_atom(0x4), do: :unsupported_metadata_mask def bad_instruction_to_atom(0x5), do: :bad_experimeter def bad_instruction_to_atom(0x6), do: :bad_exp_type def bad_instruction_to_atom(0x7), do: :bad_len def bad_instruction_to_atom(0x8), do: :eperm def bad_instruction_to_atom(0x100), do: :dup_inst def bad_instruction_to_atom(_), do: throw(:bad_enum) def bad_match_to_int(:bad_type), do: 0x0 def bad_match_to_int(:bad_len), do: 0x1 def bad_match_to_int(:bad_tag), do: 0x2 def bad_match_to_int(:bad_dl_addr_mask), do: 0x3 def bad_match_to_int(:bad_nw_addr_mask), do: 0x4 def bad_match_to_int(:bad_wildcards), do: 0x5 def bad_match_to_int(:bad_field), do: 0x6 def bad_match_to_int(:bad_value), do: 0x7 def bad_match_to_int(:bad_mask), do: 0x8 def bad_match_to_int(:bad_prereq), do: 0x9 def bad_match_to_int(:dup_field), do: 0xA def bad_match_to_int(:eperm), do: 0xB def bad_match_to_int(:conntrack_datapath_support), do: 0x108 def bad_match_to_int(_), do: throw(:bad_enum) def bad_match_to_atom(0x0), do: :bad_type def bad_match_to_atom(0x1), do: :bad_len def bad_match_to_atom(0x2), do: :bad_tag def bad_match_to_atom(0x3), do: :bad_dl_addr_mask def bad_match_to_atom(0x4), do: :bad_nw_addr_mask def bad_match_to_atom(0x5), do: :bad_wildcards def bad_match_to_atom(0x6), do: :bad_field def bad_match_to_atom(0x7), do: :bad_value def bad_match_to_atom(0x8), do: :bad_mask def bad_match_to_atom(0x9), do: :bad_prereq def bad_match_to_atom(0xA), do: :dup_field def bad_match_to_atom(0xB), do: :eperm def bad_match_to_atom(0x108), do: :conntrack_datapath_support def bad_match_to_atom(_), do: throw(:bad_enum) def flow_mod_failed_to_int(:unknown), do: 0x0 def flow_mod_failed_to_int(:table_full), do: 0x1 def flow_mod_failed_to_int(:bad_table_id), do: 0x2 def flow_mod_failed_to_int(:overlap), do: 0x3 def flow_mod_failed_to_int(:eperm), do: 0x4 def flow_mod_failed_to_int(:bad_timeout), do: 0x5 def flow_mod_failed_to_int(:bad_command), do: 0x6 def flow_mod_failed_to_int(:bad_flags), do: 0x7 def flow_mod_failed_to_int(_), do: throw(:bad_enum) def flow_mod_failed_to_atom(0x0), do: :unknown def flow_mod_failed_to_atom(0x1), do: :table_full def flow_mod_failed_to_atom(0x2), do: :bad_table_id def flow_mod_failed_to_atom(0x3), do: :overlap def flow_mod_failed_to_atom(0x4), do: :eperm def flow_mod_failed_to_atom(0x5), do: :bad_timeout def flow_mod_failed_to_atom(0x6), do: :bad_command def flow_mod_failed_to_atom(0x7), do: :bad_flags def flow_mod_failed_to_atom(_), do: throw(:bad_enum) def group_mod_failed_to_int(:group_exists), do: 0x0 def group_mod_failed_to_int(:invalid_group), do: 0x1 def group_mod_failed_to_int(:weight_unsupported), do: 0x2 def group_mod_failed_to_int(:out_of_groups), do: 0x3 def group_mod_failed_to_int(:ouf_of_buckets), do: 0x4 def group_mod_failed_to_int(:chaining_unsupported), do: 0x5 def group_mod_failed_to_int(:watch_unsupported), do: 0x6 def group_mod_failed_to_int(:loop), do: 0x7 def group_mod_failed_to_int(:unknown_group), do: 0x8 def group_mod_failed_to_int(:chained_group), do: 0x9 def group_mod_failed_to_int(:bad_type), do: 0xA def group_mod_failed_to_int(:bad_command), do: 0xB def group_mod_failed_to_int(:bad_bucket), do: 0xC def group_mod_failed_to_int(:bad_watch), do: 0xD def group_mod_failed_to_int(:eperm), do: 0xE def group_mod_failed_to_int(:unknown_bucket), do: 0xF def group_mod_failed_to_int(:bucket_exists), do: 0x10 def group_mod_failed_to_int(_), do: throw(:bad_enum) def group_mod_failed_to_atom(0x0), do: :group_exists def group_mod_failed_to_atom(0x1), do: :invalid_group def group_mod_failed_to_atom(0x2), do: :weight_unsupported def group_mod_failed_to_atom(0x3), do: :out_of_groups def group_mod_failed_to_atom(0x4), do: :ouf_of_buckets def group_mod_failed_to_atom(0x5), do: :chaining_unsupported def group_mod_failed_to_atom(0x6), do: :watch_unsupported def group_mod_failed_to_atom(0x7), do: :loop def group_mod_failed_to_atom(0x8), do: :unknown_group def group_mod_failed_to_atom(0x9), do: :chained_group def group_mod_failed_to_atom(0xA), do: :bad_type def group_mod_failed_to_atom(0xB), do: :bad_command def group_mod_failed_to_atom(0xC), do: :bad_bucket def group_mod_failed_to_atom(0xD), do: :bad_watch def group_mod_failed_to_atom(0xE), do: :eperm def group_mod_failed_to_atom(0xF), do: :unknown_bucket def group_mod_failed_to_atom(0x10), do: :bucket_exists def group_mod_failed_to_atom(_), do: throw(:bad_enum) def port_mod_failed_to_int(:bad_port), do: 0x0 def port_mod_failed_to_int(:bad_hw_addr), do: 0x1 def port_mod_failed_to_int(:bad_config), do: 0x2 def port_mod_failed_to_int(:bad_advertise), do: 0x3 def port_mod_failed_to_int(:eperm), do: 0x4 def port_mod_failed_to_int(_), do: throw(:bad_enum) def port_mod_failed_to_atom(0x0), do: :bad_port def port_mod_failed_to_atom(0x1), do: :bad_hw_addr def port_mod_failed_to_atom(0x2), do: :bad_config def port_mod_failed_to_atom(0x3), do: :bad_advertise def port_mod_failed_to_atom(0x4), do: :eperm def port_mod_failed_to_atom(_), do: throw(:bad_enum) def table_mod_failed_to_int(:bad_table), do: 0x0 def table_mod_failed_to_int(:bad_config), do: 0x1 def table_mod_failed_to_int(:eperm), do: 0x2 def table_mod_failed_to_int(_), do: throw(:bad_enum) def table_mod_failed_to_atom(0x0), do: :bad_table def table_mod_failed_to_atom(0x1), do: :bad_config def table_mod_failed_to_atom(0x2), do: :eperm def table_mod_failed_to_atom(_), do: throw(:bad_enum) def queue_op_failed_to_int(:bad_port), do: 0x0 def queue_op_failed_to_int(:bad_queue), do: 0x1 def queue_op_failed_to_int(:eperm), do: 0x2 def queue_op_failed_to_int(_), do: throw(:bad_enum) def queue_op_failed_to_atom(0x0), do: :bad_port def queue_op_failed_to_atom(0x1), do: :bad_queue def queue_op_failed_to_atom(0x2), do: :eperm def queue_op_failed_to_atom(_), do: throw(:bad_enum) def switch_config_failed_to_int(:bad_flags), do: 0x0 def switch_config_failed_to_int(:bad_len), do: 0x1 def switch_config_failed_to_int(:eperm), do: 0x2 def switch_config_failed_to_int(_), do: throw(:bad_enum) def switch_config_failed_to_atom(0x0), do: :bad_flags def switch_config_failed_to_atom(0x1), do: :bad_len def switch_config_failed_to_atom(0x2), do: :eperm def switch_config_failed_to_atom(_), do: throw(:bad_enum) def role_request_failed_to_int(:stale), do: 0x0 def role_request_failed_to_int(:unsup), do: 0x1 def role_request_failed_to_int(:bad_role), do: 0x2 def role_request_failed_to_int(_), do: throw(:bad_enum) def role_request_failed_to_atom(0x0), do: :stale def role_request_failed_to_atom(0x1), do: :unsup def role_request_failed_to_atom(0x2), do: :bad_role def role_request_failed_to_atom(_), do: throw(:bad_enum) def meter_mod_failed_to_int(:unknown), do: 0x0 def meter_mod_failed_to_int(:meter_exists), do: 0x1 def meter_mod_failed_to_int(:invalid_meter), do: 0x2 def meter_mod_failed_to_int(:unknown_meter), do: 0x3 def meter_mod_failed_to_int(:bad_command), do: 0x4 def meter_mod_failed_to_int(:bad_flags), do: 0x5 def meter_mod_failed_to_int(:bad_rate), do: 0x6 def meter_mod_failed_to_int(:bad_burst), do: 0x7 def meter_mod_failed_to_int(:bad_band), do: 0x8 def meter_mod_failed_to_int(:bad_band_value), do: 0x9 def meter_mod_failed_to_int(:out_of_meters), do: 0xA def meter_mod_failed_to_int(:out_of_bands), do: 0xB def meter_mod_failed_to_int(_), do: throw(:bad_enum) def meter_mod_failed_to_atom(0x0), do: :unknown def meter_mod_failed_to_atom(0x1), do: :meter_exists def meter_mod_failed_to_atom(0x2), do: :invalid_meter def meter_mod_failed_to_atom(0x3), do: :unknown_meter def meter_mod_failed_to_atom(0x4), do: :bad_command def meter_mod_failed_to_atom(0x5), do: :bad_flags def meter_mod_failed_to_atom(0x6), do: :bad_rate def meter_mod_failed_to_atom(0x7), do: :bad_burst def meter_mod_failed_to_atom(0x8), do: :bad_band def meter_mod_failed_to_atom(0x9), do: :bad_band_value def meter_mod_failed_to_atom(0xA), do: :out_of_meters def meter_mod_failed_to_atom(0xB), do: :out_of_bands def meter_mod_failed_to_atom(_), do: throw(:bad_enum) def table_features_failed_to_int(:bad_table), do: 0x0 def table_features_failed_to_int(:bad_metadata), do: 0x1 def table_features_failed_to_int(:bad_type), do: 0x2 def table_features_failed_to_int(:bad_len), do: 0x3 def table_features_failed_to_int(:bad_argument), do: 0x4 def table_features_failed_to_int(:eperm), do: 0x5 def table_features_failed_to_int(_), do: throw(:bad_enum) def table_features_failed_to_atom(0x0), do: :bad_table def table_features_failed_to_atom(0x1), do: :bad_metadata def table_features_failed_to_atom(0x2), do: :bad_type def table_features_failed_to_atom(0x3), do: :bad_len def table_features_failed_to_atom(0x4), do: :bad_argument def table_features_failed_to_atom(0x5), do: :eperm def table_features_failed_to_atom(_), do: throw(:bad_enum) def switch_capabilities_to_int(:flow_stats), do: 0x1 def switch_capabilities_to_int(:table_stats), do: 0x2 def switch_capabilities_to_int(:port_stats), do: 0x4 def switch_capabilities_to_int(:group_stats), do: 0x8 def switch_capabilities_to_int(:ip_reasm), do: 0x20 def switch_capabilities_to_int(:queue_stats), do: 0x40 def switch_capabilities_to_int(:arp_match_ip), do: 0x80 def switch_capabilities_to_int(:port_blocked), do: 0x100 def switch_capabilities_to_int(_), do: throw(:bad_enum) def switch_capabilities_to_atom(0x1), do: :flow_stats def switch_capabilities_to_atom(0x2), do: :table_stats def switch_capabilities_to_atom(0x4), do: :port_stats def switch_capabilities_to_atom(0x8), do: :group_stats def switch_capabilities_to_atom(0x20), do: :ip_reasm def switch_capabilities_to_atom(0x40), do: :queue_stats def switch_capabilities_to_atom(0x80), do: :arp_match_ip def switch_capabilities_to_atom(0x100), do: :port_blocked def switch_capabilities_to_atom(_), do: throw(:bad_enum) def config_flags_to_int(:fragment_drop), do: 0x1 def config_flags_to_int(:fragment_reassemble), do: 0x2 def config_flags_to_int(_), do: throw(:bad_enum) def config_flags_to_atom(0x1), do: :fragment_drop def config_flags_to_atom(0x2), do: :fragment_reassemble def config_flags_to_atom(_), do: throw(:bad_enum) def controller_max_len_to_int(:max), do: 0xFFE5 def controller_max_len_to_int(:no_buffer), do: 0xFFFF def controller_max_len_to_int(_), do: throw(:bad_enum) def controller_max_len_to_atom(0xFFE5), do: :max def controller_max_len_to_atom(0xFFFF), do: :no_buffer def controller_max_len_to_atom(_), do: throw(:bad_enum) def experimenter_oxm_vendors_to_int(:nxoxm_nsh_match), do: 0x5AD650 def experimenter_oxm_vendors_to_int(:nxoxm_match), do: 0x2320 def experimenter_oxm_vendors_to_int(:hp_ext_match), do: 0x2428 def experimenter_oxm_vendors_to_int(:onf_ext_match), do: 0x4F4E4600 def experimenter_oxm_vendors_to_int(_), do: throw(:bad_enum) def experimenter_oxm_vendors_to_atom(0x5AD650), do: :nxoxm_nsh_match def experimenter_oxm_vendors_to_atom(0x2320), do: :nxoxm_match def experimenter_oxm_vendors_to_atom(0x2428), do: :hp_ext_match def experimenter_oxm_vendors_to_atom(0x4F4E4600), do: :onf_ext_match def experimenter_oxm_vendors_to_atom(_), do: throw(:bad_enum) def match_type_to_int(:standard), do: 0x0 def match_type_to_int(:oxm), do: 0x1 def match_type_to_int(_), do: throw(:bad_enum) def match_type_to_atom(0x0), do: :standard def match_type_to_atom(0x1), do: :oxm def match_type_to_atom(_), do: throw(:bad_enum) def oxm_class_to_int(:nxm_0), do: 0x0 def oxm_class_to_int(:nxm_1), do: 0x1 def oxm_class_to_int(:openflow_basic), do: 0x8000 def oxm_class_to_int(:packet_register), do: 0x8001 def oxm_class_to_int(:experimenter), do: 0xFFFF def oxm_class_to_int(_), do: throw(:bad_enum) def oxm_class_to_atom(0x0), do: :nxm_0 def oxm_class_to_atom(0x1), do: :nxm_1 def oxm_class_to_atom(0x8000), do: :openflow_basic def oxm_class_to_atom(0x8001), do: :packet_register def oxm_class_to_atom(0xFFFF), do: :experimenter def oxm_class_to_atom(_), do: throw(:bad_enum) def nxm_0_to_int(:nx_in_port), do: 0x0 def nxm_0_to_int(:nx_eth_dst), do: 0x1 def nxm_0_to_int(:nx_eth_src), do: 0x2 def nxm_0_to_int(:nx_eth_type), do: 0x3 def nxm_0_to_int(:nx_vlan_tci), do: 0x4 def nxm_0_to_int(:nx_ip_tos), do: 0x5 def nxm_0_to_int(:nx_ip_proto), do: 0x6 def nxm_0_to_int(:nx_ipv4_src), do: 0x7 def nxm_0_to_int(:nx_ipv4_dst), do: 0x8 def nxm_0_to_int(:nx_tcp_src), do: 0x9 def nxm_0_to_int(:nx_tcp_dst), do: 0xA def nxm_0_to_int(:nx_udp_src), do: 0xB def nxm_0_to_int(:nx_udp_dst), do: 0xC def nxm_0_to_int(:nx_icmpv4_type), do: 0xD def nxm_0_to_int(:nx_icmpv4_code), do: 0xE def nxm_0_to_int(:nx_arp_op), do: 0xF def nxm_0_to_int(:nx_arp_spa), do: 0x10 def nxm_0_to_int(:nx_arp_tpa), do: 0x11 def nxm_0_to_int(:nx_tcp_flags), do: 0x22 def nxm_0_to_int(_), do: throw(:bad_enum) def nxm_0_to_atom(0x0), do: :nx_in_port def nxm_0_to_atom(0x1), do: :nx_eth_dst def nxm_0_to_atom(0x2), do: :nx_eth_src def nxm_0_to_atom(0x3), do: :nx_eth_type def nxm_0_to_atom(0x4), do: :nx_vlan_tci def nxm_0_to_atom(0x5), do: :nx_ip_tos def nxm_0_to_atom(0x6), do: :nx_ip_proto def nxm_0_to_atom(0x7), do: :nx_ipv4_src def nxm_0_to_atom(0x8), do: :nx_ipv4_dst def nxm_0_to_atom(0x9), do: :nx_tcp_src def nxm_0_to_atom(0xA), do: :nx_tcp_dst def nxm_0_to_atom(0xB), do: :nx_udp_src def nxm_0_to_atom(0xC), do: :nx_udp_dst def nxm_0_to_atom(0xD), do: :nx_icmpv4_type def nxm_0_to_atom(0xE), do: :nx_icmpv4_code def nxm_0_to_atom(0xF), do: :nx_arp_op def nxm_0_to_atom(0x10), do: :nx_arp_spa def nxm_0_to_atom(0x11), do: :nx_arp_tpa def nxm_0_to_atom(0x22), do: :nx_tcp_flags def nxm_0_to_atom(_), do: throw(:bad_enum) def nxm_1_to_int(:reg0), do: 0x0 def nxm_1_to_int(:reg1), do: 0x1 def nxm_1_to_int(:reg2), do: 0x2 def nxm_1_to_int(:reg3), do: 0x3 def nxm_1_to_int(:reg4), do: 0x4 def nxm_1_to_int(:reg5), do: 0x5 def nxm_1_to_int(:reg6), do: 0x6 def nxm_1_to_int(:reg7), do: 0x7 def nxm_1_to_int(:reg8), do: 0x8 def nxm_1_to_int(:reg9), do: 0x9 def nxm_1_to_int(:reg10), do: 0xA def nxm_1_to_int(:reg11), do: 0xB def nxm_1_to_int(:reg12), do: 0xC def nxm_1_to_int(:reg13), do: 0xD def nxm_1_to_int(:reg14), do: 0xE def nxm_1_to_int(:reg15), do: 0xF def nxm_1_to_int(:tun_id), do: 0x10 def nxm_1_to_int(:nx_arp_sha), do: 0x11 def nxm_1_to_int(:nx_arp_tha), do: 0x12 def nxm_1_to_int(:nx_ipv6_src), do: 0x13 def nxm_1_to_int(:nx_ipv6_dst), do: 0x14 def nxm_1_to_int(:nx_icmpv6_type), do: 0x15 def nxm_1_to_int(:nx_icmpv6_code), do: 0x16 def nxm_1_to_int(:nx_ipv6_nd_target), do: 0x17 def nxm_1_to_int(:nx_ipv6_nd_sll), do: 0x18 def nxm_1_to_int(:nx_ipv6_nd_tll), do: 0x19 def nxm_1_to_int(:nx_ip_frag), do: 0x1A def nxm_1_to_int(:nx_ipv6_label), do: 0x1B def nxm_1_to_int(:nx_ip_ecn), do: 0x1C def nxm_1_to_int(:nx_ip_ttl), do: 0x1D def nxm_1_to_int(:nx_mpls_ttl), do: 0x1E def nxm_1_to_int(:tun_src), do: 0x1F def nxm_1_to_int(:tun_dst), do: 0x20 def nxm_1_to_int(:pkt_mark), do: 0x21 def nxm_1_to_int(:dp_hash), do: 0x23 def nxm_1_to_int(:recirc_id), do: 0x24 def nxm_1_to_int(:conj_id), do: 0x25 def nxm_1_to_int(:tun_gbp_id), do: 0x26 def nxm_1_to_int(:tun_gbp_flags), do: 0x27 def nxm_1_to_int(:tun_metadata0), do: 0x28 def nxm_1_to_int(:tun_metadata1), do: 0x29 def nxm_1_to_int(:tun_metadata2), do: 0x2A def nxm_1_to_int(:tun_metadata3), do: 0x2B def nxm_1_to_int(:tun_metadata4), do: 0x2C def nxm_1_to_int(:tun_metadata5), do: 0x2D def nxm_1_to_int(:tun_metadata6), do: 0x2E def nxm_1_to_int(:tun_metadata7), do: 0x2F def nxm_1_to_int(:tun_metadata8), do: 0x30 def nxm_1_to_int(:tun_metadata9), do: 0x31 def nxm_1_to_int(:tun_metadata10), do: 0x32 def nxm_1_to_int(:tun_metadata11), do: 0x33 def nxm_1_to_int(:tun_metadata12), do: 0x34 def nxm_1_to_int(:tun_metadata13), do: 0x35 def nxm_1_to_int(:tun_metadata14), do: 0x36 def nxm_1_to_int(:tun_metadata15), do: 0x37 def nxm_1_to_int(:tun_metadata16), do: 0x38 def nxm_1_to_int(:tun_metadata17), do: 0x39 def nxm_1_to_int(:tun_metadata18), do: 0x3A def nxm_1_to_int(:tun_metadata19), do: 0x3B def nxm_1_to_int(:tun_metadata20), do: 0x3C def nxm_1_to_int(:tun_metadata21), do: 0x3D def nxm_1_to_int(:tun_metadata22), do: 0x3E def nxm_1_to_int(:tun_metadata23), do: 0x3F def nxm_1_to_int(:tun_metadata24), do: 0x40 def nxm_1_to_int(:tun_metadata25), do: 0x41 def nxm_1_to_int(:tun_metadata26), do: 0x42 def nxm_1_to_int(:tun_metadata27), do: 0x43 def nxm_1_to_int(:tun_metadata28), do: 0x44 def nxm_1_to_int(:tun_metadata29), do: 0x45 def nxm_1_to_int(:tun_metadata30), do: 0x46 def nxm_1_to_int(:tun_metadata31), do: 0x47 def nxm_1_to_int(:tun_metadata32), do: 0x48 def nxm_1_to_int(:tun_metadata33), do: 0x49 def nxm_1_to_int(:tun_metadata34), do: 0x4A def nxm_1_to_int(:tun_metadata35), do: 0x4B def nxm_1_to_int(:tun_metadata36), do: 0x4C def nxm_1_to_int(:tun_metadata37), do: 0x4D def nxm_1_to_int(:tun_metadata38), do: 0x4E def nxm_1_to_int(:tun_metadata39), do: 0x4F def nxm_1_to_int(:tun_metadata40), do: 0x50 def nxm_1_to_int(:tun_metadata41), do: 0x51 def nxm_1_to_int(:tun_metadata42), do: 0x52 def nxm_1_to_int(:tun_metadata43), do: 0x53 def nxm_1_to_int(:tun_metadata44), do: 0x54 def nxm_1_to_int(:tun_metadata45), do: 0x55 def nxm_1_to_int(:tun_metadata46), do: 0x56 def nxm_1_to_int(:tun_metadata47), do: 0x57 def nxm_1_to_int(:tun_metadata48), do: 0x58 def nxm_1_to_int(:tun_metadata49), do: 0x59 def nxm_1_to_int(:tun_metadata50), do: 0x5A def nxm_1_to_int(:tun_metadata51), do: 0x5B def nxm_1_to_int(:tun_metadata52), do: 0x5C def nxm_1_to_int(:tun_metadata53), do: 0x5D def nxm_1_to_int(:tun_metadata54), do: 0x5E def nxm_1_to_int(:tun_metadata55), do: 0x5F def nxm_1_to_int(:tun_metadata56), do: 0x60 def nxm_1_to_int(:tun_metadata57), do: 0x61 def nxm_1_to_int(:tun_metadata58), do: 0x62 def nxm_1_to_int(:tun_metadata59), do: 0x63 def nxm_1_to_int(:tun_metadata60), do: 0x64 def nxm_1_to_int(:tun_metadata61), do: 0x65 def nxm_1_to_int(:tun_metadata62), do: 0x66 def nxm_1_to_int(:tun_metadata63), do: 0x67 def nxm_1_to_int(:tun_flags), do: 0x68 def nxm_1_to_int(:ct_state), do: 0x69 def nxm_1_to_int(:ct_zone), do: 0x6A def nxm_1_to_int(:ct_mark), do: 0x6B def nxm_1_to_int(:ct_label), do: 0x6C def nxm_1_to_int(:tun_ipv6_src), do: 0x6D def nxm_1_to_int(:tun_ipv6_dst), do: 0x6E def nxm_1_to_int(:xxreg0), do: 0x6F def nxm_1_to_int(:xxreg1), do: 0x70 def nxm_1_to_int(:xxreg2), do: 0x71 def nxm_1_to_int(:xxreg3), do: 0x72 def nxm_1_to_int(:xxreg4), do: 0x73 def nxm_1_to_int(:xxreg5), do: 0x74 def nxm_1_to_int(:xxreg6), do: 0x75 def nxm_1_to_int(:xxreg7), do: 0x76 def nxm_1_to_int(:ct_nw_proto), do: 0x77 def nxm_1_to_int(:ct_nw_src), do: 0x78 def nxm_1_to_int(:ct_nw_dst), do: 0x79 def nxm_1_to_int(:ct_ipv6_src), do: 0x7A def nxm_1_to_int(:ct_ipv6_dst), do: 0x7B def nxm_1_to_int(:ct_tp_src), do: 0x7C def nxm_1_to_int(:ct_tp_dst), do: 0x7D def nxm_1_to_int(_), do: throw(:bad_enum) def nxm_1_to_atom(0x0), do: :reg0 def nxm_1_to_atom(0x1), do: :reg1 def nxm_1_to_atom(0x2), do: :reg2 def nxm_1_to_atom(0x3), do: :reg3 def nxm_1_to_atom(0x4), do: :reg4 def nxm_1_to_atom(0x5), do: :reg5 def nxm_1_to_atom(0x6), do: :reg6 def nxm_1_to_atom(0x7), do: :reg7 def nxm_1_to_atom(0x8), do: :reg8 def nxm_1_to_atom(0x9), do: :reg9 def nxm_1_to_atom(0xA), do: :reg10 def nxm_1_to_atom(0xB), do: :reg11 def nxm_1_to_atom(0xC), do: :reg12 def nxm_1_to_atom(0xD), do: :reg13 def nxm_1_to_atom(0xE), do: :reg14 def nxm_1_to_atom(0xF), do: :reg15 def nxm_1_to_atom(0x10), do: :tun_id def nxm_1_to_atom(0x11), do: :nx_arp_sha def nxm_1_to_atom(0x12), do: :nx_arp_tha def nxm_1_to_atom(0x13), do: :nx_ipv6_src def nxm_1_to_atom(0x14), do: :nx_ipv6_dst def nxm_1_to_atom(0x15), do: :nx_icmpv6_type def nxm_1_to_atom(0x16), do: :nx_icmpv6_code def nxm_1_to_atom(0x17), do: :nx_ipv6_nd_target def nxm_1_to_atom(0x18), do: :nx_ipv6_nd_sll def nxm_1_to_atom(0x19), do: :nx_ipv6_nd_tll def nxm_1_to_atom(0x1A), do: :nx_ip_frag def nxm_1_to_atom(0x1B), do: :nx_ipv6_label def nxm_1_to_atom(0x1C), do: :nx_ip_ecn def nxm_1_to_atom(0x1D), do: :nx_ip_ttl def nxm_1_to_atom(0x1E), do: :nx_mpls_ttl def nxm_1_to_atom(0x1F), do: :tun_src def nxm_1_to_atom(0x20), do: :tun_dst def nxm_1_to_atom(0x21), do: :pkt_mark def nxm_1_to_atom(0x23), do: :dp_hash def nxm_1_to_atom(0x24), do: :recirc_id def nxm_1_to_atom(0x25), do: :conj_id def nxm_1_to_atom(0x26), do: :tun_gbp_id def nxm_1_to_atom(0x27), do: :tun_gbp_flags def nxm_1_to_atom(0x28), do: :tun_metadata0 def nxm_1_to_atom(0x29), do: :tun_metadata1 def nxm_1_to_atom(0x2A), do: :tun_metadata2 def nxm_1_to_atom(0x2B), do: :tun_metadata3 def nxm_1_to_atom(0x2C), do: :tun_metadata4 def nxm_1_to_atom(0x2D), do: :tun_metadata5 def nxm_1_to_atom(0x2E), do: :tun_metadata6 def nxm_1_to_atom(0x2F), do: :tun_metadata7 def nxm_1_to_atom(0x30), do: :tun_metadata8 def nxm_1_to_atom(0x31), do: :tun_metadata9 def nxm_1_to_atom(0x32), do: :tun_metadata10 def nxm_1_to_atom(0x33), do: :tun_metadata11 def nxm_1_to_atom(0x34), do: :tun_metadata12 def nxm_1_to_atom(0x35), do: :tun_metadata13 def nxm_1_to_atom(0x36), do: :tun_metadata14 def nxm_1_to_atom(0x37), do: :tun_metadata15 def nxm_1_to_atom(0x38), do: :tun_metadata16 def nxm_1_to_atom(0x39), do: :tun_metadata17 def nxm_1_to_atom(0x3A), do: :tun_metadata18 def nxm_1_to_atom(0x3B), do: :tun_metadata19 def nxm_1_to_atom(0x3C), do: :tun_metadata20 def nxm_1_to_atom(0x3D), do: :tun_metadata21 def nxm_1_to_atom(0x3E), do: :tun_metadata22 def nxm_1_to_atom(0x3F), do: :tun_metadata23 def nxm_1_to_atom(0x40), do: :tun_metadata24 def nxm_1_to_atom(0x41), do: :tun_metadata25 def nxm_1_to_atom(0x42), do: :tun_metadata26 def nxm_1_to_atom(0x43), do: :tun_metadata27 def nxm_1_to_atom(0x44), do: :tun_metadata28 def nxm_1_to_atom(0x45), do: :tun_metadata29 def nxm_1_to_atom(0x46), do: :tun_metadata30 def nxm_1_to_atom(0x47), do: :tun_metadata31 def nxm_1_to_atom(0x48), do: :tun_metadata32 def nxm_1_to_atom(0x49), do: :tun_metadata33 def nxm_1_to_atom(0x4A), do: :tun_metadata34 def nxm_1_to_atom(0x4B), do: :tun_metadata35 def nxm_1_to_atom(0x4C), do: :tun_metadata36 def nxm_1_to_atom(0x4D), do: :tun_metadata37 def nxm_1_to_atom(0x4E), do: :tun_metadata38 def nxm_1_to_atom(0x4F), do: :tun_metadata39 def nxm_1_to_atom(0x50), do: :tun_metadata40 def nxm_1_to_atom(0x51), do: :tun_metadata41 def nxm_1_to_atom(0x52), do: :tun_metadata42 def nxm_1_to_atom(0x53), do: :tun_metadata43 def nxm_1_to_atom(0x54), do: :tun_metadata44 def nxm_1_to_atom(0x55), do: :tun_metadata45 def nxm_1_to_atom(0x56), do: :tun_metadata46 def nxm_1_to_atom(0x57), do: :tun_metadata47 def nxm_1_to_atom(0x58), do: :tun_metadata48 def nxm_1_to_atom(0x59), do: :tun_metadata49 def nxm_1_to_atom(0x5A), do: :tun_metadata50 def nxm_1_to_atom(0x5B), do: :tun_metadata51 def nxm_1_to_atom(0x5C), do: :tun_metadata52 def nxm_1_to_atom(0x5D), do: :tun_metadata53 def nxm_1_to_atom(0x5E), do: :tun_metadata54 def nxm_1_to_atom(0x5F), do: :tun_metadata55 def nxm_1_to_atom(0x60), do: :tun_metadata56 def nxm_1_to_atom(0x61), do: :tun_metadata57 def nxm_1_to_atom(0x62), do: :tun_metadata58 def nxm_1_to_atom(0x63), do: :tun_metadata59 def nxm_1_to_atom(0x64), do: :tun_metadata60 def nxm_1_to_atom(0x65), do: :tun_metadata61 def nxm_1_to_atom(0x66), do: :tun_metadata62 def nxm_1_to_atom(0x67), do: :tun_metadata63 def nxm_1_to_atom(0x68), do: :tun_flags def nxm_1_to_atom(0x69), do: :ct_state def nxm_1_to_atom(0x6A), do: :ct_zone def nxm_1_to_atom(0x6B), do: :ct_mark def nxm_1_to_atom(0x6C), do: :ct_label def nxm_1_to_atom(0x6D), do: :tun_ipv6_src def nxm_1_to_atom(0x6E), do: :tun_ipv6_dst def nxm_1_to_atom(0x6F), do: :xxreg0 def nxm_1_to_atom(0x70), do: :xxreg1 def nxm_1_to_atom(0x71), do: :xxreg2 def nxm_1_to_atom(0x72), do: :xxreg3 def nxm_1_to_atom(0x73), do: :xxreg4 def nxm_1_to_atom(0x74), do: :xxreg5 def nxm_1_to_atom(0x75), do: :xxreg6 def nxm_1_to_atom(0x76), do: :xxreg7 def nxm_1_to_atom(0x77), do: :ct_nw_proto def nxm_1_to_atom(0x78), do: :ct_nw_src def nxm_1_to_atom(0x79), do: :ct_nw_dst def nxm_1_to_atom(0x7A), do: :ct_ipv6_src def nxm_1_to_atom(0x7B), do: :ct_ipv6_dst def nxm_1_to_atom(0x7C), do: :ct_tp_src def nxm_1_to_atom(0x7D), do: :ct_tp_dst def nxm_1_to_atom(_), do: throw(:bad_enum) def openflow_basic_to_int(:in_port), do: 0x0 def openflow_basic_to_int(:in_phy_port), do: 0x1 def openflow_basic_to_int(:metadata), do: 0x2 def openflow_basic_to_int(:eth_dst), do: 0x3 def openflow_basic_to_int(:eth_src), do: 0x4 def openflow_basic_to_int(:eth_type), do: 0x5 def openflow_basic_to_int(:vlan_vid), do: 0x6 def openflow_basic_to_int(:vlan_pcp), do: 0x7 def openflow_basic_to_int(:ip_dscp), do: 0x8 def openflow_basic_to_int(:ip_ecn), do: 0x9 def openflow_basic_to_int(:ip_proto), do: 0xA def openflow_basic_to_int(:ipv4_src), do: 0xB def openflow_basic_to_int(:ipv4_dst), do: 0xC def openflow_basic_to_int(:tcp_src), do: 0xD def openflow_basic_to_int(:tcp_dst), do: 0xE def openflow_basic_to_int(:udp_src), do: 0xF def openflow_basic_to_int(:udp_dst), do: 0x10 def openflow_basic_to_int(:sctp_src), do: 0x11 def openflow_basic_to_int(:sctp_dst), do: 0x12 def openflow_basic_to_int(:icmpv4_type), do: 0x13 def openflow_basic_to_int(:icmpv4_code), do: 0x14 def openflow_basic_to_int(:arp_op), do: 0x15 def openflow_basic_to_int(:arp_spa), do: 0x16 def openflow_basic_to_int(:arp_tpa), do: 0x17 def openflow_basic_to_int(:arp_sha), do: 0x18 def openflow_basic_to_int(:arp_tha), do: 0x19 def openflow_basic_to_int(:ipv6_src), do: 0x1A def openflow_basic_to_int(:ipv6_dst), do: 0x1B def openflow_basic_to_int(:ipv6_flabel), do: 0x1C def openflow_basic_to_int(:icmpv6_type), do: 0x1D def openflow_basic_to_int(:icmpv6_code), do: 0x1E def openflow_basic_to_int(:ipv6_nd_target), do: 0x1F def openflow_basic_to_int(:ipv6_nd_sll), do: 0x20 def openflow_basic_to_int(:ipv6_nd_tll), do: 0x21 def openflow_basic_to_int(:mpls_label), do: 0x22 def openflow_basic_to_int(:mpls_tc), do: 0x23 def openflow_basic_to_int(:mpls_bos), do: 0x24 def openflow_basic_to_int(:pbb_isid), do: 0x25 def openflow_basic_to_int(:tunnel_id), do: 0x26 def openflow_basic_to_int(:ipv6_exthdr), do: 0x27 def openflow_basic_to_int(:pbb_uca), do: 0x29 def openflow_basic_to_int(:packet_type), do: 0x2C def openflow_basic_to_int(_), do: throw(:bad_enum) def openflow_basic_to_atom(0x0), do: :in_port def openflow_basic_to_atom(0x1), do: :in_phy_port def openflow_basic_to_atom(0x2), do: :metadata def openflow_basic_to_atom(0x3), do: :eth_dst def openflow_basic_to_atom(0x4), do: :eth_src def openflow_basic_to_atom(0x5), do: :eth_type def openflow_basic_to_atom(0x6), do: :vlan_vid def openflow_basic_to_atom(0x7), do: :vlan_pcp def openflow_basic_to_atom(0x8), do: :ip_dscp def openflow_basic_to_atom(0x9), do: :ip_ecn def openflow_basic_to_atom(0xA), do: :ip_proto def openflow_basic_to_atom(0xB), do: :ipv4_src def openflow_basic_to_atom(0xC), do: :ipv4_dst def openflow_basic_to_atom(0xD), do: :tcp_src def openflow_basic_to_atom(0xE), do: :tcp_dst def openflow_basic_to_atom(0xF), do: :udp_src def openflow_basic_to_atom(0x10), do: :udp_dst def openflow_basic_to_atom(0x11), do: :sctp_src def openflow_basic_to_atom(0x12), do: :sctp_dst def openflow_basic_to_atom(0x13), do: :icmpv4_type def openflow_basic_to_atom(0x14), do: :icmpv4_code def openflow_basic_to_atom(0x15), do: :arp_op def openflow_basic_to_atom(0x16), do: :arp_spa def openflow_basic_to_atom(0x17), do: :arp_tpa def openflow_basic_to_atom(0x18), do: :arp_sha def openflow_basic_to_atom(0x19), do: :arp_tha def openflow_basic_to_atom(0x1A), do: :ipv6_src def openflow_basic_to_atom(0x1B), do: :ipv6_dst def openflow_basic_to_atom(0x1C), do: :ipv6_flabel def openflow_basic_to_atom(0x1D), do: :icmpv6_type def openflow_basic_to_atom(0x1E), do: :icmpv6_code def openflow_basic_to_atom(0x1F), do: :ipv6_nd_target def openflow_basic_to_atom(0x20), do: :ipv6_nd_sll def openflow_basic_to_atom(0x21), do: :ipv6_nd_tll def openflow_basic_to_atom(0x22), do: :mpls_label def openflow_basic_to_atom(0x23), do: :mpls_tc def openflow_basic_to_atom(0x24), do: :mpls_bos def openflow_basic_to_atom(0x25), do: :pbb_isid def openflow_basic_to_atom(0x26), do: :tunnel_id def openflow_basic_to_atom(0x27), do: :ipv6_exthdr def openflow_basic_to_atom(0x29), do: :pbb_uca def openflow_basic_to_atom(0x2C), do: :packet_type def openflow_basic_to_atom(_), do: throw(:bad_enum) def vlan_id_to_int(:vid_present), do: 0x1000 def vlan_id_to_int(:vid_none), do: 0x0 def vlan_id_to_int(_), do: throw(:bad_enum) def vlan_id_to_atom(0x1000), do: :vid_present def vlan_id_to_atom(0x0), do: :vid_none def vlan_id_to_atom(_), do: throw(:bad_enum) def ipv6exthdr_flags_to_int(:nonext), do: 0x1 def ipv6exthdr_flags_to_int(:esp), do: 0x2 def ipv6exthdr_flags_to_int(:auth), do: 0x4 def ipv6exthdr_flags_to_int(:dest), do: 0x8 def ipv6exthdr_flags_to_int(:frag), do: 0x10 def ipv6exthdr_flags_to_int(:router), do: 0x20 def ipv6exthdr_flags_to_int(:hop), do: 0x40 def ipv6exthdr_flags_to_int(:unrep), do: 0x80 def ipv6exthdr_flags_to_int(:unseq), do: 0x100 def ipv6exthdr_flags_to_int(_), do: throw(:bad_enum) def ipv6exthdr_flags_to_atom(0x1), do: :nonext def ipv6exthdr_flags_to_atom(0x2), do: :esp def ipv6exthdr_flags_to_atom(0x4), do: :auth def ipv6exthdr_flags_to_atom(0x8), do: :dest def ipv6exthdr_flags_to_atom(0x10), do: :frag def ipv6exthdr_flags_to_atom(0x20), do: :router def ipv6exthdr_flags_to_atom(0x40), do: :hop def ipv6exthdr_flags_to_atom(0x80), do: :unrep def ipv6exthdr_flags_to_atom(0x100), do: :unseq def ipv6exthdr_flags_to_atom(_), do: throw(:bad_enum) def tcp_flags_to_int(:fin), do: 0x1 def tcp_flags_to_int(:syn), do: 0x2 def tcp_flags_to_int(:rst), do: 0x4 def tcp_flags_to_int(:psh), do: 0x8 def tcp_flags_to_int(:ack), do: 0x10 def tcp_flags_to_int(:urg), do: 0x20 def tcp_flags_to_int(:ece), do: 0x40 def tcp_flags_to_int(:cwr), do: 0x80 def tcp_flags_to_int(:ns), do: 0x100 def tcp_flags_to_int(_), do: throw(:bad_enum) def tcp_flags_to_atom(0x1), do: :fin def tcp_flags_to_atom(0x2), do: :syn def tcp_flags_to_atom(0x4), do: :rst def tcp_flags_to_atom(0x8), do: :psh def tcp_flags_to_atom(0x10), do: :ack def tcp_flags_to_atom(0x20), do: :urg def tcp_flags_to_atom(0x40), do: :ece def tcp_flags_to_atom(0x80), do: :cwr def tcp_flags_to_atom(0x100), do: :ns def tcp_flags_to_atom(_), do: throw(:bad_enum) def tun_gbp_flags_to_int(:policy_applied), do: 0x8 def tun_gbp_flags_to_int(:dont_learn), do: 0x40 def tun_gbp_flags_to_int(_), do: throw(:bad_enum) def tun_gbp_flags_to_atom(0x8), do: :policy_applied def tun_gbp_flags_to_atom(0x40), do: :dont_learn def tun_gbp_flags_to_atom(_), do: throw(:bad_enum) def ct_state_flags_to_int(:new), do: 0x1 def ct_state_flags_to_int(:est), do: 0x2 def ct_state_flags_to_int(:rel), do: 0x4 def ct_state_flags_to_int(:rep), do: 0x8 def ct_state_flags_to_int(:inv), do: 0x10 def ct_state_flags_to_int(:trk), do: 0x20 def ct_state_flags_to_int(:snat), do: 0x40 def ct_state_flags_to_int(:dnat), do: 0x80 def ct_state_flags_to_int(_), do: throw(:bad_enum) def ct_state_flags_to_atom(0x1), do: :new def ct_state_flags_to_atom(0x2), do: :est def ct_state_flags_to_atom(0x4), do: :rel def ct_state_flags_to_atom(0x8), do: :rep def ct_state_flags_to_atom(0x10), do: :inv def ct_state_flags_to_atom(0x20), do: :trk def ct_state_flags_to_atom(0x40), do: :snat def ct_state_flags_to_atom(0x80), do: :dnat def ct_state_flags_to_atom(_), do: throw(:bad_enum) def packet_register_to_int(:xreg0), do: 0x0 def packet_register_to_int(:xreg1), do: 0x1 def packet_register_to_int(:xreg2), do: 0x2 def packet_register_to_int(:xreg3), do: 0x3 def packet_register_to_int(:xreg4), do: 0x4 def packet_register_to_int(:xreg5), do: 0x5 def packet_register_to_int(:xreg6), do: 0x6 def packet_register_to_int(:xreg7), do: 0x7 def packet_register_to_int(_), do: throw(:bad_enum) def packet_register_to_atom(0x0), do: :xreg0 def packet_register_to_atom(0x1), do: :xreg1 def packet_register_to_atom(0x2), do: :xreg2 def packet_register_to_atom(0x3), do: :xreg3 def packet_register_to_atom(0x4), do: :xreg4 def packet_register_to_atom(0x5), do: :xreg5 def packet_register_to_atom(0x6), do: :xreg6 def packet_register_to_atom(0x7), do: :xreg7 def packet_register_to_atom(_), do: throw(:bad_enum) def nxoxm_nsh_match_to_int(:nsh_flags), do: 0x1 def nxoxm_nsh_match_to_int(:nsh_mdtype), do: 0x2 def nxoxm_nsh_match_to_int(:nsh_np), do: 0x3 def nxoxm_nsh_match_to_int(:nsh_spi), do: 0x4 def nxoxm_nsh_match_to_int(:nsh_si), do: 0x5 def nxoxm_nsh_match_to_int(:nsh_c1), do: 0x6 def nxoxm_nsh_match_to_int(:nsh_c2), do: 0x7 def nxoxm_nsh_match_to_int(:nsh_c3), do: 0x8 def nxoxm_nsh_match_to_int(:nsh_c4), do: 0x9 def nxoxm_nsh_match_to_int(:nsh_ttl), do: 0xA def nxoxm_nsh_match_to_int(_), do: throw(:bad_enum) def nxoxm_nsh_match_to_atom(0x1), do: :nsh_flags def nxoxm_nsh_match_to_atom(0x2), do: :nsh_mdtype def nxoxm_nsh_match_to_atom(0x3), do: :nsh_np def nxoxm_nsh_match_to_atom(0x4), do: :nsh_spi def nxoxm_nsh_match_to_atom(0x5), do: :nsh_si def nxoxm_nsh_match_to_atom(0x6), do: :nsh_c1 def nxoxm_nsh_match_to_atom(0x7), do: :nsh_c2 def nxoxm_nsh_match_to_atom(0x8), do: :nsh_c3 def nxoxm_nsh_match_to_atom(0x9), do: :nsh_c4 def nxoxm_nsh_match_to_atom(0xA), do: :nsh_ttl def nxoxm_nsh_match_to_atom(_), do: throw(:bad_enum) def onf_ext_match_to_int(:onf_tcp_flags), do: 0x2A def onf_ext_match_to_int(:onf_actset_output), do: 0x2B def onf_ext_match_to_int(:onf_pbb_uca), do: 0xA00 def onf_ext_match_to_int(_), do: throw(:bad_enum) def onf_ext_match_to_atom(0x2A), do: :onf_tcp_flags def onf_ext_match_to_atom(0x2B), do: :onf_actset_output def onf_ext_match_to_atom(0xA00), do: :onf_pbb_uca def onf_ext_match_to_atom(_), do: throw(:bad_enum) def nxoxm_match_to_int(:nxoxm_dp_hash), do: 0x0 def nxoxm_match_to_int(:tun_erspan_idx), do: 0xB def nxoxm_match_to_int(:tun_erspan_ver), do: 0xC def nxoxm_match_to_int(:tun_erspan_dir), do: 0xD def nxoxm_match_to_int(:tun_erspan_hwid), do: 0xE def nxoxm_match_to_int(_), do: throw(:bad_enum) def nxoxm_match_to_atom(0x0), do: :nxoxm_dp_hash def nxoxm_match_to_atom(0xB), do: :tun_erspan_idx def nxoxm_match_to_atom(0xC), do: :tun_erspan_ver def nxoxm_match_to_atom(0xD), do: :tun_erspan_dir def nxoxm_match_to_atom(0xE), do: :tun_erspan_hwid def nxoxm_match_to_atom(_), do: throw(:bad_enum) def buffer_id_to_int(:no_buffer), do: 0xFFFFFFFF def buffer_id_to_int(_), do: throw(:bad_enum) def buffer_id_to_atom(0xFFFFFFFF), do: :no_buffer def buffer_id_to_atom(_), do: throw(:bad_enum) def port_config_to_int(:port_down), do: 0x1 def port_config_to_int(:no_receive), do: 0x4 def port_config_to_int(:no_forward), do: 0x20 def port_config_to_int(:no_packet_in), do: 0x40 def port_config_to_int(_), do: throw(:bad_enum) def port_config_to_atom(0x1), do: :port_down def port_config_to_atom(0x4), do: :no_receive def port_config_to_atom(0x20), do: :no_forward def port_config_to_atom(0x40), do: :no_packet_in def port_config_to_atom(_), do: throw(:bad_enum) def port_state_to_int(:link_down), do: 0x1 def port_state_to_int(:blocked), do: 0x2 def port_state_to_int(:live), do: 0x4 def port_state_to_int(_), do: throw(:bad_enum) def port_state_to_atom(0x1), do: :link_down def port_state_to_atom(0x2), do: :blocked def port_state_to_atom(0x4), do: :live def port_state_to_atom(_), do: throw(:bad_enum) def port_features_to_int(:"10mb_hd"), do: 0x1 def port_features_to_int(:"10mb_fd"), do: 0x2 def port_features_to_int(:"100mb_hd"), do: 0x4 def port_features_to_int(:"100mb_fd"), do: 0x8 def port_features_to_int(:"1gb_hd"), do: 0x10 def port_features_to_int(:"1gb_fd"), do: 0x20 def port_features_to_int(:"10gb_fd"), do: 0x40 def port_features_to_int(:"40gb_fd"), do: 0x80 def port_features_to_int(:"100gb_fd"), do: 0x100 def port_features_to_int(:"1tb_fd"), do: 0x200 def port_features_to_int(:other), do: 0x400 def port_features_to_int(:copper), do: 0x800 def port_features_to_int(:fiber), do: 0x1000 def port_features_to_int(:autoneg), do: 0x2000 def port_features_to_int(:pause), do: 0x4000 def port_features_to_int(:pause_asym), do: 0x8000 def port_features_to_int(_), do: throw(:bad_enum) def port_features_to_atom(0x1), do: :"10mb_hd" def port_features_to_atom(0x2), do: :"10mb_fd" def port_features_to_atom(0x4), do: :"100mb_hd" def port_features_to_atom(0x8), do: :"100mb_fd" def port_features_to_atom(0x10), do: :"1gb_hd" def port_features_to_atom(0x20), do: :"1gb_fd" def port_features_to_atom(0x40), do: :"10gb_fd" def port_features_to_atom(0x80), do: :"40gb_fd" def port_features_to_atom(0x100), do: :"100gb_fd" def port_features_to_atom(0x200), do: :"1tb_fd" def port_features_to_atom(0x400), do: :other def port_features_to_atom(0x800), do: :copper def port_features_to_atom(0x1000), do: :fiber def port_features_to_atom(0x2000), do: :autoneg def port_features_to_atom(0x4000), do: :pause def port_features_to_atom(0x8000), do: :pause_asym def port_features_to_atom(_), do: throw(:bad_enum) def openflow10_port_no_to_int(:max), do: 0xFF00 def openflow10_port_no_to_int(:in_port), do: 0xFFF8 def openflow10_port_no_to_int(:table), do: 0xFFF9 def openflow10_port_no_to_int(:normal), do: 0xFFFA def openflow10_port_no_to_int(:flood), do: 0xFFFB def openflow10_port_no_to_int(:all), do: 0xFFFC def openflow10_port_no_to_int(:controller), do: 0xFFFD def openflow10_port_no_to_int(:local), do: 0xFFFE def openflow10_port_no_to_int(:none), do: 0xFFFF def openflow10_port_no_to_int(_), do: throw(:bad_enum) def openflow10_port_no_to_atom(0xFF00), do: :max def openflow10_port_no_to_atom(0xFFF8), do: :in_port def openflow10_port_no_to_atom(0xFFF9), do: :table def openflow10_port_no_to_atom(0xFFFA), do: :normal def openflow10_port_no_to_atom(0xFFFB), do: :flood def openflow10_port_no_to_atom(0xFFFC), do: :all def openflow10_port_no_to_atom(0xFFFD), do: :controller def openflow10_port_no_to_atom(0xFFFE), do: :local def openflow10_port_no_to_atom(0xFFFF), do: :none def openflow10_port_no_to_atom(_), do: throw(:bad_enum) def openflow13_port_no_to_int(:max), do: 0xFFFFFF00 def openflow13_port_no_to_int(:in_port), do: 0xFFFFFFF8 def openflow13_port_no_to_int(:table), do: 0xFFFFFFF9 def openflow13_port_no_to_int(:normal), do: 0xFFFFFFFA def openflow13_port_no_to_int(:flood), do: 0xFFFFFFFB def openflow13_port_no_to_int(:all), do: 0xFFFFFFFC def openflow13_port_no_to_int(:controller), do: 0xFFFFFFFD def openflow13_port_no_to_int(:local), do: 0xFFFFFFFE def openflow13_port_no_to_int(:any), do: 0xFFFFFFFF def openflow13_port_no_to_int(_), do: throw(:bad_enum) def openflow13_port_no_to_atom(0xFFFFFF00), do: :max def openflow13_port_no_to_atom(0xFFFFFFF8), do: :in_port def openflow13_port_no_to_atom(0xFFFFFFF9), do: :table def openflow13_port_no_to_atom(0xFFFFFFFA), do: :normal def openflow13_port_no_to_atom(0xFFFFFFFB), do: :flood def openflow13_port_no_to_atom(0xFFFFFFFC), do: :all def openflow13_port_no_to_atom(0xFFFFFFFD), do: :controller def openflow13_port_no_to_atom(0xFFFFFFFE), do: :local def openflow13_port_no_to_atom(0xFFFFFFFF), do: :any def openflow13_port_no_to_atom(_), do: throw(:bad_enum) def packet_in_reason_to_int(:no_match), do: 0x0 def packet_in_reason_to_int(:action), do: 0x1 def packet_in_reason_to_int(:invalid_ttl), do: 0x2 def packet_in_reason_to_int(:action_set), do: 0x3 def packet_in_reason_to_int(:group), do: 0x4 def packet_in_reason_to_int(:packet_out), do: 0x5 def packet_in_reason_to_int(_), do: throw(:bad_enum) def packet_in_reason_to_atom(0x0), do: :no_match def packet_in_reason_to_atom(0x1), do: :action def packet_in_reason_to_atom(0x2), do: :invalid_ttl def packet_in_reason_to_atom(0x3), do: :action_set def packet_in_reason_to_atom(0x4), do: :group def packet_in_reason_to_atom(0x5), do: :packet_out def packet_in_reason_to_atom(_), do: throw(:bad_enum) def packet_in_reason_mask_to_int(:no_match), do: 0x1 def packet_in_reason_mask_to_int(:action), do: 0x2 def packet_in_reason_mask_to_int(:invalid_ttl), do: 0x4 def packet_in_reason_mask_to_int(:action_set), do: 0x8 def packet_in_reason_mask_to_int(:group), do: 0x10 def packet_in_reason_mask_to_int(:packet_out), do: 0x20 def packet_in_reason_mask_to_int(_), do: throw(:bad_enum) def packet_in_reason_mask_to_atom(0x1), do: :no_match def packet_in_reason_mask_to_atom(0x2), do: :action def packet_in_reason_mask_to_atom(0x4), do: :invalid_ttl def packet_in_reason_mask_to_atom(0x8), do: :action_set def packet_in_reason_mask_to_atom(0x10), do: :group def packet_in_reason_mask_to_atom(0x20), do: :packet_out def packet_in_reason_mask_to_atom(_), do: throw(:bad_enum) def flow_mod_command_to_int(:add), do: 0x0 def flow_mod_command_to_int(:modify), do: 0x1 def flow_mod_command_to_int(:modify_strict), do: 0x2 def flow_mod_command_to_int(:delete), do: 0x3 def flow_mod_command_to_int(:delete_strict), do: 0x4 def flow_mod_command_to_int(_), do: throw(:bad_enum) def flow_mod_command_to_atom(0x0), do: :add def flow_mod_command_to_atom(0x1), do: :modify def flow_mod_command_to_atom(0x2), do: :modify_strict def flow_mod_command_to_atom(0x3), do: :delete def flow_mod_command_to_atom(0x4), do: :delete_strict def flow_mod_command_to_atom(_), do: throw(:bad_enum) def flow_mod_flags_to_int(:send_flow_rem), do: 0x1 def flow_mod_flags_to_int(:check_overlap), do: 0x2 def flow_mod_flags_to_int(:reset_counts), do: 0x4 def flow_mod_flags_to_int(:no_packet_counts), do: 0x8 def flow_mod_flags_to_int(:no_byte_counts), do: 0x10 def flow_mod_flags_to_int(_), do: throw(:bad_enum) def flow_mod_flags_to_atom(0x1), do: :send_flow_rem def flow_mod_flags_to_atom(0x2), do: :check_overlap def flow_mod_flags_to_atom(0x4), do: :reset_counts def flow_mod_flags_to_atom(0x8), do: :no_packet_counts def flow_mod_flags_to_atom(0x10), do: :no_byte_counts def flow_mod_flags_to_atom(_), do: throw(:bad_enum) def flow_removed_reason_to_int(:idle_timeout), do: 0x0 def flow_removed_reason_to_int(:hard_timeout), do: 0x1 def flow_removed_reason_to_int(:delete), do: 0x2 def flow_removed_reason_to_int(:group_delete), do: 0x3 def flow_removed_reason_to_int(:meter_delete), do: 0x4 def flow_removed_reason_to_int(:eviction), do: 0x5 def flow_removed_reason_to_int(_), do: throw(:bad_enum) def flow_removed_reason_to_atom(0x0), do: :idle_timeout def flow_removed_reason_to_atom(0x1), do: :hard_timeout def flow_removed_reason_to_atom(0x2), do: :delete def flow_removed_reason_to_atom(0x3), do: :group_delete def flow_removed_reason_to_atom(0x4), do: :meter_delete def flow_removed_reason_to_atom(0x5), do: :eviction def flow_removed_reason_to_atom(_), do: throw(:bad_enum) def flow_removed_reason_mask_to_int(:idle_timeout), do: 0x1 def flow_removed_reason_mask_to_int(:hard_timeout), do: 0x2 def flow_removed_reason_mask_to_int(:delete), do: 0x4 def flow_removed_reason_mask_to_int(:group_delete), do: 0x8 def flow_removed_reason_mask_to_int(:meter_delete), do: 0x10 def flow_removed_reason_mask_to_int(:eviction), do: 0x20 def flow_removed_reason_mask_to_int(_), do: throw(:bad_enum) def flow_removed_reason_mask_to_atom(0x1), do: :idle_timeout def flow_removed_reason_mask_to_atom(0x2), do: :hard_timeout def flow_removed_reason_mask_to_atom(0x4), do: :delete def flow_removed_reason_mask_to_atom(0x8), do: :group_delete def flow_removed_reason_mask_to_atom(0x10), do: :meter_delete def flow_removed_reason_mask_to_atom(0x20), do: :eviction def flow_removed_reason_mask_to_atom(_), do: throw(:bad_enum) def port_reason_to_int(:add), do: 0x0 def port_reason_to_int(:delete), do: 0x1 def port_reason_to_int(:modify), do: 0x2 def port_reason_to_int(_), do: throw(:bad_enum) def port_reason_to_atom(0x0), do: :add def port_reason_to_atom(0x1), do: :delete def port_reason_to_atom(0x2), do: :modify def port_reason_to_atom(_), do: throw(:bad_enum) def port_reason_mask_to_int(:add), do: 0x1 def port_reason_mask_to_int(:delete), do: 0x2 def port_reason_mask_to_int(:modify), do: 0x4 def port_reason_mask_to_int(_), do: throw(:bad_enum) def port_reason_mask_to_atom(0x1), do: :add def port_reason_mask_to_atom(0x2), do: :delete def port_reason_mask_to_atom(0x4), do: :modify def port_reason_mask_to_atom(_), do: throw(:bad_enum) def group_mod_command_to_int(:add), do: 0x0 def group_mod_command_to_int(:modify), do: 0x1 def group_mod_command_to_int(:delete), do: 0x2 def group_mod_command_to_int(_), do: throw(:bad_enum) def group_mod_command_to_atom(0x0), do: :add def group_mod_command_to_atom(0x1), do: :modify def group_mod_command_to_atom(0x2), do: :delete def group_mod_command_to_atom(_), do: throw(:bad_enum) def group_type_to_int(:all), do: 0x0 def group_type_to_int(:select), do: 0x1 def group_type_to_int(:indirect), do: 0x2 def group_type_to_int(:fast_failover), do: 0x3 def group_type_to_int(_), do: throw(:bad_enum) def group_type_to_atom(0x0), do: :all def group_type_to_atom(0x1), do: :select def group_type_to_atom(0x2), do: :indirect def group_type_to_atom(0x3), do: :fast_failover def group_type_to_atom(_), do: throw(:bad_enum) def group_type_flags_to_int(:all), do: 0x1 def group_type_flags_to_int(:select), do: 0x2 def group_type_flags_to_int(:indirect), do: 0x4 def group_type_flags_to_int(:fast_failover), do: 0x8 def group_type_flags_to_int(_), do: throw(:bad_enum) def group_type_flags_to_atom(0x1), do: :all def group_type_flags_to_atom(0x2), do: :select def group_type_flags_to_atom(0x4), do: :indirect def group_type_flags_to_atom(0x8), do: :fast_failover def group_type_flags_to_atom(_), do: throw(:bad_enum) def group_id_to_int(:max), do: 0xFFFFFF00 def group_id_to_int(:all), do: 0xFFFFFFFC def group_id_to_int(:any), do: 0xFFFFFFFF def group_id_to_int(_), do: throw(:bad_enum) def group_id_to_atom(0xFFFFFF00), do: :max def group_id_to_atom(0xFFFFFFFC), do: :all def group_id_to_atom(0xFFFFFFFF), do: :any def group_id_to_atom(_), do: throw(:bad_enum) def group_capabilities_to_int(:select_weight), do: 0x1 def group_capabilities_to_int(:select_liveness), do: 0x2 def group_capabilities_to_int(:chaining), do: 0x4 def group_capabilities_to_int(:chaining_checks), do: 0x8 def group_capabilities_to_int(_), do: throw(:bad_enum) def group_capabilities_to_atom(0x1), do: :select_weight def group_capabilities_to_atom(0x2), do: :select_liveness def group_capabilities_to_atom(0x4), do: :chaining def group_capabilities_to_atom(0x8), do: :chaining_checks def group_capabilities_to_atom(_), do: throw(:bad_enum) def table_id_to_int(:max), do: 0xFE def table_id_to_int(:all), do: 0xFF def table_id_to_int(_), do: throw(:bad_enum) def table_id_to_atom(0xFE), do: :max def table_id_to_atom(0xFF), do: :all def table_id_to_atom(_), do: throw(:bad_enum) def queue_id_to_int(:all), do: 0xFFFFFFFF def queue_id_to_int(_), do: throw(:bad_enum) def queue_id_to_atom(0xFFFFFFFF), do: :all def queue_id_to_atom(_), do: throw(:bad_enum) def meter_mod_command_to_int(:add), do: 0x0 def meter_mod_command_to_int(:modify), do: 0x1 def meter_mod_command_to_int(:delete), do: 0x2 def meter_mod_command_to_int(_), do: throw(:bad_enum) def meter_mod_command_to_atom(0x0), do: :add def meter_mod_command_to_atom(0x1), do: :modify def meter_mod_command_to_atom(0x2), do: :delete def meter_mod_command_to_atom(_), do: throw(:bad_enum) def meter_id_to_int(:max), do: 0xFFFF0000 def meter_id_to_int(:slowpath), do: 0xFFFFFFFD def meter_id_to_int(:controller), do: 0xFFFFFFFE def meter_id_to_int(:all), do: 0xFFFFFFFF def meter_id_to_int(_), do: throw(:bad_enum) def meter_id_to_atom(0xFFFF0000), do: :max def meter_id_to_atom(0xFFFFFFFD), do: :slowpath def meter_id_to_atom(0xFFFFFFFE), do: :controller def meter_id_to_atom(0xFFFFFFFF), do: :all def meter_id_to_atom(_), do: throw(:bad_enum) def meter_flags_to_int(:kbps), do: 0x1 def meter_flags_to_int(:pktps), do: 0x2 def meter_flags_to_int(:burst), do: 0x4 def meter_flags_to_int(:stats), do: 0x8 def meter_flags_to_int(_), do: throw(:bad_enum) def meter_flags_to_atom(0x1), do: :kbps def meter_flags_to_atom(0x2), do: :pktps def meter_flags_to_atom(0x4), do: :burst def meter_flags_to_atom(0x8), do: :stats def meter_flags_to_atom(_), do: throw(:bad_enum) def meter_band_type_to_int(Openflow.MeterBand.Drop), do: 0x1 def meter_band_type_to_int(Openflow.MeterBand.Remark), do: 0x2 def meter_band_type_to_int(Openflow.MeterBand.Experimenter), do: 0xFFFF def meter_band_type_to_int(_), do: throw(:bad_enum) def meter_band_type_to_atom(0x1), do: Openflow.MeterBand.Drop def meter_band_type_to_atom(0x2), do: Openflow.MeterBand.Remark def meter_band_type_to_atom(0xFFFF), do: Openflow.MeterBand.Experimenter def meter_band_type_to_atom(_), do: throw(:bad_enum) def table_config_to_int(:table_miss_controller), do: 0x0 def table_config_to_int(:table_miss_continue), do: 0x1 def table_config_to_int(:table_miss_drop), do: 0x2 def table_config_to_int(:table_miss_mask), do: 0x3 def table_config_to_int(:eviction), do: 0x4 def table_config_to_int(:vacancy_events), do: 0x8 def table_config_to_int(_), do: throw(:bad_enum) def table_config_to_atom(0x0), do: :table_miss_controller def table_config_to_atom(0x1), do: :table_miss_continue def table_config_to_atom(0x2), do: :table_miss_drop def table_config_to_atom(0x3), do: :table_miss_mask def table_config_to_atom(0x4), do: :eviction def table_config_to_atom(0x8), do: :vacancy_events def table_config_to_atom(_), do: throw(:bad_enum) def action_type_to_int(Openflow.Action.Output), do: 0x0 def action_type_to_int(Openflow.Action.CopyTtlOut), do: 0xB def action_type_to_int(Openflow.Action.CopyTtlIn), do: 0xC def action_type_to_int(Openflow.Action.SetMplsTtl), do: 0xF def action_type_to_int(Openflow.Action.DecMplsTtl), do: 0x10 def action_type_to_int(Openflow.Action.PushVlan), do: 0x11 def action_type_to_int(Openflow.Action.PopVlan), do: 0x12 def action_type_to_int(Openflow.Action.PushMpls), do: 0x13 def action_type_to_int(Openflow.Action.PopMpls), do: 0x14 def action_type_to_int(Openflow.Action.SetQueue), do: 0x15 def action_type_to_int(Openflow.Action.Group), do: 0x16 def action_type_to_int(Openflow.Action.SetNwTtl), do: 0x17 def action_type_to_int(Openflow.Action.DecNwTtl), do: 0x18 def action_type_to_int(Openflow.Action.SetField), do: 0x19 def action_type_to_int(Openflow.Action.PushPbb), do: 0x1A def action_type_to_int(Openflow.Action.PopPbb), do: 0x1B def action_type_to_int(Openflow.Action.Encap), do: 0x1C def action_type_to_int(Openflow.Action.Decap), do: 0x1D def action_type_to_int(Openflow.Action.SetSequence), do: 0x1E def action_type_to_int(Openflow.Action.ValidateSequence), do: 0x1F def action_type_to_int(Openflow.Action.Experimenter), do: 0xFFFF def action_type_to_int(_), do: throw(:bad_enum) def action_type_to_atom(0x0), do: Openflow.Action.Output def action_type_to_atom(0xB), do: Openflow.Action.CopyTtlOut def action_type_to_atom(0xC), do: Openflow.Action.CopyTtlIn def action_type_to_atom(0xF), do: Openflow.Action.SetMplsTtl def action_type_to_atom(0x10), do: Openflow.Action.DecMplsTtl def action_type_to_atom(0x11), do: Openflow.Action.PushVlan def action_type_to_atom(0x12), do: Openflow.Action.PopVlan def action_type_to_atom(0x13), do: Openflow.Action.PushMpls def action_type_to_atom(0x14), do: Openflow.Action.PopMpls def action_type_to_atom(0x15), do: Openflow.Action.SetQueue def action_type_to_atom(0x16), do: Openflow.Action.Group def action_type_to_atom(0x17), do: Openflow.Action.SetNwTtl def action_type_to_atom(0x18), do: Openflow.Action.DecNwTtl def action_type_to_atom(0x19), do: Openflow.Action.SetField def action_type_to_atom(0x1A), do: Openflow.Action.PushPbb def action_type_to_atom(0x1B), do: Openflow.Action.PopPbb def action_type_to_atom(0x1C), do: Openflow.Action.Encap def action_type_to_atom(0x1D), do: Openflow.Action.Decap def action_type_to_atom(0x1E), do: Openflow.Action.SetSequence def action_type_to_atom(0x1F), do: Openflow.Action.ValidateSequence def action_type_to_atom(0xFFFF), do: Openflow.Action.Experimenter def action_type_to_atom(_), do: throw(:bad_enum) def action_flags_to_int(Openflow.Action.Output), do: 0x1 def action_flags_to_int(Openflow.Action.CopyTtlOut), do: 0x800 def action_flags_to_int(Openflow.Action.CopyTtlIn), do: 0x1000 def action_flags_to_int(Openflow.Action.SetMplsTtl), do: 0x8000 def action_flags_to_int(Openflow.Action.DecMplsTtl), do: 0x10000 def action_flags_to_int(Openflow.Action.PushVlan), do: 0x20000 def action_flags_to_int(Openflow.Action.PopVlan), do: 0x40000 def action_flags_to_int(Openflow.Action.PushMpls), do: 0x80000 def action_flags_to_int(Openflow.Action.PopMpls), do: 0x100000 def action_flags_to_int(Openflow.Action.SetQueue), do: 0x200000 def action_flags_to_int(Openflow.Action.Group), do: 0x400000 def action_flags_to_int(Openflow.Action.SetNwTtl), do: 0x800000 def action_flags_to_int(Openflow.Action.DecNwTtl), do: 0x1000000 def action_flags_to_int(Openflow.Action.SetField), do: 0x2000000 def action_flags_to_int(Openflow.Action.PushPbb), do: 0x4000000 def action_flags_to_int(Openflow.Action.PopPbb), do: 0x8000000 def action_flags_to_int(Openflow.Action.Encap), do: 0x10000000 def action_flags_to_int(Openflow.Action.Decap), do: 0x20000000 def action_flags_to_int(Openflow.Action.SetSequence), do: 0x40000000 def action_flags_to_int(Openflow.Action.ValidateSequence), do: 0x80000000 def action_flags_to_int(Openflow.Action.Experimenter), do: 0xFFFF def action_flags_to_int(_), do: throw(:bad_enum) def action_flags_to_atom(0x1), do: Openflow.Action.Output def action_flags_to_atom(0x800), do: Openflow.Action.CopyTtlOut def action_flags_to_atom(0x1000), do: Openflow.Action.CopyTtlIn def action_flags_to_atom(0x8000), do: Openflow.Action.SetMplsTtl def action_flags_to_atom(0x10000), do: Openflow.Action.DecMplsTtl def action_flags_to_atom(0x20000), do: Openflow.Action.PushVlan def action_flags_to_atom(0x40000), do: Openflow.Action.PopVlan def action_flags_to_atom(0x80000), do: Openflow.Action.PushMpls def action_flags_to_atom(0x100000), do: Openflow.Action.PopMpls def action_flags_to_atom(0x200000), do: Openflow.Action.SetQueue def action_flags_to_atom(0x400000), do: Openflow.Action.Group def action_flags_to_atom(0x800000), do: Openflow.Action.SetNwTtl def action_flags_to_atom(0x1000000), do: Openflow.Action.DecNwTtl def action_flags_to_atom(0x2000000), do: Openflow.Action.SetField def action_flags_to_atom(0x4000000), do: Openflow.Action.PushPbb def action_flags_to_atom(0x8000000), do: Openflow.Action.PopPbb def action_flags_to_atom(0x10000000), do: Openflow.Action.Encap def action_flags_to_atom(0x20000000), do: Openflow.Action.Decap def action_flags_to_atom(0x40000000), do: Openflow.Action.SetSequence def action_flags_to_atom(0x80000000), do: Openflow.Action.ValidateSequence def action_flags_to_atom(0xFFFF), do: Openflow.Action.Experimenter def action_flags_to_atom(_), do: throw(:bad_enum) def action_vendor_to_int(:nicira_ext_action), do: 0x2320 def action_vendor_to_int(:onf_ext_action), do: 0x4F4E4600 def action_vendor_to_int(_), do: throw(:bad_enum) def action_vendor_to_atom(0x2320), do: :nicira_ext_action def action_vendor_to_atom(0x4F4E4600), do: :onf_ext_action def action_vendor_to_atom(_), do: throw(:bad_enum) def onf_ext_action_to_int(Openflow.Action.OnfCopyField), do: 0xC80 def onf_ext_action_to_int(_), do: throw(:bad_enum) def onf_ext_action_to_atom(0xC80), do: Openflow.Action.OnfCopyField def onf_ext_action_to_atom(_), do: throw(:bad_enum) def nicira_ext_action_to_int(Openflow.Action.NxResubmit), do: 0x1 def nicira_ext_action_to_int(Openflow.Action.NxSetTunnel), do: 0x2 def nicira_ext_action_to_int(Openflow.Action.NxRegMove), do: 0x6 def nicira_ext_action_to_int(Openflow.Action.NxRegLoad), do: 0x7 def nicira_ext_action_to_int(Openflow.Action.NxNote), do: 0x8 def nicira_ext_action_to_int(Openflow.Action.NxSetTunnel64), do: 0x9 def nicira_ext_action_to_int(Openflow.Action.NxMultipath), do: 0xA def nicira_ext_action_to_int(Openflow.Action.NxBundle), do: 0xC def nicira_ext_action_to_int(Openflow.Action.NxBundleLoad), do: 0xD def nicira_ext_action_to_int(Openflow.Action.NxResubmitTable), do: 0xE def nicira_ext_action_to_int(Openflow.Action.NxOutputReg), do: 0xF def nicira_ext_action_to_int(Openflow.Action.NxLearn), do: 0x10 def nicira_ext_action_to_int(Openflow.Action.NxExit), do: 0x11 def nicira_ext_action_to_int(Openflow.Action.NxDecTtl), do: 0x12 def nicira_ext_action_to_int(Openflow.Action.NxFinTimeout), do: 0x13 def nicira_ext_action_to_int(Openflow.Action.NxController), do: 0x14 def nicira_ext_action_to_int(Openflow.Action.NxDecTtlCntIds), do: 0x15 def nicira_ext_action_to_int(Openflow.Action.NxWriteMetadata), do: 0x16 def nicira_ext_action_to_int(Openflow.Action.NxStackPush), do: 0x1B def nicira_ext_action_to_int(Openflow.Action.NxStackPop), do: 0x1C def nicira_ext_action_to_int(Openflow.Action.NxSample), do: 0x1D def nicira_ext_action_to_int(Openflow.Action.NxOutputReg2), do: 0x20 def nicira_ext_action_to_int(Openflow.Action.NxRegLoad2), do: 0x21 def nicira_ext_action_to_int(Openflow.Action.NxConjunction), do: 0x22 def nicira_ext_action_to_int(Openflow.Action.NxConntrack), do: 0x23 def nicira_ext_action_to_int(Openflow.Action.NxNat), do: 0x24 def nicira_ext_action_to_int(Openflow.Action.NxController2), do: 0x25 def nicira_ext_action_to_int(Openflow.Action.NxSample2), do: 0x26 def nicira_ext_action_to_int(Openflow.Action.NxOutputTrunc), do: 0x27 def nicira_ext_action_to_int(Openflow.Action.NxGroup), do: 0x28 def nicira_ext_action_to_int(Openflow.Action.NxSample3), do: 0x29 def nicira_ext_action_to_int(Openflow.Action.NxClone), do: 0x2A def nicira_ext_action_to_int(Openflow.Action.NxCtClear), do: 0x2B def nicira_ext_action_to_int(Openflow.Action.NxResubmitTableCt), do: 0x2C def nicira_ext_action_to_int(Openflow.Action.NxLearn2), do: 0x2D def nicira_ext_action_to_int(Openflow.Action.NxEncap), do: 0x2E def nicira_ext_action_to_int(Openflow.Action.NxDecap), do: 0x2F def nicira_ext_action_to_int(Openflow.Action.NxCheckPktLarger), do: 0x31 def nicira_ext_action_to_int(Openflow.Action.NxDebugRecirc), do: 0xFF def nicira_ext_action_to_int(_), do: throw(:bad_enum) def nicira_ext_action_to_atom(0x1), do: Openflow.Action.NxResubmit def nicira_ext_action_to_atom(0x2), do: Openflow.Action.NxSetTunnel def nicira_ext_action_to_atom(0x6), do: Openflow.Action.NxRegMove def nicira_ext_action_to_atom(0x7), do: Openflow.Action.NxRegLoad def nicira_ext_action_to_atom(0x8), do: Openflow.Action.NxNote def nicira_ext_action_to_atom(0x9), do: Openflow.Action.NxSetTunnel64 def nicira_ext_action_to_atom(0xA), do: Openflow.Action.NxMultipath def nicira_ext_action_to_atom(0xC), do: Openflow.Action.NxBundle def nicira_ext_action_to_atom(0xD), do: Openflow.Action.NxBundleLoad def nicira_ext_action_to_atom(0xE), do: Openflow.Action.NxResubmitTable def nicira_ext_action_to_atom(0xF), do: Openflow.Action.NxOutputReg def nicira_ext_action_to_atom(0x10), do: Openflow.Action.NxLearn def nicira_ext_action_to_atom(0x11), do: Openflow.Action.NxExit def nicira_ext_action_to_atom(0x12), do: Openflow.Action.NxDecTtl def nicira_ext_action_to_atom(0x13), do: Openflow.Action.NxFinTimeout def nicira_ext_action_to_atom(0x14), do: Openflow.Action.NxController def nicira_ext_action_to_atom(0x15), do: Openflow.Action.NxDecTtlCntIds def nicira_ext_action_to_atom(0x16), do: Openflow.Action.NxWriteMetadata def nicira_ext_action_to_atom(0x1B), do: Openflow.Action.NxStackPush def nicira_ext_action_to_atom(0x1C), do: Openflow.Action.NxStackPop def nicira_ext_action_to_atom(0x1D), do: Openflow.Action.NxSample def nicira_ext_action_to_atom(0x20), do: Openflow.Action.NxOutputReg2 def nicira_ext_action_to_atom(0x21), do: Openflow.Action.NxRegLoad2 def nicira_ext_action_to_atom(0x22), do: Openflow.Action.NxConjunction def nicira_ext_action_to_atom(0x23), do: Openflow.Action.NxConntrack def nicira_ext_action_to_atom(0x24), do: Openflow.Action.NxNat def nicira_ext_action_to_atom(0x25), do: Openflow.Action.NxController2 def nicira_ext_action_to_atom(0x26), do: Openflow.Action.NxSample2 def nicira_ext_action_to_atom(0x27), do: Openflow.Action.NxOutputTrunc def nicira_ext_action_to_atom(0x28), do: Openflow.Action.NxGroup def nicira_ext_action_to_atom(0x29), do: Openflow.Action.NxSample3 def nicira_ext_action_to_atom(0x2A), do: Openflow.Action.NxClone def nicira_ext_action_to_atom(0x2B), do: Openflow.Action.NxCtClear def nicira_ext_action_to_atom(0x2C), do: Openflow.Action.NxResubmitTableCt def nicira_ext_action_to_atom(0x2D), do: Openflow.Action.NxLearn2 def nicira_ext_action_to_atom(0x2E), do: Openflow.Action.NxEncap def nicira_ext_action_to_atom(0x2F), do: Openflow.Action.NxDecap def nicira_ext_action_to_atom(0x31), do: Openflow.Action.NxCheckPktLarger def nicira_ext_action_to_atom(0xFF), do: Openflow.Action.NxDebugRecirc def nicira_ext_action_to_atom(_), do: throw(:bad_enum) def nx_mp_algorithm_to_int(:modulo_n), do: 0x0 def nx_mp_algorithm_to_int(:hash_threshold), do: 0x1 def nx_mp_algorithm_to_int(:highest_random_weight), do: 0x2 def nx_mp_algorithm_to_int(:iterative_hash), do: 0x3 def nx_mp_algorithm_to_int(_), do: throw(:bad_enum) def nx_mp_algorithm_to_atom(0x0), do: :modulo_n def nx_mp_algorithm_to_atom(0x1), do: :hash_threshold def nx_mp_algorithm_to_atom(0x2), do: :highest_random_weight def nx_mp_algorithm_to_atom(0x3), do: :iterative_hash def nx_mp_algorithm_to_atom(_), do: throw(:bad_enum) def nx_hash_fields_to_int(:eth_src), do: 0x0 def nx_hash_fields_to_int(:symmetric_l4), do: 0x1 def nx_hash_fields_to_int(:symmetric_l3l4), do: 0x2 def nx_hash_fields_to_int(:symmetric_l3l4_udp), do: 0x3 def nx_hash_fields_to_int(:nw_src), do: 0x4 def nx_hash_fields_to_int(:nw_dst), do: 0x5 def nx_hash_fields_to_int(_), do: throw(:bad_enum) def nx_hash_fields_to_atom(0x0), do: :eth_src def nx_hash_fields_to_atom(0x1), do: :symmetric_l4 def nx_hash_fields_to_atom(0x2), do: :symmetric_l3l4 def nx_hash_fields_to_atom(0x3), do: :symmetric_l3l4_udp def nx_hash_fields_to_atom(0x4), do: :nw_src def nx_hash_fields_to_atom(0x5), do: :nw_dst def nx_hash_fields_to_atom(_), do: throw(:bad_enum) def nx_bd_algorithm_to_int(:active_backup), do: 0x0 def nx_bd_algorithm_to_int(:highest_random_weight), do: 0x1 def nx_bd_algorithm_to_int(_), do: throw(:bad_enum) def nx_bd_algorithm_to_atom(0x0), do: :active_backup def nx_bd_algorithm_to_atom(0x1), do: :highest_random_weight def nx_bd_algorithm_to_atom(_), do: throw(:bad_enum) def nx_learn_flag_to_int(:send_flow_rem), do: 0x1 def nx_learn_flag_to_int(:delete_learned), do: 0x2 def nx_learn_flag_to_int(:write_result), do: 0x4 def nx_learn_flag_to_int(_), do: throw(:bad_enum) def nx_learn_flag_to_atom(0x1), do: :send_flow_rem def nx_learn_flag_to_atom(0x2), do: :delete_learned def nx_learn_flag_to_atom(0x4), do: :write_result def nx_learn_flag_to_atom(_), do: throw(:bad_enum) def nx_conntrack_flags_to_int(:commit), do: 0x1 def nx_conntrack_flags_to_int(:force), do: 0x2 def nx_conntrack_flags_to_int(_), do: throw(:bad_enum) def nx_conntrack_flags_to_atom(0x1), do: :commit def nx_conntrack_flags_to_atom(0x2), do: :force def nx_conntrack_flags_to_atom(_), do: throw(:bad_enum) def nx_nat_flags_to_int(:src), do: 0x1 def nx_nat_flags_to_int(:dst), do: 0x2 def nx_nat_flags_to_int(:persistent), do: 0x4 def nx_nat_flags_to_int(:protocol_hash), do: 0x8 def nx_nat_flags_to_int(:protocol_random), do: 0x10 def nx_nat_flags_to_int(_), do: throw(:bad_enum) def nx_nat_flags_to_atom(0x1), do: :src def nx_nat_flags_to_atom(0x2), do: :dst def nx_nat_flags_to_atom(0x4), do: :persistent def nx_nat_flags_to_atom(0x8), do: :protocol_hash def nx_nat_flags_to_atom(0x10), do: :protocol_random def nx_nat_flags_to_atom(_), do: throw(:bad_enum) def nx_nat_range_to_int(:ipv4_min), do: 0x1 def nx_nat_range_to_int(:ipv4_max), do: 0x2 def nx_nat_range_to_int(:ipv6_min), do: 0x4 def nx_nat_range_to_int(:ipv6_max), do: 0x8 def nx_nat_range_to_int(:proto_min), do: 0x10 def nx_nat_range_to_int(:proto_max), do: 0x20 def nx_nat_range_to_int(_), do: throw(:bad_enum) def nx_nat_range_to_atom(0x1), do: :ipv4_min def nx_nat_range_to_atom(0x2), do: :ipv4_max def nx_nat_range_to_atom(0x4), do: :ipv6_min def nx_nat_range_to_atom(0x8), do: :ipv6_max def nx_nat_range_to_atom(0x10), do: :proto_min def nx_nat_range_to_atom(0x20), do: :proto_max def nx_nat_range_to_atom(_), do: throw(:bad_enum) def nx_action_controller2_prop_type_to_int(:max_len), do: 0x0 def nx_action_controller2_prop_type_to_int(:controller_id), do: 0x1 def nx_action_controller2_prop_type_to_int(:reason), do: 0x2 def nx_action_controller2_prop_type_to_int(:userdata), do: 0x3 def nx_action_controller2_prop_type_to_int(:pause), do: 0x4 def nx_action_controller2_prop_type_to_int(_), do: throw(:bad_enum) def nx_action_controller2_prop_type_to_atom(0x0), do: :max_len def nx_action_controller2_prop_type_to_atom(0x1), do: :controller_id def nx_action_controller2_prop_type_to_atom(0x2), do: :reason def nx_action_controller2_prop_type_to_atom(0x3), do: :userdata def nx_action_controller2_prop_type_to_atom(0x4), do: :pause def nx_action_controller2_prop_type_to_atom(_), do: throw(:bad_enum) def nx_action_sample_direction_to_int(:default), do: 0x0 def nx_action_sample_direction_to_int(:ingress), do: 0x1 def nx_action_sample_direction_to_int(:egress), do: 0x2 def nx_action_sample_direction_to_int(_), do: throw(:bad_enum) def nx_action_sample_direction_to_atom(0x0), do: :default def nx_action_sample_direction_to_atom(0x1), do: :ingress def nx_action_sample_direction_to_atom(0x2), do: :egress def nx_action_sample_direction_to_atom(_), do: throw(:bad_enum) def nx_flow_spec_type_to_int(Openflow.Action.NxFlowSpecMatch), do: 0x0 def nx_flow_spec_type_to_int(Openflow.Action.NxFlowSpecLoad), do: 0x1 def nx_flow_spec_type_to_int(Openflow.Action.NxFlowSpecOutput), do: 0x2 def nx_flow_spec_type_to_int(_), do: throw(:bad_enum) def nx_flow_spec_type_to_atom(0x0), do: Openflow.Action.NxFlowSpecMatch def nx_flow_spec_type_to_atom(0x1), do: Openflow.Action.NxFlowSpecLoad def nx_flow_spec_type_to_atom(0x2), do: Openflow.Action.NxFlowSpecOutput def nx_flow_spec_type_to_atom(_), do: throw(:bad_enum) def instruction_type_to_int(Openflow.Instruction.GotoTable), do: 0x1 def instruction_type_to_int(Openflow.Instruction.WriteMetadata), do: 0x2 def instruction_type_to_int(Openflow.Instruction.WriteActions), do: 0x3 def instruction_type_to_int(Openflow.Instruction.ApplyActions), do: 0x4 def instruction_type_to_int(Openflow.Instruction.ClearActions), do: 0x5 def instruction_type_to_int(Openflow.Instruction.Meter), do: 0x6 def instruction_type_to_int(Openflow.Instruction.Experimenter), do: 0xFFFF def instruction_type_to_int(_), do: throw(:bad_enum) def instruction_type_to_atom(0x1), do: Openflow.Instruction.GotoTable def instruction_type_to_atom(0x2), do: Openflow.Instruction.WriteMetadata def instruction_type_to_atom(0x3), do: Openflow.Instruction.WriteActions def instruction_type_to_atom(0x4), do: Openflow.Instruction.ApplyActions def instruction_type_to_atom(0x5), do: Openflow.Instruction.ClearActions def instruction_type_to_atom(0x6), do: Openflow.Instruction.Meter def instruction_type_to_atom(0xFFFF), do: Openflow.Instruction.Experimenter def instruction_type_to_atom(_), do: throw(:bad_enum) def controller_role_to_int(:nochange), do: 0x0 def controller_role_to_int(:equal), do: 0x1 def controller_role_to_int(:master), do: 0x2 def controller_role_to_int(:slave), do: 0x3 def controller_role_to_int(_), do: throw(:bad_enum) def controller_role_to_atom(0x0), do: :nochange def controller_role_to_atom(0x1), do: :equal def controller_role_to_atom(0x2), do: :master def controller_role_to_atom(0x3), do: :slave def controller_role_to_atom(_), do: throw(:bad_enum) def nx_role_to_int(:other), do: 0x0 def nx_role_to_int(:master), do: 0x1 def nx_role_to_int(:slave), do: 0x2 def nx_role_to_int(_), do: throw(:bad_enum) def nx_role_to_atom(0x0), do: :other def nx_role_to_atom(0x1), do: :master def nx_role_to_atom(0x2), do: :slave def nx_role_to_atom(_), do: throw(:bad_enum) def packet_in_format_to_int(:standard), do: 0x0 def packet_in_format_to_int(:nxt_packet_in), do: 0x1 def packet_in_format_to_int(:nxt_packet_in2), do: 0x2 def packet_in_format_to_int(_), do: throw(:bad_enum) def packet_in_format_to_atom(0x0), do: :standard def packet_in_format_to_atom(0x1), do: :nxt_packet_in def packet_in_format_to_atom(0x2), do: :nxt_packet_in2 def packet_in_format_to_atom(_), do: throw(:bad_enum) def flow_format_to_int(:openflow10), do: 0x0 def flow_format_to_int(:nxm), do: 0x1 def flow_format_to_int(_), do: throw(:bad_enum) def flow_format_to_atom(0x0), do: :openflow10 def flow_format_to_atom(0x1), do: :nxm def flow_format_to_atom(_), do: throw(:bad_enum) def packet_in2_prop_type_to_int(:packet), do: 0x0 def packet_in2_prop_type_to_int(:full_len), do: 0x1 def packet_in2_prop_type_to_int(:buffer_id), do: 0x2 def packet_in2_prop_type_to_int(:table_id), do: 0x3 def packet_in2_prop_type_to_int(:cookie), do: 0x4 def packet_in2_prop_type_to_int(:reason), do: 0x5 def packet_in2_prop_type_to_int(:metadata), do: 0x6 def packet_in2_prop_type_to_int(:userdata), do: 0x7 def packet_in2_prop_type_to_int(:continuation), do: 0x8 def packet_in2_prop_type_to_int(_), do: throw(:bad_enum) def packet_in2_prop_type_to_atom(0x0), do: :packet def packet_in2_prop_type_to_atom(0x1), do: :full_len def packet_in2_prop_type_to_atom(0x2), do: :buffer_id def packet_in2_prop_type_to_atom(0x3), do: :table_id def packet_in2_prop_type_to_atom(0x4), do: :cookie def packet_in2_prop_type_to_atom(0x5), do: :reason def packet_in2_prop_type_to_atom(0x6), do: :metadata def packet_in2_prop_type_to_atom(0x7), do: :userdata def packet_in2_prop_type_to_atom(0x8), do: :continuation def packet_in2_prop_type_to_atom(_), do: throw(:bad_enum) def continuation_prop_type_to_int(:bridge), do: 0x8000 def continuation_prop_type_to_int(:stack), do: 0x8001 def continuation_prop_type_to_int(:mirrors), do: 0x8002 def continuation_prop_type_to_int(:conntracked), do: 0x8003 def continuation_prop_type_to_int(:table_id), do: 0x8004 def continuation_prop_type_to_int(:cookie), do: 0x8005 def continuation_prop_type_to_int(:actions), do: 0x8006 def continuation_prop_type_to_int(:action_set), do: 0x8007 def continuation_prop_type_to_int(_), do: throw(:bad_enum) def continuation_prop_type_to_atom(0x8000), do: :bridge def continuation_prop_type_to_atom(0x8001), do: :stack def continuation_prop_type_to_atom(0x8002), do: :mirrors def continuation_prop_type_to_atom(0x8003), do: :conntracked def continuation_prop_type_to_atom(0x8004), do: :table_id def continuation_prop_type_to_atom(0x8005), do: :cookie def continuation_prop_type_to_atom(0x8006), do: :actions def continuation_prop_type_to_atom(0x8007), do: :action_set def continuation_prop_type_to_atom(_), do: throw(:bad_enum) def flow_monitor_flag_to_int(:initial), do: 0x1 def flow_monitor_flag_to_int(:add), do: 0x2 def flow_monitor_flag_to_int(:delete), do: 0x4 def flow_monitor_flag_to_int(:modify), do: 0x8 def flow_monitor_flag_to_int(:actions), do: 0x10 def flow_monitor_flag_to_int(:own), do: 0x20 def flow_monitor_flag_to_int(_), do: throw(:bad_enum) def flow_monitor_flag_to_atom(0x1), do: :initial def flow_monitor_flag_to_atom(0x2), do: :add def flow_monitor_flag_to_atom(0x4), do: :delete def flow_monitor_flag_to_atom(0x8), do: :modify def flow_monitor_flag_to_atom(0x10), do: :actions def flow_monitor_flag_to_atom(0x20), do: :own def flow_monitor_flag_to_atom(_), do: throw(:bad_enum) def flow_update_event_to_int(:added), do: 0x0 def flow_update_event_to_int(:deleted), do: 0x1 def flow_update_event_to_int(:modified), do: 0x2 def flow_update_event_to_int(:abbrev), do: 0x3 def flow_update_event_to_int(_), do: throw(:bad_enum) def flow_update_event_to_atom(0x0), do: :added def flow_update_event_to_atom(0x1), do: :deleted def flow_update_event_to_atom(0x2), do: :modified def flow_update_event_to_atom(0x3), do: :abbrev def flow_update_event_to_atom(_), do: throw(:bad_enum) def tlv_table_mod_command_to_int(:add), do: 0x0 def tlv_table_mod_command_to_int(:delete), do: 0x1 def tlv_table_mod_command_to_int(:clear), do: 0x2 def tlv_table_mod_command_to_int(_), do: throw(:bad_enum) def tlv_table_mod_command_to_atom(0x0), do: :add def tlv_table_mod_command_to_atom(0x1), do: :delete def tlv_table_mod_command_to_atom(0x2), do: :clear def tlv_table_mod_command_to_atom(_), do: throw(:bad_enum) def table_feature_prop_type_to_int(:instructions), do: 0x0 def table_feature_prop_type_to_int(:instructions_miss), do: 0x1 def table_feature_prop_type_to_int(:next_tables), do: 0x2 def table_feature_prop_type_to_int(:next_tables_miss), do: 0x3 def table_feature_prop_type_to_int(:write_actions), do: 0x4 def table_feature_prop_type_to_int(:write_actions_miss), do: 0x5 def table_feature_prop_type_to_int(:apply_actions), do: 0x6 def table_feature_prop_type_to_int(:apply_actions_miss), do: 0x7 def table_feature_prop_type_to_int(:match), do: 0x8 def table_feature_prop_type_to_int(:wildcards), do: 0xA def table_feature_prop_type_to_int(:write_setfield), do: 0xC def table_feature_prop_type_to_int(:write_setfield_miss), do: 0xD def table_feature_prop_type_to_int(:apply_setfield), do: 0xE def table_feature_prop_type_to_int(:apply_setfield_miss), do: 0xF def table_feature_prop_type_to_int(:experimenter), do: 0xFFFE def table_feature_prop_type_to_int(:experimenter_miss), do: 0xFFFF def table_feature_prop_type_to_int(_), do: throw(:bad_enum) def table_feature_prop_type_to_atom(0x0), do: :instructions def table_feature_prop_type_to_atom(0x1), do: :instructions_miss def table_feature_prop_type_to_atom(0x2), do: :next_tables def table_feature_prop_type_to_atom(0x3), do: :next_tables_miss def table_feature_prop_type_to_atom(0x4), do: :write_actions def table_feature_prop_type_to_atom(0x5), do: :write_actions_miss def table_feature_prop_type_to_atom(0x6), do: :apply_actions def table_feature_prop_type_to_atom(0x7), do: :apply_actions_miss def table_feature_prop_type_to_atom(0x8), do: :match def table_feature_prop_type_to_atom(0xA), do: :wildcards def table_feature_prop_type_to_atom(0xC), do: :write_setfield def table_feature_prop_type_to_atom(0xD), do: :write_setfield_miss def table_feature_prop_type_to_atom(0xE), do: :apply_setfield def table_feature_prop_type_to_atom(0xF), do: :apply_setfield_miss def table_feature_prop_type_to_atom(0xFFFE), do: :experimenter def table_feature_prop_type_to_atom(0xFFFF), do: :experimenter_miss def table_feature_prop_type_to_atom(_), do: throw(:bad_enum) def bundle_ctrl_type_to_int(:open_request), do: 0x0 def bundle_ctrl_type_to_int(:open_reply), do: 0x1 def bundle_ctrl_type_to_int(:close_request), do: 0x2 def bundle_ctrl_type_to_int(:close_reply), do: 0x3 def bundle_ctrl_type_to_int(:commit_request), do: 0x4 def bundle_ctrl_type_to_int(:commit_reply), do: 0x5 def bundle_ctrl_type_to_int(:discard_request), do: 0x6 def bundle_ctrl_type_to_int(:discard_reply), do: 0x7 def bundle_ctrl_type_to_int(_), do: throw(:bad_enum) def bundle_ctrl_type_to_atom(0x0), do: :open_request def bundle_ctrl_type_to_atom(0x1), do: :open_reply def bundle_ctrl_type_to_atom(0x2), do: :close_request def bundle_ctrl_type_to_atom(0x3), do: :close_reply def bundle_ctrl_type_to_atom(0x4), do: :commit_request def bundle_ctrl_type_to_atom(0x5), do: :commit_reply def bundle_ctrl_type_to_atom(0x6), do: :discard_request def bundle_ctrl_type_to_atom(0x7), do: :discard_reply def bundle_ctrl_type_to_atom(_), do: throw(:bad_enum) def bundle_flags_to_int(:atomic), do: 0x1 def bundle_flags_to_int(:ordered), do: 0x2 def bundle_flags_to_int(_), do: throw(:bad_enum) def bundle_flags_to_atom(0x1), do: :atomic def bundle_flags_to_atom(0x2), do: :ordered def bundle_flags_to_atom(_), do: throw(:bad_enum) def int_to_flags(int, :openflow_codec) do Openflow.Utils.int_to_flags([], int, enum_of(:openflow_codec)) end def int_to_flags(int, :experimenter_id) do Openflow.Utils.int_to_flags([], int, enum_of(:experimenter_id)) end def int_to_flags(int, :nicira_ext_message) do Openflow.Utils.int_to_flags([], int, enum_of(:nicira_ext_message)) end def int_to_flags(int, :onf_ext_message) do Openflow.Utils.int_to_flags([], int, enum_of(:onf_ext_message)) end def int_to_flags(int, :multipart_request_flags) do Openflow.Utils.int_to_flags([], int, enum_of(:multipart_request_flags)) end def int_to_flags(int, :multipart_reply_flags) do Openflow.Utils.int_to_flags([], int, enum_of(:multipart_reply_flags)) end def int_to_flags(int, :multipart_request_codec) do Openflow.Utils.int_to_flags([], int, enum_of(:multipart_request_codec)) end def int_to_flags(int, :multipart_reply_codec) do Openflow.Utils.int_to_flags([], int, enum_of(:multipart_reply_codec)) end def int_to_flags(int, :nicira_ext_stats) do Openflow.Utils.int_to_flags([], int, enum_of(:nicira_ext_stats)) end def int_to_flags(int, :hello_elem) do Openflow.Utils.int_to_flags([], int, enum_of(:hello_elem)) end def int_to_flags(int, :error_type) do Openflow.Utils.int_to_flags([], int, enum_of(:error_type)) end def int_to_flags(int, :hello_failed) do Openflow.Utils.int_to_flags([], int, enum_of(:hello_failed)) end def int_to_flags(int, :bad_request) do Openflow.Utils.int_to_flags([], int, enum_of(:bad_request)) end def int_to_flags(int, :bad_action) do Openflow.Utils.int_to_flags([], int, enum_of(:bad_action)) end def int_to_flags(int, :bad_instruction) do Openflow.Utils.int_to_flags([], int, enum_of(:bad_instruction)) end def int_to_flags(int, :bad_match) do Openflow.Utils.int_to_flags([], int, enum_of(:bad_match)) end def int_to_flags(int, :flow_mod_failed) do Openflow.Utils.int_to_flags([], int, enum_of(:flow_mod_failed)) end def int_to_flags(int, :group_mod_failed) do Openflow.Utils.int_to_flags([], int, enum_of(:group_mod_failed)) end def int_to_flags(int, :port_mod_failed) do Openflow.Utils.int_to_flags([], int, enum_of(:port_mod_failed)) end def int_to_flags(int, :table_mod_failed) do Openflow.Utils.int_to_flags([], int, enum_of(:table_mod_failed)) end def int_to_flags(int, :queue_op_failed) do Openflow.Utils.int_to_flags([], int, enum_of(:queue_op_failed)) end def int_to_flags(int, :switch_config_failed) do Openflow.Utils.int_to_flags([], int, enum_of(:switch_config_failed)) end def int_to_flags(int, :role_request_failed) do Openflow.Utils.int_to_flags([], int, enum_of(:role_request_failed)) end def int_to_flags(int, :meter_mod_failed) do Openflow.Utils.int_to_flags([], int, enum_of(:meter_mod_failed)) end def int_to_flags(int, :table_features_failed) do Openflow.Utils.int_to_flags([], int, enum_of(:table_features_failed)) end def int_to_flags(int, :switch_capabilities) do Openflow.Utils.int_to_flags([], int, enum_of(:switch_capabilities)) end def int_to_flags(int, :config_flags) do Openflow.Utils.int_to_flags([], int, enum_of(:config_flags)) end def int_to_flags(int, :controller_max_len) do Openflow.Utils.int_to_flags([], int, enum_of(:controller_max_len)) end def int_to_flags(int, :experimenter_oxm_vendors) do Openflow.Utils.int_to_flags([], int, enum_of(:experimenter_oxm_vendors)) end def int_to_flags(int, :match_type) do Openflow.Utils.int_to_flags([], int, enum_of(:match_type)) end def int_to_flags(int, :oxm_class) do Openflow.Utils.int_to_flags([], int, enum_of(:oxm_class)) end def int_to_flags(int, :nxm_0) do Openflow.Utils.int_to_flags([], int, enum_of(:nxm_0)) end def int_to_flags(int, :nxm_1) do Openflow.Utils.int_to_flags([], int, enum_of(:nxm_1)) end def int_to_flags(int, :openflow_basic) do Openflow.Utils.int_to_flags([], int, enum_of(:openflow_basic)) end def int_to_flags(int, :vlan_id) do Openflow.Utils.int_to_flags([], int, enum_of(:vlan_id)) end def int_to_flags(int, :ipv6exthdr_flags) do Openflow.Utils.int_to_flags([], int, enum_of(:ipv6exthdr_flags)) end def int_to_flags(int, :tcp_flags) do Openflow.Utils.int_to_flags([], int, enum_of(:tcp_flags)) end def int_to_flags(int, :tun_gbp_flags) do Openflow.Utils.int_to_flags([], int, enum_of(:tun_gbp_flags)) end def int_to_flags(int, :ct_state_flags) do Openflow.Utils.int_to_flags([], int, enum_of(:ct_state_flags)) end def int_to_flags(int, :packet_register) do Openflow.Utils.int_to_flags([], int, enum_of(:packet_register)) end def int_to_flags(int, :nxoxm_nsh_match) do Openflow.Utils.int_to_flags([], int, enum_of(:nxoxm_nsh_match)) end def int_to_flags(int, :onf_ext_match) do Openflow.Utils.int_to_flags([], int, enum_of(:onf_ext_match)) end def int_to_flags(int, :nxoxm_match) do Openflow.Utils.int_to_flags([], int, enum_of(:nxoxm_match)) end def int_to_flags(int, :buffer_id) do Openflow.Utils.int_to_flags([], int, enum_of(:buffer_id)) end def int_to_flags(int, :port_config) do Openflow.Utils.int_to_flags([], int, enum_of(:port_config)) end def int_to_flags(int, :port_state) do Openflow.Utils.int_to_flags([], int, enum_of(:port_state)) end def int_to_flags(int, :port_features) do Openflow.Utils.int_to_flags([], int, enum_of(:port_features)) end def int_to_flags(int, :openflow10_port_no) do Openflow.Utils.int_to_flags([], int, enum_of(:openflow10_port_no)) end def int_to_flags(int, :openflow13_port_no) do Openflow.Utils.int_to_flags([], int, enum_of(:openflow13_port_no)) end def int_to_flags(int, :packet_in_reason) do Openflow.Utils.int_to_flags([], int, enum_of(:packet_in_reason)) end def int_to_flags(int, :packet_in_reason_mask) do Openflow.Utils.int_to_flags([], int, enum_of(:packet_in_reason_mask)) end def int_to_flags(int, :flow_mod_command) do Openflow.Utils.int_to_flags([], int, enum_of(:flow_mod_command)) end def int_to_flags(int, :flow_mod_flags) do Openflow.Utils.int_to_flags([], int, enum_of(:flow_mod_flags)) end def int_to_flags(int, :flow_removed_reason) do Openflow.Utils.int_to_flags([], int, enum_of(:flow_removed_reason)) end def int_to_flags(int, :flow_removed_reason_mask) do Openflow.Utils.int_to_flags([], int, enum_of(:flow_removed_reason_mask)) end def int_to_flags(int, :port_reason) do Openflow.Utils.int_to_flags([], int, enum_of(:port_reason)) end def int_to_flags(int, :port_reason_mask) do Openflow.Utils.int_to_flags([], int, enum_of(:port_reason_mask)) end def int_to_flags(int, :group_mod_command) do Openflow.Utils.int_to_flags([], int, enum_of(:group_mod_command)) end def int_to_flags(int, :group_type) do Openflow.Utils.int_to_flags([], int, enum_of(:group_type)) end def int_to_flags(int, :group_type_flags) do Openflow.Utils.int_to_flags([], int, enum_of(:group_type_flags)) end def int_to_flags(int, :group_id) do Openflow.Utils.int_to_flags([], int, enum_of(:group_id)) end def int_to_flags(int, :group_capabilities) do Openflow.Utils.int_to_flags([], int, enum_of(:group_capabilities)) end def int_to_flags(int, :table_id) do Openflow.Utils.int_to_flags([], int, enum_of(:table_id)) end def int_to_flags(int, :queue_id) do Openflow.Utils.int_to_flags([], int, enum_of(:queue_id)) end def int_to_flags(int, :meter_mod_command) do Openflow.Utils.int_to_flags([], int, enum_of(:meter_mod_command)) end def int_to_flags(int, :meter_id) do Openflow.Utils.int_to_flags([], int, enum_of(:meter_id)) end def int_to_flags(int, :meter_flags) do Openflow.Utils.int_to_flags([], int, enum_of(:meter_flags)) end def int_to_flags(int, :meter_band_type) do Openflow.Utils.int_to_flags([], int, enum_of(:meter_band_type)) end def int_to_flags(int, :table_config) do Openflow.Utils.int_to_flags([], int, enum_of(:table_config)) end def int_to_flags(int, :action_type) do Openflow.Utils.int_to_flags([], int, enum_of(:action_type)) end def int_to_flags(int, :action_flags) do Openflow.Utils.int_to_flags([], int, enum_of(:action_flags)) end def int_to_flags(int, :action_vendor) do Openflow.Utils.int_to_flags([], int, enum_of(:action_vendor)) end def int_to_flags(int, :onf_ext_action) do Openflow.Utils.int_to_flags([], int, enum_of(:onf_ext_action)) end def int_to_flags(int, :nicira_ext_action) do Openflow.Utils.int_to_flags([], int, enum_of(:nicira_ext_action)) end def int_to_flags(int, :nx_mp_algorithm) do Openflow.Utils.int_to_flags([], int, enum_of(:nx_mp_algorithm)) end def int_to_flags(int, :nx_hash_fields) do Openflow.Utils.int_to_flags([], int, enum_of(:nx_hash_fields)) end def int_to_flags(int, :nx_bd_algorithm) do Openflow.Utils.int_to_flags([], int, enum_of(:nx_bd_algorithm)) end def int_to_flags(int, :nx_learn_flag) do Openflow.Utils.int_to_flags([], int, enum_of(:nx_learn_flag)) end def int_to_flags(int, :nx_conntrack_flags) do Openflow.Utils.int_to_flags([], int, enum_of(:nx_conntrack_flags)) end def int_to_flags(int, :nx_nat_flags) do Openflow.Utils.int_to_flags([], int, enum_of(:nx_nat_flags)) end def int_to_flags(int, :nx_nat_range) do Openflow.Utils.int_to_flags([], int, enum_of(:nx_nat_range)) end def int_to_flags(int, :nx_action_controller2_prop_type) do Openflow.Utils.int_to_flags([], int, enum_of(:nx_action_controller2_prop_type)) end def int_to_flags(int, :nx_action_sample_direction) do Openflow.Utils.int_to_flags([], int, enum_of(:nx_action_sample_direction)) end def int_to_flags(int, :nx_flow_spec_type) do Openflow.Utils.int_to_flags([], int, enum_of(:nx_flow_spec_type)) end def int_to_flags(int, :instruction_type) do Openflow.Utils.int_to_flags([], int, enum_of(:instruction_type)) end def int_to_flags(int, :controller_role) do Openflow.Utils.int_to_flags([], int, enum_of(:controller_role)) end def int_to_flags(int, :nx_role) do Openflow.Utils.int_to_flags([], int, enum_of(:nx_role)) end def int_to_flags(int, :packet_in_format) do Openflow.Utils.int_to_flags([], int, enum_of(:packet_in_format)) end def int_to_flags(int, :flow_format) do Openflow.Utils.int_to_flags([], int, enum_of(:flow_format)) end def int_to_flags(int, :packet_in2_prop_type) do Openflow.Utils.int_to_flags([], int, enum_of(:packet_in2_prop_type)) end def int_to_flags(int, :continuation_prop_type) do Openflow.Utils.int_to_flags([], int, enum_of(:continuation_prop_type)) end def int_to_flags(int, :flow_monitor_flag) do Openflow.Utils.int_to_flags([], int, enum_of(:flow_monitor_flag)) end def int_to_flags(int, :flow_update_event) do Openflow.Utils.int_to_flags([], int, enum_of(:flow_update_event)) end def int_to_flags(int, :tlv_table_mod_command) do Openflow.Utils.int_to_flags([], int, enum_of(:tlv_table_mod_command)) end def int_to_flags(int, :table_feature_prop_type) do Openflow.Utils.int_to_flags([], int, enum_of(:table_feature_prop_type)) end def int_to_flags(int, :bundle_ctrl_type) do Openflow.Utils.int_to_flags([], int, enum_of(:bundle_ctrl_type)) end def int_to_flags(int, :bundle_flags) do Openflow.Utils.int_to_flags([], int, enum_of(:bundle_flags)) end def flags_to_int(flags, :openflow_codec) do Openflow.Utils.flags_to_int(0, flags, enum_of(:openflow_codec)) end def flags_to_int(flags, :experimenter_id) do Openflow.Utils.flags_to_int(0, flags, enum_of(:experimenter_id)) end def flags_to_int(flags, :nicira_ext_message) do Openflow.Utils.flags_to_int(0, flags, enum_of(:nicira_ext_message)) end def flags_to_int(flags, :onf_ext_message) do Openflow.Utils.flags_to_int(0, flags, enum_of(:onf_ext_message)) end def flags_to_int(flags, :multipart_request_flags) do Openflow.Utils.flags_to_int(0, flags, enum_of(:multipart_request_flags)) end def flags_to_int(flags, :multipart_reply_flags) do Openflow.Utils.flags_to_int(0, flags, enum_of(:multipart_reply_flags)) end def flags_to_int(flags, :multipart_request_codec) do Openflow.Utils.flags_to_int(0, flags, enum_of(:multipart_request_codec)) end def flags_to_int(flags, :multipart_reply_codec) do Openflow.Utils.flags_to_int(0, flags, enum_of(:multipart_reply_codec)) end def flags_to_int(flags, :nicira_ext_stats) do Openflow.Utils.flags_to_int(0, flags, enum_of(:nicira_ext_stats)) end def flags_to_int(flags, :hello_elem) do Openflow.Utils.flags_to_int(0, flags, enum_of(:hello_elem)) end def flags_to_int(flags, :error_type) do Openflow.Utils.flags_to_int(0, flags, enum_of(:error_type)) end def flags_to_int(flags, :hello_failed) do Openflow.Utils.flags_to_int(0, flags, enum_of(:hello_failed)) end def flags_to_int(flags, :bad_request) do Openflow.Utils.flags_to_int(0, flags, enum_of(:bad_request)) end def flags_to_int(flags, :bad_action) do Openflow.Utils.flags_to_int(0, flags, enum_of(:bad_action)) end def flags_to_int(flags, :bad_instruction) do Openflow.Utils.flags_to_int(0, flags, enum_of(:bad_instruction)) end def flags_to_int(flags, :bad_match) do Openflow.Utils.flags_to_int(0, flags, enum_of(:bad_match)) end def flags_to_int(flags, :flow_mod_failed) do Openflow.Utils.flags_to_int(0, flags, enum_of(:flow_mod_failed)) end def flags_to_int(flags, :group_mod_failed) do Openflow.Utils.flags_to_int(0, flags, enum_of(:group_mod_failed)) end def flags_to_int(flags, :port_mod_failed) do Openflow.Utils.flags_to_int(0, flags, enum_of(:port_mod_failed)) end def flags_to_int(flags, :table_mod_failed) do Openflow.Utils.flags_to_int(0, flags, enum_of(:table_mod_failed)) end def flags_to_int(flags, :queue_op_failed) do Openflow.Utils.flags_to_int(0, flags, enum_of(:queue_op_failed)) end def flags_to_int(flags, :switch_config_failed) do Openflow.Utils.flags_to_int(0, flags, enum_of(:switch_config_failed)) end def flags_to_int(flags, :role_request_failed) do Openflow.Utils.flags_to_int(0, flags, enum_of(:role_request_failed)) end def flags_to_int(flags, :meter_mod_failed) do Openflow.Utils.flags_to_int(0, flags, enum_of(:meter_mod_failed)) end def flags_to_int(flags, :table_features_failed) do Openflow.Utils.flags_to_int(0, flags, enum_of(:table_features_failed)) end def flags_to_int(flags, :switch_capabilities) do Openflow.Utils.flags_to_int(0, flags, enum_of(:switch_capabilities)) end def flags_to_int(flags, :config_flags) do Openflow.Utils.flags_to_int(0, flags, enum_of(:config_flags)) end def flags_to_int(flags, :controller_max_len) do Openflow.Utils.flags_to_int(0, flags, enum_of(:controller_max_len)) end def flags_to_int(flags, :experimenter_oxm_vendors) do Openflow.Utils.flags_to_int(0, flags, enum_of(:experimenter_oxm_vendors)) end def flags_to_int(flags, :match_type) do Openflow.Utils.flags_to_int(0, flags, enum_of(:match_type)) end def flags_to_int(flags, :oxm_class) do Openflow.Utils.flags_to_int(0, flags, enum_of(:oxm_class)) end def flags_to_int(flags, :nxm_0) do Openflow.Utils.flags_to_int(0, flags, enum_of(:nxm_0)) end def flags_to_int(flags, :nxm_1) do Openflow.Utils.flags_to_int(0, flags, enum_of(:nxm_1)) end def flags_to_int(flags, :openflow_basic) do Openflow.Utils.flags_to_int(0, flags, enum_of(:openflow_basic)) end def flags_to_int(flags, :vlan_id) do Openflow.Utils.flags_to_int(0, flags, enum_of(:vlan_id)) end def flags_to_int(flags, :ipv6exthdr_flags) do Openflow.Utils.flags_to_int(0, flags, enum_of(:ipv6exthdr_flags)) end def flags_to_int(flags, :tcp_flags) do Openflow.Utils.flags_to_int(0, flags, enum_of(:tcp_flags)) end def flags_to_int(flags, :tun_gbp_flags) do Openflow.Utils.flags_to_int(0, flags, enum_of(:tun_gbp_flags)) end def flags_to_int(flags, :ct_state_flags) do Openflow.Utils.flags_to_int(0, flags, enum_of(:ct_state_flags)) end def flags_to_int(flags, :packet_register) do Openflow.Utils.flags_to_int(0, flags, enum_of(:packet_register)) end def flags_to_int(flags, :nxoxm_nsh_match) do Openflow.Utils.flags_to_int(0, flags, enum_of(:nxoxm_nsh_match)) end def flags_to_int(flags, :onf_ext_match) do Openflow.Utils.flags_to_int(0, flags, enum_of(:onf_ext_match)) end def flags_to_int(flags, :nxoxm_match) do Openflow.Utils.flags_to_int(0, flags, enum_of(:nxoxm_match)) end def flags_to_int(flags, :buffer_id) do Openflow.Utils.flags_to_int(0, flags, enum_of(:buffer_id)) end def flags_to_int(flags, :port_config) do Openflow.Utils.flags_to_int(0, flags, enum_of(:port_config)) end def flags_to_int(flags, :port_state) do Openflow.Utils.flags_to_int(0, flags, enum_of(:port_state)) end def flags_to_int(flags, :port_features) do Openflow.Utils.flags_to_int(0, flags, enum_of(:port_features)) end def flags_to_int(flags, :openflow10_port_no) do Openflow.Utils.flags_to_int(0, flags, enum_of(:openflow10_port_no)) end def flags_to_int(flags, :openflow13_port_no) do Openflow.Utils.flags_to_int(0, flags, enum_of(:openflow13_port_no)) end def flags_to_int(flags, :packet_in_reason) do Openflow.Utils.flags_to_int(0, flags, enum_of(:packet_in_reason)) end def flags_to_int(flags, :packet_in_reason_mask) do Openflow.Utils.flags_to_int(0, flags, enum_of(:packet_in_reason_mask)) end def flags_to_int(flags, :flow_mod_command) do Openflow.Utils.flags_to_int(0, flags, enum_of(:flow_mod_command)) end def flags_to_int(flags, :flow_mod_flags) do Openflow.Utils.flags_to_int(0, flags, enum_of(:flow_mod_flags)) end def flags_to_int(flags, :flow_removed_reason) do Openflow.Utils.flags_to_int(0, flags, enum_of(:flow_removed_reason)) end def flags_to_int(flags, :flow_removed_reason_mask) do Openflow.Utils.flags_to_int(0, flags, enum_of(:flow_removed_reason_mask)) end def flags_to_int(flags, :port_reason) do Openflow.Utils.flags_to_int(0, flags, enum_of(:port_reason)) end def flags_to_int(flags, :port_reason_mask) do Openflow.Utils.flags_to_int(0, flags, enum_of(:port_reason_mask)) end def flags_to_int(flags, :group_mod_command) do Openflow.Utils.flags_to_int(0, flags, enum_of(:group_mod_command)) end def flags_to_int(flags, :group_type) do Openflow.Utils.flags_to_int(0, flags, enum_of(:group_type)) end def flags_to_int(flags, :group_type_flags) do Openflow.Utils.flags_to_int(0, flags, enum_of(:group_type_flags)) end def flags_to_int(flags, :group_id) do Openflow.Utils.flags_to_int(0, flags, enum_of(:group_id)) end def flags_to_int(flags, :group_capabilities) do Openflow.Utils.flags_to_int(0, flags, enum_of(:group_capabilities)) end def flags_to_int(flags, :table_id) do Openflow.Utils.flags_to_int(0, flags, enum_of(:table_id)) end def flags_to_int(flags, :queue_id) do Openflow.Utils.flags_to_int(0, flags, enum_of(:queue_id)) end def flags_to_int(flags, :meter_mod_command) do Openflow.Utils.flags_to_int(0, flags, enum_of(:meter_mod_command)) end def flags_to_int(flags, :meter_id) do Openflow.Utils.flags_to_int(0, flags, enum_of(:meter_id)) end def flags_to_int(flags, :meter_flags) do Openflow.Utils.flags_to_int(0, flags, enum_of(:meter_flags)) end def flags_to_int(flags, :meter_band_type) do Openflow.Utils.flags_to_int(0, flags, enum_of(:meter_band_type)) end def flags_to_int(flags, :table_config) do Openflow.Utils.flags_to_int(0, flags, enum_of(:table_config)) end def flags_to_int(flags, :action_type) do Openflow.Utils.flags_to_int(0, flags, enum_of(:action_type)) end def flags_to_int(flags, :action_flags) do Openflow.Utils.flags_to_int(0, flags, enum_of(:action_flags)) end def flags_to_int(flags, :action_vendor) do Openflow.Utils.flags_to_int(0, flags, enum_of(:action_vendor)) end def flags_to_int(flags, :onf_ext_action) do Openflow.Utils.flags_to_int(0, flags, enum_of(:onf_ext_action)) end def flags_to_int(flags, :nicira_ext_action) do Openflow.Utils.flags_to_int(0, flags, enum_of(:nicira_ext_action)) end def flags_to_int(flags, :nx_mp_algorithm) do Openflow.Utils.flags_to_int(0, flags, enum_of(:nx_mp_algorithm)) end def flags_to_int(flags, :nx_hash_fields) do Openflow.Utils.flags_to_int(0, flags, enum_of(:nx_hash_fields)) end def flags_to_int(flags, :nx_bd_algorithm) do Openflow.Utils.flags_to_int(0, flags, enum_of(:nx_bd_algorithm)) end def flags_to_int(flags, :nx_learn_flag) do Openflow.Utils.flags_to_int(0, flags, enum_of(:nx_learn_flag)) end def flags_to_int(flags, :nx_conntrack_flags) do Openflow.Utils.flags_to_int(0, flags, enum_of(:nx_conntrack_flags)) end def flags_to_int(flags, :nx_nat_flags) do Openflow.Utils.flags_to_int(0, flags, enum_of(:nx_nat_flags)) end def flags_to_int(flags, :nx_nat_range) do Openflow.Utils.flags_to_int(0, flags, enum_of(:nx_nat_range)) end def flags_to_int(flags, :nx_action_controller2_prop_type) do Openflow.Utils.flags_to_int(0, flags, enum_of(:nx_action_controller2_prop_type)) end def flags_to_int(flags, :nx_action_sample_direction) do Openflow.Utils.flags_to_int(0, flags, enum_of(:nx_action_sample_direction)) end def flags_to_int(flags, :nx_flow_spec_type) do Openflow.Utils.flags_to_int(0, flags, enum_of(:nx_flow_spec_type)) end def flags_to_int(flags, :instruction_type) do Openflow.Utils.flags_to_int(0, flags, enum_of(:instruction_type)) end def flags_to_int(flags, :controller_role) do Openflow.Utils.flags_to_int(0, flags, enum_of(:controller_role)) end def flags_to_int(flags, :nx_role) do Openflow.Utils.flags_to_int(0, flags, enum_of(:nx_role)) end def flags_to_int(flags, :packet_in_format) do Openflow.Utils.flags_to_int(0, flags, enum_of(:packet_in_format)) end def flags_to_int(flags, :flow_format) do Openflow.Utils.flags_to_int(0, flags, enum_of(:flow_format)) end def flags_to_int(flags, :packet_in2_prop_type) do Openflow.Utils.flags_to_int(0, flags, enum_of(:packet_in2_prop_type)) end def flags_to_int(flags, :continuation_prop_type) do Openflow.Utils.flags_to_int(0, flags, enum_of(:continuation_prop_type)) end def flags_to_int(flags, :flow_monitor_flag) do Openflow.Utils.flags_to_int(0, flags, enum_of(:flow_monitor_flag)) end def flags_to_int(flags, :flow_update_event) do Openflow.Utils.flags_to_int(0, flags, enum_of(:flow_update_event)) end def flags_to_int(flags, :tlv_table_mod_command) do Openflow.Utils.flags_to_int(0, flags, enum_of(:tlv_table_mod_command)) end def flags_to_int(flags, :table_feature_prop_type) do Openflow.Utils.flags_to_int(0, flags, enum_of(:table_feature_prop_type)) end def flags_to_int(flags, :bundle_ctrl_type) do Openflow.Utils.flags_to_int(0, flags, enum_of(:bundle_ctrl_type)) end def flags_to_int(flags, :bundle_flags) do Openflow.Utils.flags_to_int(0, flags, enum_of(:bundle_flags)) end defp enum_of(:openflow_codec), do: [ {Openflow.Hello, 0}, {Openflow.ErrorMsg, 1}, {Openflow.Echo.Request, 2}, {Openflow.Echo.Reply, 3}, {Openflow.Experimenter, 4}, {Openflow.Features.Request, 5}, {Openflow.Features.Reply, 6}, {Openflow.GetConfig.Request, 7}, {Openflow.GetConfig.Reply, 8}, {Openflow.SetConfig, 9}, {Openflow.PacketIn, 10}, {Openflow.FlowRemoved, 11}, {Openflow.PortStatus, 12}, {Openflow.PacketOut, 13}, {Openflow.FlowMod, 14}, {Openflow.GroupMod, 15}, {Openflow.PortMod, 16}, {Openflow.TableMod, 17}, {Openflow.Multipart.Request, 18}, {Openflow.Multipart.Reply, 19}, {Openflow.Barrier.Request, 20}, {Openflow.Barrier.Reply, 21}, {Openflow.Role.Request, 24}, {Openflow.Role.Reply, 25}, {Openflow.GetAsync.Request, 26}, {Openflow.GetAsync.Reply, 27}, {Openflow.SetAsync, 28}, {Openflow.MeterMod, 29} ] defp enum_of(:experimenter_id), do: [nicira_ext_message: 8992, onf_ext_message: 1_330_529_792] defp enum_of(:nicira_ext_message), do: [ {Openflow.NxSetPacketInFormat, 16}, {Openflow.NxSetControllerId, 20}, {Openflow.NxFlowMonitor.Cancel, 21}, {Openflow.NxFlowMonitor.Paused, 22}, {Openflow.NxFlowMonitor.Resumed, 23}, {Openflow.NxTLVTableMod, 24}, {Openflow.NxTLVTable.Request, 25}, {Openflow.NxTLVTable.Reply, 26}, {Openflow.NxSetAsyncConfig2, 27}, {Openflow.NxResume, 28}, {Openflow.NxCtFlushZone, 29}, {Openflow.NxPacketIn2, 30} ] defp enum_of(:onf_ext_message), do: [{Openflow.OnfBundleControl, 2300}, {Openflow.OnfBundleAddMessage, 2301}] defp enum_of(:multipart_request_flags), do: [more: 1] defp enum_of(:multipart_reply_flags), do: [more: 1] defp enum_of(:multipart_request_codec), do: [ {Openflow.Multipart.Desc.Request, 0}, {Openflow.Multipart.Flow.Request, 1}, {Openflow.Multipart.Aggregate.Request, 2}, {Openflow.Multipart.Table.Request, 3}, {Openflow.Multipart.Port.Request, 4}, {Openflow.Multipart.Queue.Request, 5}, {Openflow.Multipart.Group.Request, 6}, {Openflow.Multipart.GroupDesc.Request, 7}, {Openflow.Multipart.GroupFeatures.Request, 8}, {Openflow.Multipart.Meter.Request, 9}, {Openflow.Multipart.MeterConfig.Request, 10}, {Openflow.Multipart.MeterFeatures.Request, 11}, {Openflow.Multipart.TableFeatures.Request, 12}, {Openflow.Multipart.PortDesc.Request, 13}, {Openflow.Multipart.Experimenter.Request, 65535} ] defp enum_of(:multipart_reply_codec), do: [ {Openflow.Multipart.Desc.Reply, 0}, {Openflow.Multipart.Flow.Reply, 1}, {Openflow.Multipart.Aggregate.Reply, 2}, {Openflow.Multipart.Table.Reply, 3}, {Openflow.Multipart.Port.Reply, 4}, {Openflow.Multipart.Queue.Reply, 5}, {Openflow.Multipart.Group.Reply, 6}, {Openflow.Multipart.GroupDesc.Reply, 7}, {Openflow.Multipart.GroupFeatures.Reply, 8}, {Openflow.Multipart.Meter.Reply, 9}, {Openflow.Multipart.MeterConfig.Reply, 10}, {Openflow.Multipart.MeterFeatures.Reply, 11}, {Openflow.Multipart.TableFeatures.Reply, 12}, {Openflow.Multipart.PortDesc.Reply, 13}, {Openflow.Multipart.Experimenter.Reply, 65535} ] defp enum_of(:nicira_ext_stats), do: [ {Openflow.Multipart.NxFlow, 0}, {Openflow.Multipart.NxAggregate, 1}, {Openflow.Multipart.NxFlowMonitor, 2}, {Openflow.Multipart.NxIPFIXBridge, 3}, {Openflow.Multipart.NxIPFIXFlow, 4} ] defp enum_of(:hello_elem), do: [versionbitmap: 1] defp enum_of(:error_type), do: [ hello_failed: 0, bad_request: 1, bad_action: 2, bad_instruction: 3, bad_match: 4, flow_mod_failed: 5, group_mod_failed: 6, port_mod_failed: 7, table_mod_failed: 8, queue_op_failed: 9, switch_config_failed: 10, role_request_failed: 11, meter_mod_failed: 12, table_features_failed: 13, experimenter: 65535 ] defp enum_of(:hello_failed), do: [inconpatible: 0, eperm: 1] defp enum_of(:bad_request), do: [ bad_version: 0, bad_type: 1, bad_multipart: 2, bad_experimeter: 3, bad_exp_type: 4, eperm: 5, bad_len: 6, buffer_empty: 7, buffer_unknown: 8, bad_table_id: 9, is_slave: 10, bad_port: 11, bad_packet: 12, multipart_buffer_overflow: 13, multipart_request_timeout: 14, multipart_reply_timeout: 15, nxm_invalid: 256, nxm_bad_type: 257, must_be_zero: 515, bad_reason: 516, flow_monitor_bad_event: 520, undecodable_error: 521, resume_not_supported: 533, resume_stale: 534 ] defp enum_of(:bad_action), do: [ bad_type: 0, bad_len: 1, bad_experimeter: 2, bad_exp_type: 3, bad_out_port: 4, bad_argument: 5, eperm: 6, too_many: 7, bad_queue: 8, bad_out_group: 9, match_inconsistent: 10, unsupported_order: 11, bad_tag: 12, bad_set_type: 13, bad_set_len: 14, bad_set_argument: 15, must_be_zero: 256, conntrack_datapath_support: 265, bad_conjunction: 526 ] defp enum_of(:bad_instruction), do: [ unknown_instruction: 0, unsupported_instruction: 1, bad_table_id: 2, unsupported_metadata: 3, unsupported_metadata_mask: 4, bad_experimeter: 5, bad_exp_type: 6, bad_len: 7, eperm: 8, dup_inst: 256 ] defp enum_of(:bad_match), do: [ bad_type: 0, bad_len: 1, bad_tag: 2, bad_dl_addr_mask: 3, bad_nw_addr_mask: 4, bad_wildcards: 5, bad_field: 6, bad_value: 7, bad_mask: 8, bad_prereq: 9, dup_field: 10, eperm: 11, conntrack_datapath_support: 264 ] defp enum_of(:flow_mod_failed), do: [ unknown: 0, table_full: 1, bad_table_id: 2, overlap: 3, eperm: 4, bad_timeout: 5, bad_command: 6, bad_flags: 7 ] defp enum_of(:group_mod_failed), do: [ group_exists: 0, invalid_group: 1, weight_unsupported: 2, out_of_groups: 3, ouf_of_buckets: 4, chaining_unsupported: 5, watch_unsupported: 6, loop: 7, unknown_group: 8, chained_group: 9, bad_type: 10, bad_command: 11, bad_bucket: 12, bad_watch: 13, eperm: 14, unknown_bucket: 15, bucket_exists: 16 ] defp enum_of(:port_mod_failed), do: [bad_port: 0, bad_hw_addr: 1, bad_config: 2, bad_advertise: 3, eperm: 4] defp enum_of(:table_mod_failed), do: [bad_table: 0, bad_config: 1, eperm: 2] defp enum_of(:queue_op_failed), do: [bad_port: 0, bad_queue: 1, eperm: 2] defp enum_of(:switch_config_failed), do: [bad_flags: 0, bad_len: 1, eperm: 2] defp enum_of(:role_request_failed), do: [stale: 0, unsup: 1, bad_role: 2] defp enum_of(:meter_mod_failed), do: [ unknown: 0, meter_exists: 1, invalid_meter: 2, unknown_meter: 3, bad_command: 4, bad_flags: 5, bad_rate: 6, bad_burst: 7, bad_band: 8, bad_band_value: 9, out_of_meters: 10, out_of_bands: 11 ] defp enum_of(:table_features_failed), do: [ bad_table: 0, bad_metadata: 1, bad_type: 2, bad_len: 3, bad_argument: 4, eperm: 5 ] defp enum_of(:switch_capabilities), do: [ flow_stats: 1, table_stats: 2, port_stats: 4, group_stats: 8, ip_reasm: 32, queue_stats: 64, arp_match_ip: 128, port_blocked: 256 ] defp enum_of(:config_flags), do: [fragment_drop: 1, fragment_reassemble: 2] defp enum_of(:controller_max_len), do: [max: 65509, no_buffer: 65535] defp enum_of(:experimenter_oxm_vendors), do: [ nxoxm_nsh_match: 5_953_104, nxoxm_match: 8992, hp_ext_match: 9256, onf_ext_match: 1_330_529_792 ] defp enum_of(:match_type), do: [standard: 0, oxm: 1] defp enum_of(:oxm_class), do: [ nxm_0: 0, nxm_1: 1, openflow_basic: 32768, packet_register: 32769, experimenter: 65535 ] defp enum_of(:nxm_0), do: [ nx_in_port: 0, nx_eth_dst: 1, nx_eth_src: 2, nx_eth_type: 3, nx_vlan_tci: 4, nx_ip_tos: 5, nx_ip_proto: 6, nx_ipv4_src: 7, nx_ipv4_dst: 8, nx_tcp_src: 9, nx_tcp_dst: 10, nx_udp_src: 11, nx_udp_dst: 12, nx_icmpv4_type: 13, nx_icmpv4_code: 14, nx_arp_op: 15, nx_arp_spa: 16, nx_arp_tpa: 17, nx_tcp_flags: 34 ] defp enum_of(:nxm_1), do: [ reg0: 0, reg1: 1, reg2: 2, reg3: 3, reg4: 4, reg5: 5, reg6: 6, reg7: 7, reg8: 8, reg9: 9, reg10: 10, reg11: 11, reg12: 12, reg13: 13, reg14: 14, reg15: 15, tun_id: 16, nx_arp_sha: 17, nx_arp_tha: 18, nx_ipv6_src: 19, nx_ipv6_dst: 20, nx_icmpv6_type: 21, nx_icmpv6_code: 22, nx_ipv6_nd_target: 23, nx_ipv6_nd_sll: 24, nx_ipv6_nd_tll: 25, nx_ip_frag: 26, nx_ipv6_label: 27, nx_ip_ecn: 28, nx_ip_ttl: 29, nx_mpls_ttl: 30, tun_src: 31, tun_dst: 32, pkt_mark: 33, dp_hash: 35, recirc_id: 36, conj_id: 37, tun_gbp_id: 38, tun_gbp_flags: 39, tun_metadata0: 40, tun_metadata1: 41, tun_metadata2: 42, tun_metadata3: 43, tun_metadata4: 44, tun_metadata5: 45, tun_metadata6: 46, tun_metadata7: 47, tun_metadata8: 48, tun_metadata9: 49, tun_metadata10: 50, tun_metadata11: 51, tun_metadata12: 52, tun_metadata13: 53, tun_metadata14: 54, tun_metadata15: 55, tun_metadata16: 56, tun_metadata17: 57, tun_metadata18: 58, tun_metadata19: 59, tun_metadata20: 60, tun_metadata21: 61, tun_metadata22: 62, tun_metadata23: 63, tun_metadata24: 64, tun_metadata25: 65, tun_metadata26: 66, tun_metadata27: 67, tun_metadata28: 68, tun_metadata29: 69, tun_metadata30: 70, tun_metadata31: 71, tun_metadata32: 72, tun_metadata33: 73, tun_metadata34: 74, tun_metadata35: 75, tun_metadata36: 76, tun_metadata37: 77, tun_metadata38: 78, tun_metadata39: 79, tun_metadata40: 80, tun_metadata41: 81, tun_metadata42: 82, tun_metadata43: 83, tun_metadata44: 84, tun_metadata45: 85, tun_metadata46: 86, tun_metadata47: 87, tun_metadata48: 88, tun_metadata49: 89, tun_metadata50: 90, tun_metadata51: 91, tun_metadata52: 92, tun_metadata53: 93, tun_metadata54: 94, tun_metadata55: 95, tun_metadata56: 96, tun_metadata57: 97, tun_metadata58: 98, tun_metadata59: 99, tun_metadata60: 100, tun_metadata61: 101, tun_metadata62: 102, tun_metadata63: 103, tun_flags: 104, ct_state: 105, ct_zone: 106, ct_mark: 107, ct_label: 108, tun_ipv6_src: 109, tun_ipv6_dst: 110, xxreg0: 111, xxreg1: 112, xxreg2: 113, xxreg3: 114, xxreg4: 115, xxreg5: 116, xxreg6: 117, xxreg7: 118, ct_nw_proto: 119, ct_nw_src: 120, ct_nw_dst: 121, ct_ipv6_src: 122, ct_ipv6_dst: 123, ct_tp_src: 124, ct_tp_dst: 125 ] defp enum_of(:openflow_basic), do: [ in_port: 0, in_phy_port: 1, metadata: 2, eth_dst: 3, eth_src: 4, eth_type: 5, vlan_vid: 6, vlan_pcp: 7, ip_dscp: 8, ip_ecn: 9, ip_proto: 10, ipv4_src: 11, ipv4_dst: 12, tcp_src: 13, tcp_dst: 14, udp_src: 15, udp_dst: 16, sctp_src: 17, sctp_dst: 18, icmpv4_type: 19, icmpv4_code: 20, arp_op: 21, arp_spa: 22, arp_tpa: 23, arp_sha: 24, arp_tha: 25, ipv6_src: 26, ipv6_dst: 27, ipv6_flabel: 28, icmpv6_type: 29, icmpv6_code: 30, ipv6_nd_target: 31, ipv6_nd_sll: 32, ipv6_nd_tll: 33, mpls_label: 34, mpls_tc: 35, mpls_bos: 36, pbb_isid: 37, tunnel_id: 38, ipv6_exthdr: 39, pbb_uca: 41, packet_type: 44 ] defp enum_of(:vlan_id), do: [vid_present: 4096, vid_none: 0] defp enum_of(:ipv6exthdr_flags), do: [ nonext: 1, esp: 2, auth: 4, dest: 8, frag: 16, router: 32, hop: 64, unrep: 128, unseq: 256 ] defp enum_of(:tcp_flags), do: [fin: 1, syn: 2, rst: 4, psh: 8, ack: 16, urg: 32, ece: 64, cwr: 128, ns: 256] defp enum_of(:tun_gbp_flags), do: [policy_applied: 8, dont_learn: 64] defp enum_of(:ct_state_flags), do: [new: 1, est: 2, rel: 4, rep: 8, inv: 16, trk: 32, snat: 64, dnat: 128] defp enum_of(:packet_register), do: [xreg0: 0, xreg1: 1, xreg2: 2, xreg3: 3, xreg4: 4, xreg5: 5, xreg6: 6, xreg7: 7] defp enum_of(:nxoxm_nsh_match), do: [ nsh_flags: 1, nsh_mdtype: 2, nsh_np: 3, nsh_spi: 4, nsh_si: 5, nsh_c1: 6, nsh_c2: 7, nsh_c3: 8, nsh_c4: 9, nsh_ttl: 10 ] defp enum_of(:onf_ext_match), do: [onf_tcp_flags: 42, onf_actset_output: 43, onf_pbb_uca: 2560] defp enum_of(:nxoxm_match), do: [ nxoxm_dp_hash: 0, tun_erspan_idx: 11, tun_erspan_ver: 12, tun_erspan_dir: 13, tun_erspan_hwid: 14 ] defp enum_of(:buffer_id), do: [no_buffer: 4_294_967_295] defp enum_of(:port_config), do: [port_down: 1, no_receive: 4, no_forward: 32, no_packet_in: 64] defp enum_of(:port_state), do: [link_down: 1, blocked: 2, live: 4] defp enum_of(:port_features), do: [ "10mb_hd": 1, "10mb_fd": 2, "100mb_hd": 4, "100mb_fd": 8, "1gb_hd": 16, "1gb_fd": 32, "10gb_fd": 64, "40gb_fd": 128, "100gb_fd": 256, "1tb_fd": 512, other: 1024, copper: 2048, fiber: 4096, autoneg: 8192, pause: 16384, pause_asym: 32768 ] defp enum_of(:openflow10_port_no), do: [ max: 65280, in_port: 65528, table: 65529, normal: 65530, flood: 65531, all: 65532, controller: 65533, local: 65534, none: 65535 ] defp enum_of(:openflow13_port_no), do: [ max: 4_294_967_040, in_port: 4_294_967_288, table: 4_294_967_289, normal: 4_294_967_290, flood: 4_294_967_291, all: 4_294_967_292, controller: 4_294_967_293, local: 4_294_967_294, any: 4_294_967_295 ] defp enum_of(:packet_in_reason), do: [no_match: 0, action: 1, invalid_ttl: 2, action_set: 3, group: 4, packet_out: 5] defp enum_of(:packet_in_reason_mask), do: [ no_match: 1, action: 2, invalid_ttl: 4, action_set: 8, group: 16, packet_out: 32 ] defp enum_of(:flow_mod_command), do: [add: 0, modify: 1, modify_strict: 2, delete: 3, delete_strict: 4] defp enum_of(:flow_mod_flags), do: [ send_flow_rem: 1, check_overlap: 2, reset_counts: 4, no_packet_counts: 8, no_byte_counts: 16 ] defp enum_of(:flow_removed_reason), do: [ idle_timeout: 0, hard_timeout: 1, delete: 2, group_delete: 3, meter_delete: 4, eviction: 5 ] defp enum_of(:flow_removed_reason_mask), do: [ idle_timeout: 1, hard_timeout: 2, delete: 4, group_delete: 8, meter_delete: 16, eviction: 32 ] defp enum_of(:port_reason), do: [add: 0, delete: 1, modify: 2] defp enum_of(:port_reason_mask), do: [add: 1, delete: 2, modify: 4] defp enum_of(:group_mod_command), do: [add: 0, modify: 1, delete: 2] defp enum_of(:group_type), do: [all: 0, select: 1, indirect: 2, fast_failover: 3] defp enum_of(:group_type_flags), do: [all: 1, select: 2, indirect: 4, fast_failover: 8] defp enum_of(:group_id), do: [max: 4_294_967_040, all: 4_294_967_292, any: 4_294_967_295] defp enum_of(:group_capabilities), do: [select_weight: 1, select_liveness: 2, chaining: 4, chaining_checks: 8] defp enum_of(:table_id), do: [max: 254, all: 255] defp enum_of(:queue_id), do: [all: 4_294_967_295] defp enum_of(:meter_mod_command), do: [add: 0, modify: 1, delete: 2] defp enum_of(:meter_id), do: [ max: 4_294_901_760, slowpath: 4_294_967_293, controller: 4_294_967_294, all: 4_294_967_295 ] defp enum_of(:meter_flags), do: [kbps: 1, pktps: 2, burst: 4, stats: 8] defp enum_of(:meter_band_type), do: [ {Openflow.MeterBand.Drop, 1}, {Openflow.MeterBand.Remark, 2}, {Openflow.MeterBand.Experimenter, 65535} ] defp enum_of(:table_config), do: [ table_miss_controller: 0, table_miss_continue: 1, table_miss_drop: 2, table_miss_mask: 3, eviction: 4, vacancy_events: 8 ] defp enum_of(:action_type), do: [ {Openflow.Action.Output, 0}, {Openflow.Action.CopyTtlOut, 11}, {Openflow.Action.CopyTtlIn, 12}, {Openflow.Action.SetMplsTtl, 15}, {Openflow.Action.DecMplsTtl, 16}, {Openflow.Action.PushVlan, 17}, {Openflow.Action.PopVlan, 18}, {Openflow.Action.PushMpls, 19}, {Openflow.Action.PopMpls, 20}, {Openflow.Action.SetQueue, 21}, {Openflow.Action.Group, 22}, {Openflow.Action.SetNwTtl, 23}, {Openflow.Action.DecNwTtl, 24}, {Openflow.Action.SetField, 25}, {Openflow.Action.PushPbb, 26}, {Openflow.Action.PopPbb, 27}, {Openflow.Action.Encap, 28}, {Openflow.Action.Decap, 29}, {Openflow.Action.SetSequence, 30}, {Openflow.Action.ValidateSequence, 31}, {Openflow.Action.Experimenter, 65535} ] defp enum_of(:action_flags), do: [ {Openflow.Action.Output, 1}, {Openflow.Action.CopyTtlOut, 2048}, {Openflow.Action.CopyTtlIn, 4096}, {Openflow.Action.SetMplsTtl, 32768}, {Openflow.Action.DecMplsTtl, 65536}, {Openflow.Action.PushVlan, 131_072}, {Openflow.Action.PopVlan, 262_144}, {Openflow.Action.PushMpls, 524_288}, {Openflow.Action.PopMpls, 1_048_576}, {Openflow.Action.SetQueue, 2_097_152}, {Openflow.Action.Group, 4_194_304}, {Openflow.Action.SetNwTtl, 8_388_608}, {Openflow.Action.DecNwTtl, 16_777_216}, {Openflow.Action.SetField, 33_554_432}, {Openflow.Action.PushPbb, 67_108_864}, {Openflow.Action.PopPbb, 134_217_728}, {Openflow.Action.Encap, 268_435_456}, {Openflow.Action.Decap, 536_870_912}, {Openflow.Action.SetSequence, 1_073_741_824}, {Openflow.Action.ValidateSequence, 2_147_483_648}, {Openflow.Action.Experimenter, 65535} ] defp enum_of(:action_vendor), do: [nicira_ext_action: 8992, onf_ext_action: 1_330_529_792] defp enum_of(:onf_ext_action), do: [{Openflow.Action.OnfCopyField, 3200}] defp enum_of(:nicira_ext_action), do: [ {Openflow.Action.NxResubmit, 1}, {Openflow.Action.NxSetTunnel, 2}, {Openflow.Action.NxRegMove, 6}, {Openflow.Action.NxRegLoad, 7}, {Openflow.Action.NxNote, 8}, {Openflow.Action.NxSetTunnel64, 9}, {Openflow.Action.NxMultipath, 10}, {Openflow.Action.NxBundle, 12}, {Openflow.Action.NxBundleLoad, 13}, {Openflow.Action.NxResubmitTable, 14}, {Openflow.Action.NxOutputReg, 15}, {Openflow.Action.NxLearn, 16}, {Openflow.Action.NxExit, 17}, {Openflow.Action.NxDecTtl, 18}, {Openflow.Action.NxFinTimeout, 19}, {Openflow.Action.NxController, 20}, {Openflow.Action.NxDecTtlCntIds, 21}, {Openflow.Action.NxWriteMetadata, 22}, {Openflow.Action.NxStackPush, 27}, {Openflow.Action.NxStackPop, 28}, {Openflow.Action.NxSample, 29}, {Openflow.Action.NxOutputReg2, 32}, {Openflow.Action.NxRegLoad2, 33}, {Openflow.Action.NxConjunction, 34}, {Openflow.Action.NxConntrack, 35}, {Openflow.Action.NxNat, 36}, {Openflow.Action.NxController2, 37}, {Openflow.Action.NxSample2, 38}, {Openflow.Action.NxOutputTrunc, 39}, {Openflow.Action.NxGroup, 40}, {Openflow.Action.NxSample3, 41}, {Openflow.Action.NxClone, 42}, {Openflow.Action.NxCtClear, 43}, {Openflow.Action.NxResubmitTableCt, 44}, {Openflow.Action.NxLearn2, 45}, {Openflow.Action.NxEncap, 46}, {Openflow.Action.NxDecap, 47}, {Openflow.Action.NxCheckPktLarger, 49}, {Openflow.Action.NxDebugRecirc, 255} ] defp enum_of(:nx_mp_algorithm), do: [modulo_n: 0, hash_threshold: 1, highest_random_weight: 2, iterative_hash: 3] defp enum_of(:nx_hash_fields), do: [ eth_src: 0, symmetric_l4: 1, symmetric_l3l4: 2, symmetric_l3l4_udp: 3, nw_src: 4, nw_dst: 5 ] defp enum_of(:nx_bd_algorithm), do: [active_backup: 0, highest_random_weight: 1] defp enum_of(:nx_learn_flag), do: [send_flow_rem: 1, delete_learned: 2, write_result: 4] defp enum_of(:nx_conntrack_flags), do: [commit: 1, force: 2] defp enum_of(:nx_nat_flags), do: [src: 1, dst: 2, persistent: 4, protocol_hash: 8, protocol_random: 16] defp enum_of(:nx_nat_range), do: [ ipv4_min: 1, ipv4_max: 2, ipv6_min: 4, ipv6_max: 8, proto_min: 16, proto_max: 32 ] defp enum_of(:nx_action_controller2_prop_type), do: [max_len: 0, controller_id: 1, reason: 2, userdata: 3, pause: 4] defp enum_of(:nx_action_sample_direction), do: [default: 0, ingress: 1, egress: 2] defp enum_of(:nx_flow_spec_type), do: [ {Openflow.Action.NxFlowSpecMatch, 0}, {Openflow.Action.NxFlowSpecLoad, 1}, {Openflow.Action.NxFlowSpecOutput, 2} ] defp enum_of(:instruction_type), do: [ {Openflow.Instruction.GotoTable, 1}, {Openflow.Instruction.WriteMetadata, 2}, {Openflow.Instruction.WriteActions, 3}, {Openflow.Instruction.ApplyActions, 4}, {Openflow.Instruction.ClearActions, 5}, {Openflow.Instruction.Meter, 6}, {Openflow.Instruction.Experimenter, 65535} ] defp enum_of(:controller_role), do: [nochange: 0, equal: 1, master: 2, slave: 3] defp enum_of(:nx_role), do: [other: 0, master: 1, slave: 2] defp enum_of(:packet_in_format), do: [standard: 0, nxt_packet_in: 1, nxt_packet_in2: 2] defp enum_of(:flow_format), do: [openflow10: 0, nxm: 1] defp enum_of(:packet_in2_prop_type), do: [ packet: 0, full_len: 1, buffer_id: 2, table_id: 3, cookie: 4, reason: 5, metadata: 6, userdata: 7, continuation: 8 ] defp enum_of(:continuation_prop_type), do: [ bridge: 32768, stack: 32769, mirrors: 32770, conntracked: 32771, table_id: 32772, cookie: 32773, actions: 32774, action_set: 32775 ] defp enum_of(:flow_monitor_flag), do: [initial: 1, add: 2, delete: 4, modify: 8, actions: 16, own: 32] defp enum_of(:flow_update_event), do: [added: 0, deleted: 1, modified: 2, abbrev: 3] defp enum_of(:tlv_table_mod_command), do: [add: 0, delete: 1, clear: 2] defp enum_of(:table_feature_prop_type), do: [ instructions: 0, instructions_miss: 1, next_tables: 2, next_tables_miss: 3, write_actions: 4, write_actions_miss: 5, apply_actions: 6, apply_actions_miss: 7, match: 8, wildcards: 10, write_setfield: 12, write_setfield_miss: 13, apply_setfield: 14, apply_setfield_miss: 15, experimenter: 65534, experimenter_miss: 65535 ] defp enum_of(:bundle_ctrl_type), do: [ open_request: 0, open_reply: 1, close_request: 2, close_reply: 3, commit_request: 4, commit_reply: 5, discard_request: 6, discard_reply: 7 ] defp enum_of(:bundle_flags), do: [atomic: 1, ordered: 2] end
26.106149
97
0.725953
79135cee8af8547ee2340a198804a1500c81701d
2,503
ex
Elixir
discussapp/web/router.ex
eduardorasgado/ElixirWarlock
1658ab2ffb2870cb81c8a434755d98678572838c
[ "MIT" ]
null
null
null
discussapp/web/router.ex
eduardorasgado/ElixirWarlock
1658ab2ffb2870cb81c8a434755d98678572838c
[ "MIT" ]
1
2021-03-10T05:09:49.000Z
2021-03-10T05:09:49.000Z
discussapp/web/router.ex
eduardorasgado/ElixirWarlock
1658ab2ffb2870cb81c8a434755d98678572838c
[ "MIT" ]
null
null
null
defmodule Discussapp.Router do @moduledoc """ The project was created by typing: $mix phoenix.new Discussapp Guide to all the conventions to route with phoenix: user_path GET /users HelloWeb.UserController :index user_path GET /users/:id/edit HelloWeb.UserController :edit user_path GET /users/new HelloWeb.UserController :new user_path GET /users/:id HelloWeb.UserController :show user_path POST /users HelloWeb.UserController :create user_path PATCH /users/:id HelloWeb.UserController :update PUT /users/:id HelloWeb.UserController :update user_path DELETE /users/:id HelloWeb.UserController :delete """ use Discussapp.Web, :router # a pipeline that defines a controller to do some amount of pre proccesings # before handle a request pipeline :browser do # a plug is a function that makes a tiny transformation to our connection object # every connection we do and controllers do is a plug plug :accepts, ["html"] plug :fetch_session plug :fetch_flash plug :protect_from_forgery plug :put_secure_browser_headers plug Discussapp.Plugs.SetUser end pipeline :api do plug :accepts, ["json"] end # a scope keyword is for namespacing urls in phoenix scope "/", Discussapp do pipe_through :browser # Use the default browser stack get "/", TopicController, :index # # method, action addess, controller, function in controller(convention) # get "/topics/new", TopicController, :new # post "/topics", TopicController, :create # # this is called router wildcard: :id # get "/topics/:id/edit", TopicController, :edit # put "/topics/:id", TopicController, :update # this will work if only we follow a restful convention # when resouce helper is been used, wild card will be :id by default resources "/topics", TopicController end # urls related to user authentication scope "/auth",Discussapp do pipe_through :browser # ueber auth will provide a provider strategy by loooking at request from user get "/:provider", AuthController, :request get "/:provider/callback", AuthController, :callback # accordingly to restful convention this should be a delete method # since we are deleting a session delete "/signout", AuthController, :signout end # Other scopes may use custom stacks. # scope "/api", Discussapp do # pipe_through :api # end end
35.757143
84
0.697962
791381441dbefbf1501bd54297af436db7265cf1
600
exs
Elixir
priv/repo/migrations/20201222072604_create_messages.exs
arjit95/elixir-chat
e4db9d37713edb8398017c8629b8064541c5a110
[ "MIT" ]
null
null
null
priv/repo/migrations/20201222072604_create_messages.exs
arjit95/elixir-chat
e4db9d37713edb8398017c8629b8064541c5a110
[ "MIT" ]
null
null
null
priv/repo/migrations/20201222072604_create_messages.exs
arjit95/elixir-chat
e4db9d37713edb8398017c8629b8064541c5a110
[ "MIT" ]
null
null
null
defmodule Chat.Repo.Migrations.CreateMessages do use Ecto.Migration def change do create table(:messages, primary_key: false) do add :sender_id, references(:users, type: :string, null: false, column: :username, on_delete: :delete_all), primary_key: true add :receipient_id, references(:users, type: :string, null: false, column: :username, on_delete: :delete_all), primary_key: true add :message, :text add :inserted_at, :utc_datetime_usec, primary_key: true add :updated_at, :utc_datetime_usec end create index(:messages, [:receipient_id]) end end
35.294118
134
0.716667
7913d6999970ae896ace5be749fdb5315e696a74
1,285
exs
Elixir
elixir-match/app/test/match/logon_test.exs
jim80net/elixir_tutorial_projects
db19901a9305b297faa90642bebcc08455621b52
[ "Unlicense" ]
null
null
null
elixir-match/app/test/match/logon_test.exs
jim80net/elixir_tutorial_projects
db19901a9305b297faa90642bebcc08455621b52
[ "Unlicense" ]
null
null
null
elixir-match/app/test/match/logon_test.exs
jim80net/elixir_tutorial_projects
db19901a9305b297faa90642bebcc08455621b52
[ "Unlicense" ]
null
null
null
defmodule Match.LogonTest do use Match.DataCase, async: false alias Match.Logon @invite "elixir2019" @user_one "A4E3400CF711E76BBD86C57CA" @user_two "EBDA4E3FDECD8F2759D96250A" test "get and put work" do {:ok, _} = GenServer.start_link(Logon, :ok) {:ok, result} = Logon.put(:logon, "toran", "abcd1234", @invite) {id, username, _icon} = result assert id == @user_one assert username == "toran" {username, _icon} = Logon.get(:logon, @user_one) assert username === "toran" assert Logon.get_by_username_and_password(:logon, "toran", "abcd1234") === @user_one assert Logon.get_by_username_and_password(:logon, "joel", "defg4567") === nil {:ok, result} = Logon.put(:logon, "joel", "defg4567", @invite) {id, username, _icon} = result assert id == @user_two assert username == "joel" {username, _icon} = Logon.get(:logon, @user_one) assert username === "toran" {username, _icon} = Logon.get(:logon, @user_two) assert username === "joel" assert Logon.get_by_username_and_password(:logon, "toran", "abcd1234") === @user_one assert Logon.get_by_username_and_password(:logon, "joel", "defg4567") === @user_two assert Logon.get_by_username_and_password(:logon, "joel", "def4577") === nil end end
33.815789
88
0.670039
7913eb6d66a11e023689b3ca866888f1edfd21ba
1,129
exs
Elixir
test/membrane_element_audiometer/peakmeter_test.exs
membraneframework/membrane_audiometer_plugin
99709cee14228c9fba516fdc403931e752c23c0e
[ "Apache-2.0" ]
null
null
null
test/membrane_element_audiometer/peakmeter_test.exs
membraneframework/membrane_audiometer_plugin
99709cee14228c9fba516fdc403931e752c23c0e
[ "Apache-2.0" ]
1
2020-08-06T14:22:26.000Z
2020-08-06T14:22:26.000Z
test/membrane_element_audiometer/peakmeter_test.exs
membraneframework/membrane_audiometer_plugin
99709cee14228c9fba516fdc403931e752c23c0e
[ "Apache-2.0" ]
null
null
null
defmodule Membrane.Audiometer.PeakmeterTest do use ExUnit.Case, async: true import Membrane.Testing.Assertions alias Membrane.Caps.Audio.Raw alias Membrane.Testing @module Membrane.Audiometer.Peakmeter test "integration" do data = [1, 2, 3, 2, 1] |> Enum.map(&<<&1>>) {:ok, pipeline} = %Testing.Pipeline.Options{ elements: [ source: %Testing.Source{ output: data, caps: %Raw{channels: 1, sample_rate: 44100, format: :s16le} }, peakmeter: @module, sink: Testing.Sink ] } |> Testing.Pipeline.start_link() Testing.Pipeline.play(pipeline) assert_pipeline_playback_changed(pipeline, _prev_state, :playing) assert_pipeline_notified(pipeline, :peakmeter, {:audiometer, :underrun}) Enum.each(data, fn payload -> assert_sink_buffer(pipeline, :sink, %Membrane.Buffer{payload: received_payload}) assert payload == received_payload end) Testing.Pipeline.stop_and_terminate(pipeline, blocking?: true) assert_pipeline_playback_changed(pipeline, _prev_state, :stopped) end end
28.948718
86
0.668733
7913ffb46b8809130a6b5d7173c4cfe475910878
1,282
ex
Elixir
lib/changelog_web/controllers/post_controller.ex
PsOverflow/changelog.com
53f4ecfc39b021c6b8cfcc0fa11f29aff8038a7f
[ "MIT" ]
1
2021-03-14T21:12:49.000Z
2021-03-14T21:12:49.000Z
lib/changelog_web/controllers/post_controller.ex
PsOverflow/changelog.com
53f4ecfc39b021c6b8cfcc0fa11f29aff8038a7f
[ "MIT" ]
null
null
null
lib/changelog_web/controllers/post_controller.ex
PsOverflow/changelog.com
53f4ecfc39b021c6b8cfcc0fa11f29aff8038a7f
[ "MIT" ]
1
2018-10-03T20:55:52.000Z
2018-10-03T20:55:52.000Z
defmodule ChangelogWeb.PostController do use ChangelogWeb, :controller alias Changelog.{Post, NewsItem, NewsItemComment} def index(conn, params) do page = NewsItem.published() |> NewsItem.with_object_prefix("post") |> NewsItem.newest_first() |> NewsItem.preload_all() |> Repo.paginate(Map.put(params, :page_size, 15)) items = Enum.map(page.entries, &NewsItem.load_object/1) conn |> assign(:page, page) |> assign(:items, items) |> render(:index) end def show(conn, %{"id" => slug}) do post = Post.published |> Post.preload_all() |> Repo.get_by!(slug: slug) |> Post.load_news_item() item = post.news_item |> NewsItem.preload_all() |> NewsItem.preload_comments() conn = if item do conn |> assign(:comments, NewsItemComment.nested(item.comments)) |> assign(:changeset, item |> build_assoc(:comments) |> NewsItemComment.insert_changeset()) else conn end conn |> assign(:post, post) |> assign(:item, item) |> render(:show) end def preview(conn, %{"id" => id}) do post = Repo.get!(Post, id) |> Post.preload_all() conn |> assign(:post, post) |> assign(:item, nil) |> render(:show) end end
22.892857
97
0.602964
7914460db8781777641025ff5c4c079ea6e9bc63
997
ex
Elixir
lib/events_tools/accounts/authorization.ex
Apps-Team/conferencetools
ce2e16a3e4a521dc4682e736a209e6dd380c050d
[ "Apache-2.0" ]
null
null
null
lib/events_tools/accounts/authorization.ex
Apps-Team/conferencetools
ce2e16a3e4a521dc4682e736a209e6dd380c050d
[ "Apache-2.0" ]
6
2017-10-05T20:16:34.000Z
2017-10-05T20:36:11.000Z
lib/events_tools/accounts/authorization.ex
apps-team/events-tools
ce2e16a3e4a521dc4682e736a209e6dd380c050d
[ "Apache-2.0" ]
null
null
null
defmodule EventsTools.Accounts.Authorization do use Ecto.Schema import Ecto.Changeset alias EventsTools.Accounts.Authorization schema "authorizations" do field :provider, :string field :uid, :string field :token, :string field :refresh_token, :string field :expires_at, :integer field :password, :string, virtual: true field :password_confirmation, :string, virtual: true belongs_to :user, EventsTools.Accounts.User timestamps() end @required_fields ~w(provider uid user_id token)a @optional_fields ~w(refresh_token expires_at)a @doc """ Creates a changeset based on the `model` and `params`. If no params are provided, an invalid changeset is returned with no validation performed. """ def changeset(model, params \\ :empty) do model |> cast(params, @required_fields ++ @optional_fields) |> validate_required(@required_fields) #|> foreign_key_constraint(:user_id) |> unique_constraint(:provider_uid) end end
28.485714
61
0.72317
79146cc9719bee3b2de6b70d6c3593d0fabd89e7
2,106
ex
Elixir
clients/dfa_reporting/lib/google_api/dfa_reporting/v35/model/placement_strategies_list_response.ex
renovate-bot/elixir-google-api
1da34cd39b670c99f067011e05ab90af93fef1f6
[ "Apache-2.0" ]
1
2021-12-20T03:40:53.000Z
2021-12-20T03:40:53.000Z
clients/dfa_reporting/lib/google_api/dfa_reporting/v35/model/placement_strategies_list_response.ex
swansoffiee/elixir-google-api
9ea6d39f273fb430634788c258b3189d3613dde0
[ "Apache-2.0" ]
1
2020-08-18T00:11:23.000Z
2020-08-18T00:44:16.000Z
clients/dfa_reporting/lib/google_api/dfa_reporting/v35/model/placement_strategies_list_response.ex
dazuma/elixir-google-api
6a9897168008efe07a6081d2326735fe332e522c
[ "Apache-2.0" ]
null
null
null
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This file is auto generated by the elixir code generator program. # Do not edit this file manually. defmodule GoogleApi.DFAReporting.V35.Model.PlacementStrategiesListResponse do @moduledoc """ Placement Strategy List Response ## Attributes * `kind` (*type:* `String.t`, *default:* `nil`) - Identifies what kind of resource this is. Value: the fixed string "dfareporting#placementStrategiesListResponse". * `nextPageToken` (*type:* `String.t`, *default:* `nil`) - Pagination token to be used for the next list operation. * `placementStrategies` (*type:* `list(GoogleApi.DFAReporting.V35.Model.PlacementStrategy.t)`, *default:* `nil`) - Placement strategy collection. """ use GoogleApi.Gax.ModelBase @type t :: %__MODULE__{ :kind => String.t() | nil, :nextPageToken => String.t() | nil, :placementStrategies => list(GoogleApi.DFAReporting.V35.Model.PlacementStrategy.t()) | nil } field(:kind) field(:nextPageToken) field(:placementStrategies, as: GoogleApi.DFAReporting.V35.Model.PlacementStrategy, type: :list) end defimpl Poison.Decoder, for: GoogleApi.DFAReporting.V35.Model.PlacementStrategiesListResponse do def decode(value, options) do GoogleApi.DFAReporting.V35.Model.PlacementStrategiesListResponse.decode(value, options) end end defimpl Poison.Encoder, for: GoogleApi.DFAReporting.V35.Model.PlacementStrategiesListResponse do def encode(value, options) do GoogleApi.Gax.ModelBase.encode(value, options) end end
39
167
0.738841
791486dd9c8c6cddc844cdfe1b3eb853e0053dc3
162
exs
Elixir
test/ueberauth_eve_sso_test.exs
lukasni/ueberauth-eve-sso
d0ebf3e37317f0482df0258a02089d0559c8995a
[ "MIT" ]
null
null
null
test/ueberauth_eve_sso_test.exs
lukasni/ueberauth-eve-sso
d0ebf3e37317f0482df0258a02089d0559c8995a
[ "MIT" ]
null
null
null
test/ueberauth_eve_sso_test.exs
lukasni/ueberauth-eve-sso
d0ebf3e37317f0482df0258a02089d0559c8995a
[ "MIT" ]
null
null
null
defmodule UeberauthEVESSOTest do use ExUnit.Case doctest UeberauthEVESSO test "greets the world" do assert UeberauthEVESSO.hello() == :world end end
18
44
0.753086
791501e8c34746768c28a4db230d1a4d9637fe20
1,446
ex
Elixir
lib/mix/tasks/esbuild.ex
denvaar/esbuild
e2d01c87ecd60d02ab8151dcbd51a24a13495f21
[ "MIT" ]
227
2021-07-16T21:14:01.000Z
2022-03-29T20:03:10.000Z
lib/mix/tasks/esbuild.ex
denvaar/esbuild
e2d01c87ecd60d02ab8151dcbd51a24a13495f21
[ "MIT" ]
45
2021-07-17T07:17:53.000Z
2022-03-30T15:40:43.000Z
deps/esbuild/lib/mix/tasks/esbuild.ex
adrianomota/blog
ef3b2d2ed54f038368ead8234d76c18983caa75b
[ "MIT" ]
36
2021-07-17T02:22:38.000Z
2022-03-30T02:36:57.000Z
defmodule Mix.Tasks.Esbuild do @moduledoc """ Invokes esbuild with the given args. Usage: $ mix esbuild TASK_OPTIONS PROFILE ESBUILD_ARGS Example: $ mix esbuild default assets/js/app.js --bundle --minify --target=es2016 --outdir=priv/static/assets If esbuild is not installed, it is automatically downloaded. Note the arguments given to this task will be appended to any configured arguments. ## Options * `--runtime-config` - load the runtime configuration before executing command Note flags to control this Mix task must be given before the profile: $ mix esbuild --runtime-config default assets/js/app.js """ @shortdoc "Invokes esbuild with the profile and args" use Mix.Task @impl true def run(args) do switches = [runtime_config: :boolean] {opts, remaining_args} = OptionParser.parse_head!(args, switches: switches) if opts[:runtime_config] do Mix.Task.run("app.config") else Application.ensure_all_started(:esbuild) end Mix.Task.reenable("esbuild") install_and_run(remaining_args) end defp install_and_run([profile | args] = all) do case Esbuild.install_and_run(String.to_atom(profile), args) do 0 -> :ok status -> Mix.raise("`mix esbuild #{Enum.join(all, " ")}` exited with #{status}") end end defp install_and_run([]) do Mix.raise("`mix esbuild` expects the profile as argument") end end
24.508475
106
0.691563
791503ea741f7e282d0b6d80c5f2dcb8649d6546
7,717
ex
Elixir
lib/oban/config.ex
qdentity/oban
d511f5ffd2f3b979afd6af94bc802949654ea410
[ "Apache-2.0" ]
null
null
null
lib/oban/config.ex
qdentity/oban
d511f5ffd2f3b979afd6af94bc802949654ea410
[ "Apache-2.0" ]
26
2021-07-24T21:32:21.000Z
2022-03-23T11:55:24.000Z
lib/oban/config.ex
qdentity/oban
d511f5ffd2f3b979afd6af94bc802949654ea410
[ "Apache-2.0" ]
null
null
null
defmodule Oban.Config do @moduledoc """ The Config struct validates and encapsulates Oban instance state. Options passed to `Oban.start_link/1` are validated and stored in a config struct. Internal modules and plugins are always passed the config with a `:conf` key. """ @type t :: %__MODULE__{ circuit_backoff: timeout(), dispatch_cooldown: pos_integer(), engine: module(), notifier: module(), name: Oban.name(), node: binary(), plugins: [module() | {module() | Keyword.t()}], prefix: binary(), queues: [{atom(), Keyword.t()}], repo: module(), shutdown_grace_period: timeout(), log: false | Logger.level(), get_dynamic_repo: nil | (() -> pid() | atom()) } @type option :: {:name, module()} | {:conf, t()} @enforce_keys [:node, :repo] defstruct circuit_backoff: :timer.seconds(30), dispatch_cooldown: 5, engine: Oban.Queue.BasicEngine, notifier: Oban.PostgresNotifier, name: Oban, node: nil, plugins: [], prefix: "public", queues: [], repo: nil, shutdown_grace_period: :timer.seconds(15), log: false, get_dynamic_repo: nil defguardp is_pos_integer(interval) when is_integer(interval) and interval > 0 @doc false @spec new(Keyword.t()) :: t() def new(opts) when is_list(opts) do opts = opts |> crontab_to_plugin() |> poll_interval_to_plugin() |> Keyword.put_new(:node, node_name()) |> Keyword.update(:plugins, [], &(&1 || [])) |> Keyword.update(:queues, [], &(&1 || [])) Enum.each(opts, &validate_opt!/1) opts = opts |> Keyword.update!(:queues, &parse_queues/1) |> Keyword.update!(:plugins, &normalize_plugins/1) struct!(__MODULE__, opts) end @doc false @spec node_name(%{optional(binary()) => binary()}) :: binary() def node_name(env \\ System.get_env()) do cond do Node.alive?() -> to_string(node()) Map.has_key?(env, "DYNO") -> Map.get(env, "DYNO") true -> :inet.gethostname() |> elem(1) |> to_string() end end @doc false @spec to_ident(t()) :: binary() def to_ident(%__MODULE__{name: name, node: node}) do inspect(name) <> "." <> to_string(node) end @doc false @spec match_ident?(t(), binary()) :: boolean() def match_ident?(%__MODULE__{} = conf, ident) when is_binary(ident) do to_ident(conf) == ident end # Helpers @cron_keys [:crontab, :timezone] defp crontab_to_plugin(opts) do case {opts[:plugins], opts[:crontab]} do {plugins, [_ | _]} when is_list(plugins) or is_nil(plugins) -> {cron_opts, base_opts} = Keyword.split(opts, @cron_keys) plugin = {Oban.Plugins.Cron, cron_opts} Keyword.update(base_opts, :plugins, [plugin], &[plugin | &1]) _ -> Keyword.drop(opts, @cron_keys) end end defp poll_interval_to_plugin(opts) do case {opts[:plugins], opts[:poll_interval]} do {plugins, interval} when (is_list(plugins) or is_nil(plugins)) and is_integer(interval) -> plugin = {Oban.Plugins.Stager, interval: interval} opts |> Keyword.delete(:poll_interval) |> Keyword.update(:plugins, [plugin], &[plugin | &1]) {plugins, nil} when is_list(plugins) or is_nil(plugins) -> plugin = Oban.Plugins.Stager Keyword.update(opts, :plugins, [plugin], &[plugin | &1]) _ -> Keyword.drop(opts, [:poll_interval]) end end defp validate_opt!({:circuit_backoff, backoff}) do unless is_pos_integer(backoff) do raise ArgumentError, "expected :circuit_backoff to be a positive integer, got: #{inspect(backoff)}" end end defp validate_opt!({:dispatch_cooldown, cooldown}) do unless is_pos_integer(cooldown) do raise ArgumentError, "expected :dispatch_cooldown to be a positive integer, got: #{inspect(cooldown)}" end end defp validate_opt!({:engine, engine}) do unless Code.ensure_loaded?(engine) and function_exported?(engine, :init, 2) do raise ArgumentError, "expected :engine to be an Oban.Queue.Engine, got: #{inspect(engine)}" end end defp validate_opt!({:notifier, notifier}) do unless Code.ensure_loaded?(notifier) and function_exported?(notifier, :listen, 2) do raise ArgumentError, "expected :notifier to be an Oban.Notifier, got: #{inspect(notifier)}" end end defp validate_opt!({:name, _}), do: :ok defp validate_opt!({:node, node}) do unless is_binary(node) and String.trim(node) != "" do raise ArgumentError, "expected :node to be a non-empty binary, got: #{inspect(node)}" end end defp validate_opt!({:plugins, plugins}) do unless is_list(plugins) and Enum.all?(plugins, &valid_plugin?/1) do raise ArgumentError, "expected :plugins to be a list of modules or {module, keyword} tuples " <> ", got: #{inspect(plugins)}" end end defp validate_opt!({:prefix, prefix}) do unless is_binary(prefix) and Regex.match?(~r/^[a-z0-9_]+$/i, prefix) do raise ArgumentError, "expected :prefix to be a binary with alphanumeric characters, got: #{inspect(prefix)}" end end defp validate_opt!({:queues, queues}) do unless Keyword.keyword?(queues) and Enum.all?(queues, &valid_queue?/1) do raise ArgumentError, "expected :queues to be a keyword list of {atom, integer} pairs or " <> "a list of {atom, keyword} pairs, got: #{inspect(queues)}" end end defp validate_opt!({:repo, repo}) do unless Code.ensure_loaded?(repo) and function_exported?(repo, :__adapter__, 0) do raise ArgumentError, "expected :repo to be an Ecto.Repo, got: #{inspect(repo)}" end end defp validate_opt!({:shutdown_grace_period, period}) do unless is_pos_integer(period) do raise ArgumentError, "expected :shutdown_grace_period to be a positive integer, got: #{inspect(period)}" end end @log_levels ~w(false emergency alert critical error warning warn notice info debug)a defp validate_opt!({:log, log}) do unless log in @log_levels do raise ArgumentError, "expected :log to be one of #{inspect(@log_levels)}, got: #{inspect(log)}" end end defp validate_opt!({:get_dynamic_repo, fun}) do unless is_nil(fun) or is_function(fun, 0) do raise ArgumentError, "expected :get_dynamic_repo to be nil or a zero arity function, got: #{inspect(fun)}" end end defp validate_opt!(option) do raise ArgumentError, "unknown option provided #{inspect(option)}" end defp valid_queue?({_name, opts}) do is_pos_integer(opts) or Keyword.keyword?(opts) end defp valid_plugin?({plugin, opts}) do is_atom(plugin) and Code.ensure_loaded?(plugin) and function_exported?(plugin, :init, 1) and Keyword.keyword?(opts) end defp valid_plugin?(plugin), do: valid_plugin?({plugin, []}) defp parse_queues(queues) do for {name, value} <- queues do opts = if is_integer(value), do: [limit: value], else: value {name, opts} end end # Manually specified plugins will be overwritten by auto-specified plugins unless we reverse the # plugin list. The order doesn't matter as they are supervised one-for-one. defp normalize_plugins(plugins) do plugins |> Enum.reverse() |> Enum.uniq_by(fn {module, _opts} -> module module -> module end) end end
30.027237
99
0.621226
79150694c38b7f025ba0b200782655870051137c
1,172
exs
Elixir
test/document_test.exs
FreedomBen/obelisk
f8f5ca8d73f619f26213c3b2442127c25dec45a2
[ "MIT" ]
406
2015-01-01T14:59:37.000Z
2022-02-19T08:08:47.000Z
test/document_test.exs
FreedomBen/obelisk
f8f5ca8d73f619f26213c3b2442127c25dec45a2
[ "MIT" ]
38
2015-01-19T11:58:30.000Z
2019-01-18T14:06:24.000Z
test/document_test.exs
FreedomBen/obelisk
f8f5ca8d73f619f26213c3b2442127c25dec45a2
[ "MIT" ]
64
2015-01-19T09:59:55.000Z
2021-02-06T01:14:59.000Z
defmodule DocumentTest do use ExUnit.Case, async: false setup do TestHelper.cleanup on_exit fn -> TestHelper.cleanup end end test "Prepare document" do Obelisk.Tasks.Init.run [] Obelisk.Tasks.Build.run [] create_post(10) file = "./posts/#{filename(10)}.markdown" document = Obelisk.Document.prepare file, { Obelisk.Templates.post_template, :eex } assert document.frontmatter.title == "This is the heading" assert document.frontmatter.description == "This is the desc" end test "file name for post" do assert "post.html" == Obelisk.Document.file_name("path/to/post.markdown") end test "html filename with default config" do assert "./build/post.html" == Obelisk.Document.html_filename("path/to/post.markdown") end defp filename(day) do "2014-01-#{day}-post-with-day-#{day}" end defp create_post(day) do File.write("./posts/#{filename(day)}.markdown", content) end defp content do """ --- title: This is the heading description: This is the desc --- * And * A * List * Of * Things `and some inline code` for good measure """ end end
21.703704
89
0.653584
79150f4f49b85df13891d53288522ecdc34be718
2,176
exs
Elixir
test/driver/redix_driver_test.exs
sb8244/elixir_redis_bloomfilter
c3266127278131eae00fb6986acb424d1e4cf9d1
[ "MIT" ]
1
2017-09-06T05:15:47.000Z
2017-09-06T05:15:47.000Z
test/driver/redix_driver_test.exs
sb8244/elixir_redis_bloomfilter
c3266127278131eae00fb6986acb424d1e4cf9d1
[ "MIT" ]
null
null
null
test/driver/redix_driver_test.exs
sb8244/elixir_redis_bloomfilter
c3266127278131eae00fb6986acb424d1e4cf9d1
[ "MIT" ]
null
null
null
defmodule RedisBloomfilter.Driver.RedixDriverTest do use ExUnit.Case, async: false alias RedisBloomfilter.Driver.RedixDriver setup do {:ok, redix_pid} = Redix.start_link("redis://localhost:6379", name: :redix) {:ok, redix: redix_pid} end describe "load_lua_scripts" do test "the correct SHAs are returned from Redis" do assert RedixDriver.load_lua_scripts() == %{ add_sha: "972697f22fb62b3579210b2c73a0c1eff582b7c1", check_sha: "1b69ae9a31e23aa614977f5bfd16683628a15847", } end test "the SHAs are hardcoded correctly" do assert RedixDriver.load_lua_scripts() == %{ add_sha: RedisBloomfilter.Util.LuaScripts.add_script_sha, check_sha: RedisBloomfilter.Util.LuaScripts.check_script_sha, } end end describe "insert/2" do test "returns {:ok, key}" do assert RedixDriver.insert("key", %{key_name: "rbf-d-test", size: 100, precision: 0.01}) == {:ok, "key"} end end describe "include?/2" do test "returns false for a key not in the set" do assert RedixDriver.include?("never, nope", %{key_name: "rbf-d-test", size: 100, precision: 0.01}) == false end test "it returns false for a bunch of keys not in the set" do Enum.each(1..100, fn(i) -> assert RedixDriver.include?("never, nope #{i}", %{key_name: "rbf-d-test", size: 100, precision: 0.01}) == false end) end test "it returns true (hopefully) for a key in the set" do assert RedixDriver.insert("key", %{key_name: "rbf-d-test", size: 100, precision: 0.01}) == {:ok, "key"} assert RedixDriver.include?("key", %{key_name: "rbf-d-test", size: 100, precision: 0.01}) == true end end describe "clear/1" do test "the key is cleared out" do assert RedixDriver.insert("key", %{key_name: "rbf-d-test", size: 100, precision: 0.01}) == {:ok, "key"} assert RedixDriver.include?("key", %{key_name: "rbf-d-test", size: 100, precision: 0.01}) == true assert RedixDriver.clear(%{key_name: "rbf-d-test"}) == {:ok, 2} assert RedixDriver.include?("key", %{key_name: "rbf-d-test", size: 100, precision: 0.01}) == false end end end
36.881356
119
0.649357
791549451526c58a1f3e81a400c2c9f3d36454b6
59
exs
Elixir
config/config.exs
WhiteRookPL/production-debugging-workshop.ex
26e81d14ba39c33764ddaee5d6d65a6061f4e823
[ "MIT" ]
5
2017-05-03T08:05:54.000Z
2022-03-11T04:11:00.000Z
config/config.exs
WhiteRookPL/production-debugging-workshop.ex
26e81d14ba39c33764ddaee5d6d65a6061f4e823
[ "MIT" ]
null
null
null
config/config.exs
WhiteRookPL/production-debugging-workshop.ex
26e81d14ba39c33764ddaee5d6d65a6061f4e823
[ "MIT" ]
1
2016-05-08T18:40:31.000Z
2016-05-08T18:40:31.000Z
use Mix.Config import_config "../apps/*/config/config.exs"
19.666667
43
0.745763
79157143fe4199e0a41e2d10908e9d95b53eb28d
7,677
ex
Elixir
lib/mix/lib/mix/tasks/format.ex
namjae/elixir
6d1561a5939d68fb61f422b83271fbc824847395
[ "Apache-2.0" ]
1
2021-05-20T13:08:37.000Z
2021-05-20T13:08:37.000Z
lib/mix/lib/mix/tasks/format.ex
namjae/elixir
6d1561a5939d68fb61f422b83271fbc824847395
[ "Apache-2.0" ]
null
null
null
lib/mix/lib/mix/tasks/format.ex
namjae/elixir
6d1561a5939d68fb61f422b83271fbc824847395
[ "Apache-2.0" ]
null
null
null
defmodule Mix.Tasks.Format do use Mix.Task @shortdoc "Formats the given files/patterns" @moduledoc """ Formats the given files and patterns. mix format mix.exs "lib/**/*.{ex,exs}" "test/**/*.{ex,exs}" If any of the files is `-`, then the output is read from stdin and written to stdout. Formatting is done with the `Code.format_string!/2` function. A `.formatter.exs` file can also be defined for customizing input files and the formatter itself. ## Options * `--check-formatted` - check that the file is already formatted. This is useful in pre-commit hooks and CI scripts if you want to reject contributions with unformatted code. However, keep in mind, that the formatting output may differ between Elixir versions as improvements and fixes are applied to the formatter. * `--check-equivalent` - check if the file after formatting has the same AST. If the ASTs are not equivalent, it is a bug in the code formatter. This option is recommended if you are automatically formatting files. * `--dry-run` - do not save files after formatting. * `--dot-formatter` - the file with formatter configuration. Defaults to `.formatter.exs` if one is available, see next section. If any of the `--check-*` flags are given and a check fails, the formatted contents won't be written to disk nor printed to stdout. ## .formatter.exs The formatter will read a `.formatter.exs` in the current directory for formatter configuration. It should return a keyword list with any of the options supported by `Code.format_string!/2`. The `.formatter.exs` also supports an `:inputs` field which specifies the default inputs to be used by this task: [ inputs: ["mix.exs", "{config,lib,test}/**/*.{ex,exs}"] ] ## When to format code We recommend developers to format code directly in their editors. Either automatically on save or via an explicit command/key binding. If such option is not yet available in your editor of choice, adding the required integration is relatively simple as it is a matter of invoking cd $project && mix format $file where `$file` refers to the current file and `$project` is the root of your project. It is also possible to format code across the whole project by passing a list of patterns and files to `mix format`, as showed at the top of this task documentation. This list can also be set in the `.formatter.exs` under the `:inputs` key. """ @switches [ check_equivalent: :boolean, check_formatted: :boolean, dot_formatter: :string, dry_run: :boolean ] def run(args) do {opts, args} = OptionParser.parse!(args, strict: @switches) formatter_opts = eval_dot_formatter(opts) args |> expand_args(formatter_opts) |> Task.async_stream(&format_file(&1, opts, formatter_opts), ordered: false, timeout: 30000) |> Enum.reduce({[], [], []}, &collect_status/2) |> check!() end defp eval_dot_formatter(opts) do case dot_formatter(opts) do {:ok, dot_formatter} -> {formatter_opts, _} = Code.eval_file(dot_formatter) unless Keyword.keyword?(formatter_opts) do Mix.raise( "Expected #{inspect(dot_formatter)} to return a keyword list, " <> "got: #{inspect(formatter_opts)}" ) end formatter_opts :error -> [] end end defp dot_formatter(opts) do cond do dot_formatter = opts[:dot_formatter] -> {:ok, dot_formatter} File.regular?(".formatter.exs") -> {:ok, ".formatter.exs"} true -> :error end end defp expand_args([], formatter_opts) do if inputs = formatter_opts[:inputs] do expand_files_and_patterns(List.wrap(inputs), ".formatter.exs") else Mix.raise( "Expected one or more files/patterns to be given to mix format " <> "or for a .formatter.exs to exist with an :inputs key" ) end end defp expand_args(files_and_patterns, _formatter_opts) do expand_files_and_patterns(files_and_patterns, "command line") end defp expand_files_and_patterns(files_and_patterns, context) do files = for file_or_pattern <- files_and_patterns, file <- stdin_or_wildcard(file_or_pattern), uniq: true, do: file if files == [] do Mix.raise( "Could not find a file to format. The files/patterns from #{context} " <> "did not point to any existing file. Got: #{inspect(files_and_patterns)}" ) end files end defp stdin_or_wildcard("-"), do: [:stdin] defp stdin_or_wildcard(path), do: Path.wildcard(path) defp read_file(:stdin) do {IO.stream(:stdio, :line) |> Enum.to_list() |> IO.iodata_to_binary(), file: "stdin"} end defp read_file(file) do {File.read!(file), file: file} end defp write_file(:stdin, contents), do: IO.write(contents) defp write_file(file, contents), do: File.write!(file, contents) defp format_file(file, task_opts, formatter_opts) do {input, extra_opts} = read_file(file) output = [Code.format_string!(input, extra_opts ++ formatter_opts), ?\n] check_equivalent? = Keyword.get(task_opts, :check_equivalent, false) check_formatted? = Keyword.get(task_opts, :check_formatted, false) if check_equivalent? or check_formatted? do output_string = IO.iodata_to_binary(output) cond do check_equivalent? and not equivalent?(input, output_string) -> {:not_equivalent, file} check_formatted? and input != output_string -> {:not_formatted, file} true -> write_or_print(file, output, check_formatted?, task_opts) end else write_or_print(file, output, check_formatted?, task_opts) end rescue exception -> stacktrace = System.stacktrace() {:exit, file, exception, stacktrace} end defp write_or_print(file, output, check_formatted?, task_opts) do dry_run? = Keyword.get(task_opts, :dry_run, false) if dry_run? or check_formatted? do :ok else write_file(file, output) :ok end end defp collect_status({:ok, :ok}, acc), do: acc defp collect_status({:ok, {:exit, _, _, _} = exit}, {exits, not_equivalent, not_formatted}) do {[exit | exits], not_equivalent, not_formatted} end defp collect_status({:ok, {:not_equivalent, file}}, {exits, not_equivalent, not_formatted}) do {exits, [file | not_equivalent], not_formatted} end defp collect_status({:ok, {:not_formatted, file}}, {exits, not_equivalent, not_formatted}) do {exits, not_equivalent, [file | not_formatted]} end defp check!({[], [], []}) do :ok end defp check!({[{:exit, file, exception, stacktrace} | _], _not_equivalent, _not_formatted}) do Mix.shell().error("mix format failed for file: #{file}") reraise exception, stacktrace end defp check!({_exits, [_ | _] = not_equivalent, _not_formatted}) do Mix.raise(""" mix format failed due to --check-equivalent. The following files were not equivalent: #{to_bullet_list(not_equivalent)} Please report this bug with the input files at github.com/elixir-lang/elixir/issues """) end defp check!({_exits, _not_equivalent, [_ | _] = not_formatted}) do Mix.raise(""" mix format failed due to --check-formatted. The following files were not formatted: #{to_bullet_list(not_formatted)} """) end defp to_bullet_list(files) do Enum.map_join(files, "\n", &" * #{&1}") end defp equivalent?(input, output) do Code.Formatter.equivalent(input, output) == :ok end end
30.464286
96
0.669532
79159dea6fcd340f9c5b77c39d63d01a761bbde0
1,961
ex
Elixir
lib/phoenix_container_example_web/telemetry.ex
cogini/phoenix_container_example
2c4d66ad7186ec165b9d260bc232d6c6ee9b2abe
[ "Apache-2.0" ]
19
2020-07-21T06:03:36.000Z
2022-03-21T22:35:22.000Z
lib/phoenix_container_example_web/telemetry.ex
cogini/phoenix_container_example
2c4d66ad7186ec165b9d260bc232d6c6ee9b2abe
[ "Apache-2.0" ]
1
2022-03-08T10:26:55.000Z
2022-03-08T10:26:55.000Z
lib/phoenix_container_example_web/telemetry.ex
cogini/phoenix_container_example
2c4d66ad7186ec165b9d260bc232d6c6ee9b2abe
[ "Apache-2.0" ]
1
2022-02-09T01:25:09.000Z
2022-02-09T01:25:09.000Z
defmodule PhoenixContainerExampleWeb.Telemetry do @moduledoc false use Supervisor import Telemetry.Metrics def start_link(arg) do Supervisor.start_link(__MODULE__, arg, name: __MODULE__) end @impl true def init(_arg) do children = [ # Telemetry poller will execute the given period measurements # every 10_000ms. Learn more here: https://hexdocs.pm/telemetry_metrics {:telemetry_poller, measurements: periodic_measurements(), period: 10_000} # Add reporters as children of your supervision tree. # {Telemetry.Metrics.ConsoleReporter, metrics: metrics()} ] Supervisor.init(children, strategy: :one_for_one) end def metrics do [ # Phoenix Metrics summary("phoenix.endpoint.stop.duration", unit: {:native, :millisecond} ), summary("phoenix.router_dispatch.stop.duration", tags: [:route], unit: {:native, :millisecond} ), # Database Metrics summary("phoenix_container_example.repo.query.total_time", unit: {:native, :millisecond}), summary("phoenix_container_example.repo.query.decode_time", unit: {:native, :millisecond}), summary("phoenix_container_example.repo.query.query_time", unit: {:native, :millisecond}), summary("phoenix_container_example.repo.query.queue_time", unit: {:native, :millisecond}), summary("phoenix_container_example.repo.query.idle_time", unit: {:native, :millisecond}), # VM Metrics summary("vm.memory.total", unit: {:byte, :kilobyte}), summary("vm.total_run_queue_lengths.total"), summary("vm.total_run_queue_lengths.cpu"), summary("vm.total_run_queue_lengths.io") ] end defp periodic_measurements do [ # A module, function and arguments to be invoked periodically. # This function must call :telemetry.execute/3 and a metric must be added above. # {PhoenixContainerExampleWeb, :count_users, []} ] end end
33.810345
97
0.692504
7915b3a4fb48e3a3ff93362d39fd144e0a8b825f
350
exs
Elixir
priv/repo/migrations/20181029050803_create_clicks.exs
TDogVoid/job_board
23793917bd1cc4e68bccce737b971093030a31eb
[ "MIT" ]
null
null
null
priv/repo/migrations/20181029050803_create_clicks.exs
TDogVoid/job_board
23793917bd1cc4e68bccce737b971093030a31eb
[ "MIT" ]
null
null
null
priv/repo/migrations/20181029050803_create_clicks.exs
TDogVoid/job_board
23793917bd1cc4e68bccce737b971093030a31eb
[ "MIT" ]
null
null
null
defmodule JobBoard.Repo.Migrations.CreateClicks do use Ecto.Migration def change do create table(:clicks) do add :job_id, references(:jobs, on_delete: :nothing) add :user_id, references(:users, on_delete: :nothing) timestamps() end create index(:clicks, [:job_id]) create index(:clicks, [:user_id]) end end
21.875
59
0.677143
7915efa5eb175dfcc5dacd4e4f5922e83cf325ed
1,062
exs
Elixir
test/joi/validator/inclustion_test.exs
scottming/joi
1c7546bb0473fa53325533c7ab4aec402bfba0d1
[ "MIT" ]
25
2020-12-03T08:14:51.000Z
2021-09-01T15:34:30.000Z
test/joi/validator/inclustion_test.exs
scottming/joi
1c7546bb0473fa53325533c7ab4aec402bfba0d1
[ "MIT" ]
5
2021-02-13T12:56:56.000Z
2021-07-30T01:27:51.000Z
test/joi/validator/inclustion_test.exs
scottming/joi
1c7546bb0473fa53325533c7ab4aec402bfba0d1
[ "MIT" ]
2
2021-03-15T00:37:13.000Z
2021-07-26T15:21:55.000Z
defmodule Joi.Validator.InclusionTest do @moduledoc false use ExUnit.Case, async: true import Joi.Support.Util import Assertions @field :field @inclusion [:fake_inclusion] @validator :inclusion test "types that support #{@validator}" do assert_lists_equal(types_by(@validator), [:atom, :string, :integer, :float, :decimal]) end describe "validate inclusion" do for type <- types_by("inclusion") do test "error: when type is #{type}, inclusion is #{inspect(@inclusion)}" do data = %{@field => "1"} type_module = atom_type_to_mod(unquote(type)) assert {:error, error} = apply(type_module, :validate_field, [@field, data, [inclusion: @inclusion]]) assert %Joi.Error{ context: %{inclusion: @inclusion, key: :field, value: _value}, message: "field must be one of [:fake_inclusion]", path: [:field], type: error_type } = error assert error_type == "#{unquote(type)}.inclusion" end end end end
30.342857
109
0.615819
79160729edd12903fcb068c96aa67d409e27b9fe
2,524
exs
Elixir
test/bf_test.exs
lukad/bf
4a33d7602c98f70024a6d4ed392eeae41385b6d2
[ "MIT" ]
6
2017-02-12T08:52:38.000Z
2021-09-02T06:58:48.000Z
test/bf_test.exs
lukad/bf
4a33d7602c98f70024a6d4ed392eeae41385b6d2
[ "MIT" ]
1
2018-09-21T06:45:31.000Z
2018-09-27T19:19:20.000Z
test/bf_test.exs
lukad/bf
4a33d7602c98f70024a6d4ed392eeae41385b6d2
[ "MIT" ]
null
null
null
defmodule BfTest do use ExUnit.Case doctest Bf import ExUnit.CaptureIO defmacro assert_output(program, output, input \\ "") do quote do assert capture_io(unquote(input), fn -> Bf.run(unquote(program)) end) == unquote(output) end end describe "Bf.run/1" do test "prints all 256 characters" do expected = 0..255 |> Enum.to_list() |> to_string() {:ok, [ {:add, -1}, {:loop, [{:move, 1}, {:write}, {:add, 1}, {:move, -1}, {:add, -1}]}, {:move, 1}, {:write} ]} |> assert_output(expected) end test "wraps cell values around 256" do expected = [255, 1] |> to_string() {:ok, [ {:add, -1}, {:write}, {:loop, [{:move, 1}, {:add, 1}, {:move, -1}, {:add, -1}]}, {:move, 1}, {:add, 2}, {:write} ]} |> assert_output(expected) end test "stops reading after '0'" do program = {:ok, [{:read}, {:loop, [{:write}, {:read}]}]} assert_output(program, "abc", "abc\0def") end test "runs nested loops correctly" do {:ok, [ {:add, 6}, {:loop, [ {:move, 1}, {:add, 4}, {:loop, [{:move, 1}, {:add, 2}, {:move, -1}, {:add, -1}]}, {:move, -1}, {:add, -1} ]}, {:move, 2}, {:write} ]} |> assert_output("0") end test "runs resets cells ([-])" do {:ok, [ {:add, 10}, {:move, -1}, {:add, 1}, {:move, 1}, {:set, 6}, {:loop, [ {:move, 1}, {:add, 4}, {:loop, [{:move, 1}, {:add, 2}, {:move, -1}, {:add, -1}]}, {:move, -1}, {:add, -1} ]}, {:move, 2}, {:write} ]} |> assert_output("0") end test "scans forwards for closest 0 cell in steps of 1" do {:ok, [ {:add, 1}, {:move, 9}, {:add, 1}, {:move, 1}, {:add, 64}, {:move, -10}, {:loop, [move: 1, add: -1]}, {:move, -9}, {:scan, 1}, {:move, 1}, {:write} ]} |> assert_output("@") end test "scans backwards for closest 0 cell in steps of n" do {:ok, [{:move, -1}, {:add, 64}, {:move, 4}, {:add, 1}, {:scan, -3}, {:move, -1}, {:write}]} |> assert_output("@") end end end
22.336283
97
0.38748
79160bc7eb8065fa69284836e9d01b0faee69ec6
991
ex
Elixir
test/support/channel_case.ex
vheathen/club.wallprint.pro
d58d2409d8879d23ed4d60fe3b9c2e1bd82e924d
[ "MIT" ]
null
null
null
test/support/channel_case.ex
vheathen/club.wallprint.pro
d58d2409d8879d23ed4d60fe3b9c2e1bd82e924d
[ "MIT" ]
34
2019-11-10T11:31:37.000Z
2019-11-27T21:26:48.000Z
test/support/channel_case.ex
vheathen/club.wallprint.pro
d58d2409d8879d23ed4d60fe3b9c2e1bd82e924d
[ "MIT" ]
null
null
null
defmodule ClubWeb.ChannelCase do @moduledoc """ This module defines the test case to be used by channel tests. Such tests rely on `Phoenix.ChannelTest` and also import other functionality to make it easier to build common data structures and query the data layer. Finally, if the test case interacts with the database, it cannot be async. For this reason, every test runs inside a transaction which is reset at the beginning of the test unless the test case is marked as async. """ use ExUnit.CaseTemplate using do quote do # Import conveniences for testing with channels use Phoenix.ChannelTest # The default endpoint for testing @endpoint ClubWeb.Endpoint end end setup _tags do {:ok, _} = Application.ensure_all_started(:club) default_settings = Application.get_all_env(:club) on_exit(fn -> Application.put_all_env([{:club, default_settings}]) Club.Storage.reset!() end) :ok end end
24.170732
59
0.710394
7916170b6324bf4f36e5643f5a67816df33a3314
349
exs
Elixir
priv/repo/seeds.exs
jordyvanvorselen/chewie-backend
b382ee0726f54d8ae45f2b41f43e38469cecc326
[ "MIT" ]
null
null
null
priv/repo/seeds.exs
jordyvanvorselen/chewie-backend
b382ee0726f54d8ae45f2b41f43e38469cecc326
[ "MIT" ]
null
null
null
priv/repo/seeds.exs
jordyvanvorselen/chewie-backend
b382ee0726f54d8ae45f2b41f43e38469cecc326
[ "MIT" ]
null
null
null
# Script for populating the database. You can run it as: # # mix run priv/repo/seeds.exs # # Inside the script, you can read and write to any of your # repositories directly: # # Chewie.Repo.insert!(%Chewie.SomeSchema{}) # # We recommend using the bang functions (`insert!`, `update!` # and so on) as they will fail if something goes wrong.
29.083333
61
0.704871
791620b4c9056b5563f7ae17231b5733005b453e
708
ex
Elixir
pulsar/lib/pulsar_web/gettext.ex
Dermah/pulsar.wtf
fed5734578eb4c8b93bd1cdcb6e2f6d894a4af9e
[ "MIT" ]
null
null
null
pulsar/lib/pulsar_web/gettext.ex
Dermah/pulsar.wtf
fed5734578eb4c8b93bd1cdcb6e2f6d894a4af9e
[ "MIT" ]
1
2021-03-09T21:33:42.000Z
2021-03-09T21:33:42.000Z
pulsar/lib/pulsar_web/gettext.ex
Dermah/pulsar.wtf
fed5734578eb4c8b93bd1cdcb6e2f6d894a4af9e
[ "MIT" ]
null
null
null
defmodule PulsarWeb.Gettext do @moduledoc """ A module providing Internationalization with a gettext-based API. By using [Gettext](https://hexdocs.pm/gettext), your module gains a set of macros for translations, for example: import PulsarWeb.Gettext # Simple translation gettext("Here is the string to translate") # Plural translation ngettext("Here is the string to translate", "Here are the strings to translate", 3) # Domain-based translation dgettext("errors", "Here is the error message to translate") See the [Gettext Docs](https://hexdocs.pm/gettext) for detailed usage. """ use Gettext, otp_app: :pulsar end
28.32
72
0.676554
79162857f1fcc6709429c49e93cd5471d7fc2fa7
878
exs
Elixir
socket_gallows/config/config.exs
wronfim/hangman_game
c4dc4b9f122e773fe87ac4dc88206b792c1b239e
[ "MIT" ]
null
null
null
socket_gallows/config/config.exs
wronfim/hangman_game
c4dc4b9f122e773fe87ac4dc88206b792c1b239e
[ "MIT" ]
null
null
null
socket_gallows/config/config.exs
wronfim/hangman_game
c4dc4b9f122e773fe87ac4dc88206b792c1b239e
[ "MIT" ]
null
null
null
# This file is responsible for configuring your application # and its dependencies with the aid of the Mix.Config module. # # This configuration file is loaded before any dependency and # is restricted to this project. use Mix.Config # Configures the endpoint config :socket_gallows, SocketGallowsWeb.Endpoint, url: [host: "localhost"], secret_key_base: "AKyqbscHApOlNQNph+f0R7VtZi2UgV8LdfrlLZ87z1cIcXFdJn3bC+W/lKSrTwjE", render_errors: [view: SocketGallowsWeb.ErrorView, accepts: ~w(html json)], pubsub: [name: SocketGallows.PubSub, adapter: Phoenix.PubSub.PG2] # Configures Elixir's Logger config :logger, :console, format: "$time $metadata[$level] $message\n", metadata: [:request_id] # Import environment specific config. This must remain at the bottom # of this file so it overrides the configuration defined above. import_config "#{Mix.env}.exs"
36.583333
86
0.766515
79165843831eb576f6ad96d770d43e3bfaae3fb2
585
ex
Elixir
lib/lexthink/supervisor.ex
taybin/lexthink
0afd178dbf372bedd0933b1d2a0f2a84615b96f9
[ "Apache-2.0" ]
1
2015-12-07T13:07:39.000Z
2015-12-07T13:07:39.000Z
lib/lexthink/supervisor.ex
taybin/lexthink
0afd178dbf372bedd0933b1d2a0f2a84615b96f9
[ "Apache-2.0" ]
null
null
null
lib/lexthink/supervisor.ex
taybin/lexthink
0afd178dbf372bedd0933b1d2a0f2a84615b96f9
[ "Apache-2.0" ]
null
null
null
defmodule Lexthink.Supervisor do use Supervisor.Behaviour def start_link do :supervisor.start_link({:local, __MODULE__}, __MODULE__, []) end def init([]) do Lexthink.Server = :ets.new(Lexthink.Server, [:ordered_set, :public, :named_table, {:read_concurrency, :true}]) children = [ # Define workers and child supervisors to be supervised worker(Lexthink.Server, []) ] # See http://elixir-lang.org/docs/stable/Supervisor.Behaviour.html # for other strategies and supported options supervise(children, strategy: :one_for_one) end end
27.857143
114
0.702564
79166feecc37e6a1d4cb320007878cf23268ca18
4,607
ex
Elixir
lib/ramona/utils.ex
sqdorte/ramona
45ba8b17a8542c4451931b2049ba618be187ecfa
[ "Apache-2.0" ]
1
2019-01-24T19:58:04.000Z
2019-01-24T19:58:04.000Z
lib/ramona/utils.ex
sqdorte/ramona
45ba8b17a8542c4451931b2049ba618be187ecfa
[ "Apache-2.0" ]
null
null
null
lib/ramona/utils.ex
sqdorte/ramona
45ba8b17a8542c4451931b2049ba618be187ecfa
[ "Apache-2.0" ]
null
null
null
defmodule Ramona.Utils do @moduledoc """ Collection of functions to serve as tools for some Cogs. """ alias Alchemy.Client require Logger require Alchemy.Embed, as: Embed @appos "146367028968554496" @ansuz "429110513117429780" @eihwaz "429111918297612298" @unleashed_gid "429110044525592578" @type color_hex :: String.t() @type message :: String.t() def uptime do {time, _} = :erlang.statistics(:wall_clock) min = div(time, 1000 * 60) {hours, min} = {div(min, 60), rem(min, 60)} {days, hours} = {div(hours, 24), rem(hours, 24)} Stream.zip([min, hours, days], ["m", "h", "d"]) |> Enum.reduce("", fn {0, _glyph}, acc -> acc {t, glyph}, acc -> " #{t}" <> glyph <> acc end) end def time_in_seconds(lst) do Enum.map(lst, &Integer.parse/1) |> Enum.map(fn {n, "h"} -> n * 60 * 60 {n, "m"} -> n * 60 {n, "s"} -> n end) |> Enum.sum() end @doc """ Generate a random color in hexadecimal. ## Examples iex> Thonk.Utils.color_random() "FCFB5E" """ @spec color_random() :: color_hex def color_random do color_random([]) |> Enum.map(&to_string/1) |> Enum.join() end defp color_random(list) do case length(list) do 6 -> list _ -> hex_digit = Enum.random(0..15) |> Integer.to_charlist(16) color_random([hex_digit | list]) end end @spec color_embed(color_hex, String.t()) :: %Alchemy.Embed{} def color_embed(color_hex, filename) do # color struct color = CssColors.parse!(color_hex) hue = trunc(CssColors.hsl(color).hue) lightness = trunc(CssColors.hsl(color).lightness * 100) saturation = trunc(CssColors.hsl(color).saturation * 100) hsl = "#{hue}, #{lightness}%, #{saturation}%" rgb = "#{trunc(color.red)}, #{trunc(color.green)}, #{trunc(color.blue)}" %Mogrify.Image{path: "#{filename}.jpg", ext: "jpg"} |> Mogrify.custom("size", "80x80") |> Mogrify.canvas(to_string(color)) |> Mogrify.create(path: "lib/ramona/assets/") # Remove "#" symbol color_hex = with c <- to_string(color) do String.slice(c, 1, String.length(c)) end # color number for the embed {color_integer, _} = Code.eval_string("0x#{color_hex}") %Embed{color: color_integer, title: to_string(color)} |> Embed.field("RGB", rgb) |> Embed.field("HSL", hsl) |> Embed.thumbnail("attachment://#{filename}.jpg") end @spec gen_hash :: String.t() def gen_hash do salt = fn x -> :crypto.hash(:md5, "#{x + Enum.random 1..60000}") end DateTime.utc_now() |> DateTime.to_unix() |> salt.() |> Base.encode16() end @spec parse_color(String.t(), boolean, boolean) :: {:ok, color_hex} | :error def parse_color(hex, named_color?, hashtag?) do pattern1 = ~r/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/ pattern2 = ~r/^([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/ cond do Regex.match?(pattern1, hex) -> {:ok, hex} Regex.match?(pattern2, hex) -> if hashtag? do {:ok, "#" <> hex} else {:ok, hex} end true -> if named_color? do case CssColors.parse(hex) do {:ok, _} -> {:ok, hex} {:error, _} -> :error end else :error end end end @spec escape_prefix(String.t()) :: String.t() def escape_prefix(message) do prefix = Application.fetch_env!(:ramona, :prefix) String.replace(message, prefix, "\\#{prefix}") end @spec invite_match?(String.t()) :: nil | boolean def invite_match?(str) do Regex.match?(~r{discord\.gg\/[a-zA-Z0-9]*}, str) || Regex.match?(~r{discordapp\.com\/invite\/[a-zA-Z0-9]*}, str) end @spec catch_invites(%Regex{}, message) :: list def catch_invites(patt, message) do Regex.scan(patt, message) |> Enum.flat_map(& &1) end @spec not_a_mod(String.t()) :: boolean def not_a_mod(user_id) do case Client.get_member(@unleashed_gid, user_id) do {:ok, member} -> @ansuz not in member.roles and @eihwaz not in member.roles {:error, reason} -> Logger.warn "Couldn't get member for #{user_id} (mod check):\n #{reason}" false end end @spec not_an_admin(String.t()) :: boolean def not_an_admin(user_id) do case Client.get_member(@unleashed_gid, user_id) do {:ok, member} -> @ansuz not in member.roles or user_id != @appos {:error, reason} -> Logger.warn "Couldn't get member for #{user_id} (admin check):\n #{reason}" false end end end
26.176136
84
0.581289
79167c4bf775b6d4234f8167fef7629a978a7bd6
1,501
ex
Elixir
testData/org/elixir_lang/annotator/module_attribute/module_attributes.ex
keyno63/intellij-elixir
4033e319992c53ddd42a683ee7123a97b5e34f02
[ "Apache-2.0" ]
1,668
2015-01-03T05:54:27.000Z
2022-03-25T08:01:20.000Z
testData/org/elixir_lang/annotator/module_attribute/module_attributes.ex
keyno63/intellij-elixir
4033e319992c53ddd42a683ee7123a97b5e34f02
[ "Apache-2.0" ]
2,018
2015-01-01T22:43:39.000Z
2022-03-31T20:13:08.000Z
testData/org/elixir_lang/annotator/module_attribute/module_attributes.ex
keyno63/intellij-elixir
4033e319992c53ddd42a683ee7123a97b5e34f02
[ "Apache-2.0" ]
145
2015-01-15T11:37:16.000Z
2021-12-22T05:51:02.000Z
# Preferences > Editors > Colors & Fonts > Elixir setting name in comments above each paragraph defmodule ModuleAttributes do # `@moduledoc` - Documention Module Attributes # `@moduledoc` heredoc - Documention Text @moduledoc """ String Heredocs are highlighted as Documentation Text """ # `@doc` - Documentation Module Attributes # `@doc` string - Documentation Text # `@callback` - Module Attributes # `callback_name` - Specification # `atom` - Type @doc "A callback" @callback callback_name(atom) :: {:ok, atom} | :error # `@macrocallback` - Module Attributes # `macro_callback_name` - Spcification # `list`, `tuple` - Type @macrocallback macro_callback_name(list) :: tuple # Types # `@typedoc` - Documentation Module Attributes # `@typedoc` string - Documentation Text # `@opaque` - Module Attributes # `opaque_type` - Type @typedoc "Don't think about how this works" @opaque opaque_type :: [1, 2] # `@type` - Module Attributes # `type_with_parameters` - Type # `a`, `b` - Type Parameter @type type_with_parameters(a, b) :: {a, b} @type type_name :: {:ok, list} # `@spec` - Module Attributes # `do_it` - Specificaton # `any` - Type @spec do_it({:ok, any}) :: :ok def do_it({:ok, _}), do: :ok # `@spec` - Module Attributes # `do_nothing` - Specification # `result` - Type Parameter # `any` - Type @spec do_nothing(result) :: result when result: {:error, any} def do_nothing(result = {:error, _}), do: result end
29.431373
95
0.660893
79168a29e4d476ecabfa4a954c30da87cadc42eb
1,143
exs
Elixir
config/config.exs
hippware/firebase-admin-ex
bca6f83a8ae94a7fdb0a447030913d03ea170bb1
[ "MIT" ]
null
null
null
config/config.exs
hippware/firebase-admin-ex
bca6f83a8ae94a7fdb0a447030913d03ea170bb1
[ "MIT" ]
null
null
null
config/config.exs
hippware/firebase-admin-ex
bca6f83a8ae94a7fdb0a447030913d03ea170bb1
[ "MIT" ]
null
null
null
# This file is responsible for configuring your application # and its dependencies with the aid of the Mix.Config module. use Mix.Config # This configuration is loaded before any dependency and is restricted # to this project. If another project depends on this project, this # file won't be loaded nor affect the parent project. For this reason, # if you want to provide default values for your application for # 3rd-party users, it should be done in your "mix.exs" file. # You can configure your application as: # # config :firebase_admin_ex, key: :value # # and access this configuration in your application as: # # Application.get_env(:firebase_admin_ex, :key) # # You can also configure a 3rd-party app: # # config :logger, level: :info # # It is also possible to import configuration files, relative to this # directory. For example, you can emulate configuration per environment # by uncommenting the line below and defining dev.exs, test.exs and such. # Configuration from the imported file will override the ones defined # here (which is why it is important to import them last). # # import_config "#{Mix.env}.exs"
36.870968
73
0.755906
7916933ca8df035b098e9ffded508759a6d8d1a9
903
ex
Elixir
chapter5/challenges/jwtchallenge/lib/jwtchallenge_web/router.ex
mCodex/rocketseat-ignite-elixir
bdb48db778c36b2325c75a41b4d6f7ef77b03cf5
[ "MIT" ]
1
2021-07-23T19:48:27.000Z
2021-07-23T19:48:27.000Z
chapter5/challenges/jwtchallenge/lib/jwtchallenge_web/router.ex
mCodex/rocketseat-ignite-elixir
bdb48db778c36b2325c75a41b4d6f7ef77b03cf5
[ "MIT" ]
null
null
null
chapter5/challenges/jwtchallenge/lib/jwtchallenge_web/router.ex
mCodex/rocketseat-ignite-elixir
bdb48db778c36b2325c75a41b4d6f7ef77b03cf5
[ "MIT" ]
null
null
null
defmodule JwtchallengeWeb.Router do use JwtchallengeWeb, :router pipeline :api do plug :accepts, ["json"] end scope "/api", JwtchallengeWeb do pipe_through :api post "/users", UsersController, :create post "/sign-in", UsersController, :sign_in end # Enables LiveDashboard only for development # # If you want to use the LiveDashboard in production, you should put # it behind authentication and allow only admins to access it. # If your application does not have an admins-only section yet, # you can use Plug.BasicAuth to set up some basic authentication # as long as you are also using SSL (which you should anyway). if Mix.env() in [:dev, :test] do import Phoenix.LiveDashboard.Router scope "/" do pipe_through [:fetch_session, :protect_from_forgery] live_dashboard "/dashboard", metrics: JwtchallengeWeb.Telemetry end end end
29.129032
70
0.717608
7916a2b07d278d8b6af443f826d5c4c5566c5564
1,183
ex
Elixir
lib/oli_web/live/sections/main_details.ex
malav2110/oli-torus
8af64e762a7c8a2058bd27a7ab8e96539ffc055f
[ "MIT" ]
1
2022-03-17T20:35:47.000Z
2022-03-17T20:35:47.000Z
lib/oli_web/live/sections/main_details.ex
malav2110/oli-torus
8af64e762a7c8a2058bd27a7ab8e96539ffc055f
[ "MIT" ]
9
2021-11-02T16:52:09.000Z
2022-03-25T15:14:01.000Z
lib/oli_web/live/sections/main_details.ex
malav2110/oli-torus
8af64e762a7c8a2058bd27a7ab8e96539ffc055f
[ "MIT" ]
null
null
null
defmodule OliWeb.Sections.MainDetails do use Surface.Component alias Surface.Components.Form.{Field, Label, TextInput, Select, ErrorTag} import Ecto.Changeset prop changeset, :any, required: true prop disabled, :boolean, required: true prop is_admin, :boolean, required: true prop brands, :list, required: true def render(assigns) do ~F""" <div> <Field name={:title} class="form-label-group"> <div class="d-flex justify-content-between"><Label/><ErrorTag class="help-block"/></div> <TextInput class="form-control" opts={disabled: @disabled}/> </Field> <Field name={:description} class="form-label-group"> <div class="d-flex justify-content-between"><Label/><ErrorTag class="help-block"/></div> <TextInput class="form-control" opts={disabled: @disabled}/> </Field> <Field name={:brand_id} class="mt-2"> <Label>Brand</Label> <Select class="form-control" prompt="None" form="section" field="brand_id" options={@brands} selected={get_field(@changeset, :brand_id)}/> </Field> <button class="btn btn-primary mt-3" type="submit">Save</button> </div> """ end end
35.848485
146
0.655114
7916a810ae4418d39acfe1f20ceeaf0a007dd715
190
exs
Elixir
priv/repo/migrations/20160829161012_change_address_index.exs
guofei/embedchat
6562108acd1d488dde457f28cf01d82b4c5a9bf8
[ "MIT" ]
27
2016-10-15T12:13:22.000Z
2021-02-07T20:31:41.000Z
priv/repo/migrations/20160829161012_change_address_index.exs
guofei/embedchat
6562108acd1d488dde457f28cf01d82b4c5a9bf8
[ "MIT" ]
null
null
null
priv/repo/migrations/20160829161012_change_address_index.exs
guofei/embedchat
6562108acd1d488dde457f28cf01d82b4c5a9bf8
[ "MIT" ]
4
2016-08-21T15:03:29.000Z
2019-11-22T13:15:29.000Z
defmodule EmbedChat.Repo.Migrations.ChangeAddressIndex do use Ecto.Migration def change do drop index(:addresses, [:uuid]) create index(:addresses, [:uuid, :room_id]) end end
21.111111
57
0.726316
7916aaea692fa50b6b5346910080725c3eaf453b
641
ex
Elixir
lib/changelog/data/news/news_item_topic.ex
boneskull/changelog.com
2fa2e356bb0e8fcf038c46a4a947fef98822e37d
[ "MIT" ]
null
null
null
lib/changelog/data/news/news_item_topic.ex
boneskull/changelog.com
2fa2e356bb0e8fcf038c46a4a947fef98822e37d
[ "MIT" ]
null
null
null
lib/changelog/data/news/news_item_topic.ex
boneskull/changelog.com
2fa2e356bb0e8fcf038c46a4a947fef98822e37d
[ "MIT" ]
null
null
null
defmodule Changelog.NewsItemTopic do use Changelog.Data alias Changelog.{NewsItem, Topic} schema "news_item_topics" do field :position, :integer field :delete, :boolean, virtual: true belongs_to :news_item, NewsItem, foreign_key: :item_id belongs_to :topic, Topic timestamps() end def changeset(item_topic, params \\ %{}) do item_topic |> cast(params, ~w(position item_id topic_id delete)) |> validate_required([:position]) |> mark_for_deletion() end def build_and_preload({topic, position}) do %__MODULE__{position: position, topic_id: topic.id} |> Repo.preload(:topic) end end
23.740741
79
0.702028
7916aba7fbbe3073903ed066ee280bb8fd12ceef
2,973
ex
Elixir
clients/content/lib/google_api/content/v2/model/order_shipment.ex
matehat/elixir-google-api
c1b2523c2c4cdc9e6ca4653ac078c94796b393c3
[ "Apache-2.0" ]
1
2018-12-03T23:43:10.000Z
2018-12-03T23:43:10.000Z
clients/content/lib/google_api/content/v2/model/order_shipment.ex
matehat/elixir-google-api
c1b2523c2c4cdc9e6ca4653ac078c94796b393c3
[ "Apache-2.0" ]
null
null
null
clients/content/lib/google_api/content/v2/model/order_shipment.ex
matehat/elixir-google-api
c1b2523c2c4cdc9e6ca4653ac078c94796b393c3
[ "Apache-2.0" ]
null
null
null
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the &quot;License&quot;); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an &quot;AS IS&quot; BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This class is auto generated by the elixir code generator program. # Do not edit the class manually. defmodule GoogleApi.Content.V2.Model.OrderShipment do @moduledoc """ ## Attributes * `carrier` (*type:* `String.t`, *default:* `nil`) - The carrier handling the shipment. Acceptable values for US are: - "gsx" - "ups" - "usps" - "fedex" - "dhl" - "ecourier" - "cxt" - "google" - "ontrac" - "emsy" - "ont" - "deliv" - "dynamex" - "lasership" - "mpx" - "uds" - "efw" Acceptable values for FR are: - "colissimo" - "chronopost" - "gls" - "dpd" - "bpost" * `creationDate` (*type:* `String.t`, *default:* `nil`) - Date on which the shipment has been created, in ISO 8601 format. * `deliveryDate` (*type:* `String.t`, *default:* `nil`) - Date on which the shipment has been delivered, in ISO 8601 format. Present only if status is delivered * `id` (*type:* `String.t`, *default:* `nil`) - The ID of the shipment. * `lineItems` (*type:* `list(GoogleApi.Content.V2.Model.OrderShipmentLineItemShipment.t)`, *default:* `nil`) - The line items that are shipped. * `status` (*type:* `String.t`, *default:* `nil`) - The status of the shipment. * `trackingId` (*type:* `String.t`, *default:* `nil`) - The tracking ID for the shipment. """ use GoogleApi.Gax.ModelBase @type t :: %__MODULE__{ :carrier => String.t(), :creationDate => String.t(), :deliveryDate => String.t(), :id => String.t(), :lineItems => list(GoogleApi.Content.V2.Model.OrderShipmentLineItemShipment.t()), :status => String.t(), :trackingId => String.t() } field(:carrier) field(:creationDate) field(:deliveryDate) field(:id) field(:lineItems, as: GoogleApi.Content.V2.Model.OrderShipmentLineItemShipment, type: :list) field(:status) field(:trackingId) end defimpl Poison.Decoder, for: GoogleApi.Content.V2.Model.OrderShipment do def decode(value, options) do GoogleApi.Content.V2.Model.OrderShipment.decode(value, options) end end defimpl Poison.Encoder, for: GoogleApi.Content.V2.Model.OrderShipment do def encode(value, options) do GoogleApi.Gax.ModelBase.encode(value, options) end end
32.67033
164
0.638412
7916ae14ec822a8e2ecb60a402404016dd0986e9
211
ex
Elixir
examples/load-test/server/lib/socket_server/collector/verbose.ex
pushex-project/push.ex
a6d4b18face39dd84d01a887dce60db2d0001d37
[ "MIT" ]
78
2018-12-02T23:58:37.000Z
2021-09-30T18:52:45.000Z
examples/load-test/server/lib/socket_server/collector/verbose.ex
pushex-project/push.ex
a6d4b18face39dd84d01a887dce60db2d0001d37
[ "MIT" ]
23
2018-11-27T14:57:20.000Z
2021-09-24T16:14:43.000Z
examples/load-test/server/lib/socket_server/collector/verbose.ex
pushex-project/push.ex
a6d4b18face39dd84d01a887dce60db2d0001d37
[ "MIT" ]
3
2019-01-30T02:08:37.000Z
2021-09-03T20:53:35.000Z
defmodule SocketServer.Collector.Verbose do def collect() do [ PushEx.Instrumentation.Tracker.connected_socket_count(), PushEx.Instrumentation.Tracker.connected_channel_count() ] end end
23.444444
62
0.748815
7916c71e392ba236995541da9ad59703790fb0c9
1,251
ex
Elixir
lib/mole_web/controllers/learning_controller.ex
the-mikedavis/mole
73d884b5dca4e5371b1b399d7e65c0f4a0229851
[ "BSD-3-Clause" ]
1
2020-07-15T14:39:10.000Z
2020-07-15T14:39:10.000Z
lib/mole_web/controllers/learning_controller.ex
the-mikedavis/mole
73d884b5dca4e5371b1b399d7e65c0f4a0229851
[ "BSD-3-Clause" ]
59
2018-11-05T23:09:10.000Z
2020-07-11T20:44:14.000Z
lib/mole_web/controllers/learning_controller.ex
the-mikedavis/mole
73d884b5dca4e5371b1b399d7e65c0f4a0229851
[ "BSD-3-Clause" ]
null
null
null
defmodule MoleWeb.LearningController do use MoleWeb, :controller alias Mole.Content.Condition alias MoleWeb.Router.Helpers, as: Routes alias MoleWeb.Plugs.Learning plug(:learn) # showing how to play def index(conn, _params) do image = case Condition.to_tuple(conn.assigns.condition) do {:none, _} -> "/images/instruction_control.png" _ -> "/images/instruction_condition.png" end conn |> assign(:image, image) |> render("show.html", next: Routes.game_path(conn, :index)) end # showing a condition def show(conn, %{"id" => id}) do with n when is_integer(n) <- conn.assigns.condition, image when not is_nil(image) <- Condition.image_for(n, id) do conn |> assign(:image, image) |> next(id) |> render("show.html") else nil -> redirect(conn, to: Routes.learning_path(conn, :index)) end end defp learn(conn, _opts), do: Learning.learn(conn) defp next(conn, id) do id = String.to_integer(id) link = case Condition.image_for(conn.assigns.condition, id + 1) do nil -> Routes.game_path(conn, :index) _image -> Routes.learning_path(conn, :show, id + 1) end assign(conn, :next, link) end end
25.02
70
0.634692
7916e93dcd962925ab8e5e2943b391b664d8e088
717
ex
Elixir
lib/timestamp_web/gettext.ex
ugiete/Timestamp-Converter
04e0eca0918f7c87047bb0cb7849cf853d747f37
[ "MIT" ]
null
null
null
lib/timestamp_web/gettext.ex
ugiete/Timestamp-Converter
04e0eca0918f7c87047bb0cb7849cf853d747f37
[ "MIT" ]
null
null
null
lib/timestamp_web/gettext.ex
ugiete/Timestamp-Converter
04e0eca0918f7c87047bb0cb7849cf853d747f37
[ "MIT" ]
null
null
null
defmodule TimestampWeb.Gettext do @moduledoc """ A module providing Internationalization with a gettext-based API. By using [Gettext](https://hexdocs.pm/gettext), your module gains a set of macros for translations, for example: import TimestampWeb.Gettext # Simple translation gettext("Here is the string to translate") # Plural translation ngettext("Here is the string to translate", "Here are the strings to translate", 3) # Domain-based translation dgettext("errors", "Here is the error message to translate") See the [Gettext Docs](https://hexdocs.pm/gettext) for detailed usage. """ use Gettext, otp_app: :timestamp end
28.68
72
0.680614
7916f1384b56338ff0d8f8e926bda1e6031a092e
1,320
ex
Elixir
lib/email_service/repos/email/template_repo.ex
noizu/KitchenSink
34f51fb93dfa913ba7be411475d02520d537e676
[ "MIT" ]
2
2019-04-15T22:17:59.000Z
2022-01-03T15:35:36.000Z
lib/email_service/repos/email/template_repo.ex
noizu/KitchenSink
34f51fb93dfa913ba7be411475d02520d537e676
[ "MIT" ]
null
null
null
lib/email_service/repos/email/template_repo.ex
noizu/KitchenSink
34f51fb93dfa913ba7be411475d02520d537e676
[ "MIT" ]
null
null
null
#------------------------------------------------------------------------------- # Author: Keith Brings # Copyright (C) 2018 Noizu Labs, Inc. All rights reserved. #------------------------------------------------------------------------------- defmodule Noizu.EmailService.Email.TemplateRepo do use Noizu.Scaffolding.V2.RepoBehaviour, mnesia_table: Noizu.EmailService.Database.Email.TemplateTable require Logger #---------------------------- # post_get_callback/3 #---------------------------- def post_get_callback(%{vsn: 1.1} = entity, _context, _options) do entity end def post_get_callback(%{vsn: vsn} = entity, context, options) do entity = update_version(entity, context, options) cond do entity.vsn != vsn -> update!(entity, Noizu.ElixirCore.CallingContext.system(context), options) :else -> entity end end def post_get_callback(entity, _context, _options) do entity end #---------------------------- # update_version/3 #---------------------------- def update_version(%{vsn: 1.0} = entity, _context, _options) do entity |> put_in([Access.key(:status)], :active) |> put_in([Access.key(:vsn)], 1.1) |> Map.delete(:cached_details) end def update_version(%{vsn: 1.1} = entity, _context, _options) do entity end end
29.333333
100
0.543182
7916fdcf4aaff1afd458a6a9c9a7a8b5b3af67b1
1,471
ex
Elixir
lib/config_smuggler/encoder.ex
appcues/config_smuggler
c420263591c2991f982dfaece6cae1b180711db1
[ "MIT" ]
11
2019-02-28T22:47:24.000Z
2021-11-11T19:53:17.000Z
lib/config_smuggler/encoder.ex
appcues/config_smuggler
c420263591c2991f982dfaece6cae1b180711db1
[ "MIT" ]
1
2021-06-21T16:22:28.000Z
2021-06-21T16:22:28.000Z
lib/config_smuggler/encoder.ex
appcues/config_smuggler
c420263591c2991f982dfaece6cae1b180711db1
[ "MIT" ]
null
null
null
defmodule ConfigSmuggler.Encoder do @moduledoc false @doc ~S""" Returns a list of encoded key/value tuples. """ @spec encode_app_path_and_opts(atom, [atom], Keyword.t()) :: [{ConfigSmuggler.encoded_key(), ConfigSmuggler.encoded_value()}] def encode_app_path_and_opts(app, path, opts) do if is_keyword_list?(opts) do Enum.flat_map(opts, fn {key, value} -> case value do [{_k, _v} | _] -> encode_app_path_and_opts(app, path ++ [key], value) _ -> [{encode_key([app] ++ path ++ [key]), encode_value(value)}] end end) else [{encode_key([app | path]), encode_value(opts)}] end end defp is_keyword_list?([]), do: true defp is_keyword_list?([{k, _v} | rest]) when is_atom(k) do is_keyword_list?(rest) end defp is_keyword_list?(_), do: false @doc ~S""" Returns an encoded key using the given parts (atoms and modules). iex> ConfigSmuggler.Encoder.encode_key([:api, Api.Repo, :priv]) "elixir-api-Api.Repo-priv" """ @spec encode_key([atom]) :: ConfigSmuggler.encoded_key() def encode_key(parts) do "elixir-" <> (parts |> Enum.map(&(&1 |> to_string |> String.replace_leading("Elixir.", ""))) |> Enum.join("-")) end @doc ~S""" Returns an encoded value. """ @spec encode_value(any) :: ConfigSmuggler.encoded_value() def encode_value(value) do inspect(value, limit: :infinity, printable_limit: :infinity) end end
27.754717
79
0.629504
79170c1849984948fe8cebe65393efeb552ad6be
9,251
ex
Elixir
lib/parent/functional.ex
QuinnWilton/parent
7c4c983a38c25a409e8fb61c57daf8a8c083a275
[ "MIT" ]
null
null
null
lib/parent/functional.ex
QuinnWilton/parent
7c4c983a38c25a409e8fb61c57daf8a8c083a275
[ "MIT" ]
null
null
null
lib/parent/functional.ex
QuinnWilton/parent
7c4c983a38c25a409e8fb61c57daf8a8c083a275
[ "MIT" ]
null
null
null
defmodule Parent.Functional do @moduledoc false alias Parent.Registry use Parent.PublicTypes @opaque t :: %{registry: Registry.t()} @type on_handle_message :: {child_exit_message, t} | :error | :ignore @type child_exit_message :: {:EXIT, pid, id, child_meta, reason :: term} @spec initialize() :: t def initialize() do Process.flag(:trap_exit, true) %{registry: Registry.new()} end @spec entries(t) :: [child] def entries(state) do state.registry |> Registry.entries() |> Enum.map(fn {pid, process} -> {process.id, pid, process.data.meta} end) end @spec supervisor_which_children(t) :: [{term(), pid(), :worker, [module()] | :dynamic}] def supervisor_which_children(state) do Enum.map(Registry.entries(state.registry), fn {pid, process} -> {process.id, pid, process.data.type, process.data.modules} end) end @spec supervisor_count_children(t) :: [ specs: non_neg_integer, active: non_neg_integer, supervisors: non_neg_integer, workers: non_neg_integer ] def supervisor_count_children(state) do Enum.reduce( Registry.entries(state.registry), %{specs: 0, active: 0, supervisors: 0, workers: 0}, fn {_pid, process}, acc -> %{ acc | specs: acc.specs + 1, active: acc.active + 1, workers: acc.workers + if(process.data.type == :worker, do: 1, else: 0), supervisors: acc.supervisors + if(process.data.type == :supervisor, do: 1, else: 0) } end ) |> Map.to_list() end @spec size(t) :: non_neg_integer def size(state), do: Registry.size(state.registry) @spec id(t, pid) :: {:ok, id} | :error def id(state, pid), do: Registry.id(state.registry, pid) @spec pid(t, id) :: {:ok, pid} | :error def pid(state, id), do: Registry.pid(state.registry, id) @spec meta(t, id) :: {:ok, child_meta} | :error def meta(state, id) do with {:ok, pid} <- Registry.pid(state.registry, id), {:ok, data} <- Registry.data(state.registry, pid), do: {:ok, data.meta} end @spec update_meta(t, id, (child_meta -> child_meta)) :: {:ok, t} | :error def update_meta(state, id, updater) do with {:ok, pid} <- Registry.pid(state.registry, id), {:ok, updated_registry} <- Registry.update(state.registry, pid, &update_in(&1.meta, updater)), do: {:ok, %{state | registry: updated_registry}} end @spec start_child(t, child_spec | module | {module, term}) :: {:ok, pid, t} | term def start_child(state, child_spec) do full_child_spec = expand_child_spec(child_spec) with {:ok, pid} <- start_child_process(full_child_spec.start) do timer_ref = case full_child_spec.timeout do :infinity -> nil timeout -> Process.send_after(self(), {__MODULE__, :child_timeout, pid}, timeout) end data = %{ shutdown: full_child_spec.shutdown, meta: full_child_spec.meta, type: full_child_spec.type, modules: full_child_spec.modules, timer_ref: timer_ref } {:ok, pid, update_in(state.registry, &Registry.register(&1, full_child_spec.id, pid, data))} end end @spec shutdown_child(t, id) :: t def shutdown_child(state, child_id) do case Registry.pid(state.registry, child_id) do :error -> raise "trying to terminate an unknown child" {:ok, pid} -> {:ok, data} = Registry.data(state.registry, pid) shutdown = data.shutdown exit_reason = if shutdown == :brutal_kill, do: :kill, else: :shutdown wait_time = if shutdown == :brutal_kill, do: :infinity, else: shutdown Process.exit(pid, exit_reason) receive do {:EXIT, ^pid, _reason} -> :ok after wait_time -> Process.exit(pid, :kill) receive do {:EXIT, ^pid, _reason} -> :ok end end {:ok, _id, data, registry} = Registry.pop(state.registry, pid) kill_timer(data.timer_ref, pid) %{state | registry: registry} end end @spec handle_message(t, term) :: on_handle_message def handle_message(state, {:EXIT, pid, reason}) do with {:ok, id, data, registry} <- Registry.pop(state.registry, pid) do kill_timer(data.timer_ref, pid) {{:EXIT, pid, id, data.meta, reason}, %{state | registry: registry}} end end def handle_message(state, {__MODULE__, :child_timeout, pid}) do case Registry.pop(state.registry, pid) do {:ok, id, data, registry} -> Process.exit(pid, :kill) receive do {:EXIT, ^pid, _reason} -> :ok end {{:EXIT, pid, id, data.meta, :timeout}, %{state | registry: registry}} :error -> # The timeout has occurred, just after the child terminated. Since this # is still an internal message, we'll just ignore it. :ignore end end def handle_message(_state, _other), do: :error @spec await_termination(t, id, non_neg_integer() | :infinity) :: {{pid, child_meta, reason :: term}, t} | :timeout def await_termination(state, child_id, timeout) do case Registry.pid(state.registry, child_id) do :error -> raise "unknown child" {:ok, pid} -> receive do {:EXIT, ^pid, reason} -> with {:ok, ^child_id, data, registry} <- Registry.pop(state.registry, pid) do kill_timer(data.timer_ref, pid) {{pid, data.meta, reason}, %{state | registry: registry}} end after timeout -> :timeout end end end @spec shutdown_all(t, term) :: t def shutdown_all(state, reason) do state = terminate_all_children(state, shutdown_reason(reason)) # The registry now contains only children which refused to die. These # children are already forcefully terminated, so now we just have to # wait for the :EXIT message. Enum.each(Registry.entries(state.registry), fn {pid, _data} -> receive do {:EXIT, ^pid, _reason} -> :ok end end) %{state | registry: Registry.new()} end defp terminate_all_children(state, reason) do pids_and_specs = state.registry |> Registry.entries() |> Enum.sort_by(fn {_pid, process} -> process.data.shutdown end) # Kill all timeout timers first, because we don't want timeout to interfere with the shutdown logic. Enum.each(pids_and_specs, fn {pid, process} -> kill_timer(process.data.timer_ref, pid) end) Enum.each(pids_and_specs, &stop_process(&1, reason)) await_terminated_children(state, pids_and_specs, :erlang.monotonic_time(:millisecond)) end defp stop_process({pid, %{data: %{shutdown: :brutal_kill}}}, _), do: Process.exit(pid, :kill) defp stop_process({pid, _spec}, reason), do: Process.exit(pid, reason) defp await_terminated_children(state, [], _start_time), do: state defp await_terminated_children(state, [{pid, process} | other], start_time) do receive do {:EXIT, ^pid, _reason} -> {:ok, _id, _data, registry} = Registry.pop(state.registry, pid) state = %{state | registry: registry} await_terminated_children(state, other, start_time) after wait_time(process.data.shutdown, start_time) -> # Brutally killing the child which refuses to stop, but we won't wait # for the exit signal now. We'll focus on other children first, and # then wait for the ones we had to forcefully kill in the next pass. Process.exit(pid, :kill) await_terminated_children(state, other, start_time) end end defp wait_time(:infinity, _), do: :infinity defp wait_time(:brutal_kill, _), do: :infinity defp wait_time(shutdown, start_time) when is_integer(shutdown), do: max(shutdown - (:erlang.monotonic_time(:millisecond) - start_time), 0) defp shutdown_reason(:normal), do: :shutdown defp shutdown_reason(other), do: other @default_spec %{meta: nil, timeout: :infinity} defp expand_child_spec(mod) when is_atom(mod), do: expand_child_spec({mod, nil}) defp expand_child_spec({mod, arg}), do: expand_child_spec(mod.child_spec(arg)) defp expand_child_spec(%{} = child_spec) do @default_spec |> Map.merge(default_type_and_shutdown_spec(Map.get(child_spec, :type, :worker))) |> Map.put(:modules, default_modules(child_spec.start)) |> Map.merge(child_spec) end defp expand_child_spec(_other), do: raise("invalid child_spec") defp default_type_and_shutdown_spec(:worker), do: %{type: :worker, shutdown: :timer.seconds(5)} defp default_type_and_shutdown_spec(:supervisor), do: %{type: :supervisor, shutdown: :infinity} defp default_modules({mod, _fun, _args}), do: [mod] defp default_modules(fun) when is_function(fun), do: [fun |> :erlang.fun_info() |> Keyword.fetch!(:module)] defp start_child_process({mod, fun, args}), do: apply(mod, fun, args) defp start_child_process(fun) when is_function(fun, 0), do: fun.() defp kill_timer(nil, _pid), do: :ok defp kill_timer(timer_ref, pid) do Process.cancel_timer(timer_ref) receive do {__MODULE__, :child_timeout, ^pid} -> :ok after 0 -> :ok end end end
33.518116
104
0.637228
79171039d82df0b35871104aa7d7cea426906065
1,347
ex
Elixir
lib/atom_tweaks_web/sliding_session_timeout.ex
amymariparker/atom-style-tweaks
9f17b626e4a527d17d2da85ac575029b52fb6a25
[ "MIT" ]
14
2017-01-08T14:51:25.000Z
2022-03-14T09:23:17.000Z
lib/atom_tweaks_web/sliding_session_timeout.ex
amymariparker/atom-style-tweaks
9f17b626e4a527d17d2da85ac575029b52fb6a25
[ "MIT" ]
654
2017-05-23T22:55:21.000Z
2022-03-30T09:02:25.000Z
lib/atom_tweaks_web/sliding_session_timeout.ex
amymariparker/atom-style-tweaks
9f17b626e4a527d17d2da85ac575029b52fb6a25
[ "MIT" ]
4
2019-07-10T23:09:25.000Z
2020-02-09T12:14:00.000Z
defmodule AtomTweaksWeb.SlidingSessionTimeout do @moduledoc """ Times out the session after a period of inactivity. The default timeout is one hour. This can be configured in the application config where the timeout is given as a number of seconds. ``` config :my_app, AtomTweaks.SlidingSessionTimeout, timeout: 1_234 ``` """ import Plug.Conn alias Phoenix.Controller require Logger def init, do: init([]) def init(nil), do: init([]) def init(opts) do defaults = init_defaults() Keyword.merge(defaults, opts) end def call(conn, opts) do timeout_at = get_session(conn, :timeout_at) if timeout_at && now() > timeout_at do conn |> logout_user |> Controller.redirect(to: "/auth?from=#{conn.request_path}") |> halt else new_timeout = calculate_timeout(opts[:timeout]) put_session(conn, :timeout_at, new_timeout) end end defp get_app, do: Application.get_application(__MODULE__) defp init_defaults do Keyword.merge([timeout: 3_600], Application.get_env(get_app(), __MODULE__) || []) end defp logout_user(conn) do conn |> clear_session |> configure_session([:renew]) |> assign(:timed_out?, true) end defp now, do: DateTime.to_unix(DateTime.utc_now()) defp calculate_timeout(timeout), do: now() + timeout end
22.830508
93
0.681514
79173da8c0f348b5d8cbd0b29f6ac76c950e4c07
513
ex
Elixir
lib/postoffice/messaging/topic.ex
IgorRodriguez/postoffice
9012193e0780f2403bd3db90b8f6258656780fee
[ "Apache-2.0" ]
null
null
null
lib/postoffice/messaging/topic.ex
IgorRodriguez/postoffice
9012193e0780f2403bd3db90b8f6258656780fee
[ "Apache-2.0" ]
null
null
null
lib/postoffice/messaging/topic.ex
IgorRodriguez/postoffice
9012193e0780f2403bd3db90b8f6258656780fee
[ "Apache-2.0" ]
null
null
null
defmodule Postoffice.Messaging.Topic do use Ecto.Schema import Ecto.Changeset schema "topics" do field :name, :string, null: false field :origin_host, :string, null: true has_many :consumers, Postoffice.Messaging.Publisher has_many :messages, Postoffice.Messaging.Message timestamps() end @doc false def changeset(message, attrs) do message |> cast(attrs, [:name, :origin_host]) |> validate_required([:name, :origin_host]) |> unique_constraint(:name) end end
22.304348
55
0.699805
79177ad84962b5feae3a60b1e1dd50ebd8255632
3,002
ex
Elixir
lib/ja_serializer/builder/pagination_links.ex
gamesrol/ja_serializer
c48d8fb0fb742bd96c30acd40e24f7395f25af2c
[ "Apache-2.0" ]
null
null
null
lib/ja_serializer/builder/pagination_links.ex
gamesrol/ja_serializer
c48d8fb0fb742bd96c30acd40e24f7395f25af2c
[ "Apache-2.0" ]
null
null
null
lib/ja_serializer/builder/pagination_links.ex
gamesrol/ja_serializer
c48d8fb0fb742bd96c30acd40e24f7395f25af2c
[ "Apache-2.0" ]
null
null
null
defmodule JaSerializer.Builder.PaginationLinks do import JaSerializer.Formatter.Utils, only: [format_key: 1] @page_number_origin Application.get_env(:ja_serializer, :page_number_origin, 1) @moduledoc """ Builds JSON-API spec pagination links. Pass in a map with the necessary data: JaSerializer.Builder.PaginationLinks.build(%{ number: 1, size: 20, total: 5, base_url: "https://example.com" }, Plug.Conn%{} ) Would produce a list of links such as: [ self: "https://example.com/posts?page[number]=2&page[size]=10", next: "https://example.com/posts?page[number]=3&page[size]=10", first: "https://example.com/posts?page[number]=1&page[size]=10", last: "https://example.com/posts?page[number]=20&page[size]=10" ] The param names can be customized on your application's config: config :ja_serializer, page_key: "page", page_base_url: "https://example.com/posts" page_number_key: "offset", page_size_key: "limit", page_number_origin: 0, The defaults are: * `page_key` : `"page"` * `page_base_url`: `nil` * `page_number_key`: `"number"` * `page_size_key` : `"size"` * `page_number_origin`: `1` Please note that if the value for `page_number_origin` is changed JaSerializer will have to be recompiled: $ mix deps.clean ja_serializer $ mix deps.get ja_serializer """ # @spec build(data, conn) :: map, map def build(data, conn) do base = base_url(conn, data[:base_url]) data |> links() |> Enum.into(%{}, fn {link, number} -> {link, page_url(number, base, data.size, conn.query_params)} end) end defp links(%{number: @page_number_origin, total: 1}), do: [self: @page_number_origin] defp links(%{number: @page_number_origin, total: 0}), do: [self: @page_number_origin] defp links(%{number: @page_number_origin, total: t}), do: [self: @page_number_origin, next: 2, last: t] defp links(%{number: total, total: total}), do: [self: total, first: @page_number_origin, prev: total - 1] defp links(%{number: number, total: total}), do: [self: number, first: @page_number_origin, prev: number - 1, next: number + 1, last: total] defp page_url(number, base, size, orginal_params) do params = orginal_params |> Map.merge(%{page_key() => %{page_number_key() => number, page_size_key() => size}}) |> Plug.Conn.Query.encode "#{base}?#{params}" end defp page_key do Application.get_env(:ja_serializer, :page_key, format_key("page")) end defp page_number_key do Application.get_env(:ja_serializer, :page_number_key, format_key("number")) end defp page_size_key do Application.get_env(:ja_serializer, :page_size_key, format_key("size")) end defp base_url(conn, nil) do Application.get_env(:ja_serializer, :page_base_url, conn.request_path) end defp base_url(_conn, url), do: url end
30.02
108
0.651899
791799b873dec185a1ddc9327eb1c082020f642d
3,037
ex
Elixir
clients/sheets/lib/google_api/sheets/v4/model/grid_range.ex
pojiro/elixir-google-api
928496a017d3875a1929c6809d9221d79404b910
[ "Apache-2.0" ]
1
2021-12-20T03:40:53.000Z
2021-12-20T03:40:53.000Z
clients/sheets/lib/google_api/sheets/v4/model/grid_range.ex
pojiro/elixir-google-api
928496a017d3875a1929c6809d9221d79404b910
[ "Apache-2.0" ]
1
2020-08-18T00:11:23.000Z
2020-08-18T00:44:16.000Z
clients/sheets/lib/google_api/sheets/v4/model/grid_range.ex
pojiro/elixir-google-api
928496a017d3875a1929c6809d9221d79404b910
[ "Apache-2.0" ]
null
null
null
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This file is auto generated by the elixir code generator program. # Do not edit this file manually. defmodule GoogleApi.Sheets.V4.Model.GridRange do @moduledoc """ A range on a sheet. All indexes are zero-based. Indexes are half open, i.e. the start index is inclusive and the end index is exclusive -- [start_index, end_index). Missing indexes indicate the range is unbounded on that side. For example, if `"Sheet1"` is sheet ID 0, then: `Sheet1!A1:A1 == sheet_id: 0, start_row_index: 0, end_row_index: 1, start_column_index: 0, end_column_index: 1` `Sheet1!A3:B4 == sheet_id: 0, start_row_index: 2, end_row_index: 4, start_column_index: 0, end_column_index: 2` `Sheet1!A:B == sheet_id: 0, start_column_index: 0, end_column_index: 2` `Sheet1!A5:B == sheet_id: 0, start_row_index: 4, start_column_index: 0, end_column_index: 2` `Sheet1 == sheet_id:0` The start index must always be less than or equal to the end index. If the start index equals the end index, then the range is empty. Empty ranges are typically not meaningful and are usually rendered in the UI as `#REF!`. ## Attributes * `endColumnIndex` (*type:* `integer()`, *default:* `nil`) - The end column (exclusive) of the range, or not set if unbounded. * `endRowIndex` (*type:* `integer()`, *default:* `nil`) - The end row (exclusive) of the range, or not set if unbounded. * `sheetId` (*type:* `integer()`, *default:* `nil`) - The sheet this range is on. * `startColumnIndex` (*type:* `integer()`, *default:* `nil`) - The start column (inclusive) of the range, or not set if unbounded. * `startRowIndex` (*type:* `integer()`, *default:* `nil`) - The start row (inclusive) of the range, or not set if unbounded. """ use GoogleApi.Gax.ModelBase @type t :: %__MODULE__{ :endColumnIndex => integer() | nil, :endRowIndex => integer() | nil, :sheetId => integer() | nil, :startColumnIndex => integer() | nil, :startRowIndex => integer() | nil } field(:endColumnIndex) field(:endRowIndex) field(:sheetId) field(:startColumnIndex) field(:startRowIndex) end defimpl Poison.Decoder, for: GoogleApi.Sheets.V4.Model.GridRange do def decode(value, options) do GoogleApi.Sheets.V4.Model.GridRange.decode(value, options) end end defimpl Poison.Encoder, for: GoogleApi.Sheets.V4.Model.GridRange do def encode(value, options) do GoogleApi.Gax.ModelBase.encode(value, options) end end
51.474576
911
0.708923
7917c5f789e72b012c80eb0c9e8c1b9ca016bf6f
1,675
ex
Elixir
playground_project/lib/crud_tdd_web/router.ex
JohnBortotti/learning-elixir
54ce9c50904e809065d0321d51367cea7a5b2bf8
[ "MIT" ]
null
null
null
playground_project/lib/crud_tdd_web/router.ex
JohnBortotti/learning-elixir
54ce9c50904e809065d0321d51367cea7a5b2bf8
[ "MIT" ]
null
null
null
playground_project/lib/crud_tdd_web/router.ex
JohnBortotti/learning-elixir
54ce9c50904e809065d0321d51367cea7a5b2bf8
[ "MIT" ]
null
null
null
defmodule CrudTddWeb.Router do use CrudTddWeb, :router pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_flash plug :protect_from_forgery plug :put_secure_browser_headers end pipeline :api do plug :accepts, ["json"] end scope "/", CrudTddWeb do pipe_through :api get "/games", GamesController, :index post "/games", GamesController, :create get "/games/:id", GamesController, :show put "/games/:id", GamesController, :update delete "/games/:id", GamesController, :delete end scope "/", CrudTddWeb do pipe_through :browser get "/", PageController, :index get "/users", UserController, :index get "/users/new", UserController, :new post "/users", UserController, :create get "/users/:id", UserController, :show get "/users/:id/edit", UserController, :edit delete "/users/:id", UserController, :delete put "/users/:id", UserController, :update end # Other scopes may use custom stacks. # scope "/api", CrudTddWeb do # pipe_through :api # end # Enables LiveDashboard only for development # # If you want to use the LiveDashboard in production, you should put # it behind authentication and allow only admins to access it. # If your application does not have an admins-only section yet, # you can use Plug.BasicAuth to set up some basic authentication # as long as you are also using SSL (which you should anyway). if Mix.env() in [:dev, :test] do import Phoenix.LiveDashboard.Router scope "/" do pipe_through :browser live_dashboard "/dashboard", metrics: CrudTddWeb.Telemetry end end end
27.916667
70
0.683582
7917cf086791910d2a1c466ad138b9448a678695
253
ex
Elixir
lib/plug_guard.ex
foxzool/plug_guard
a812d4b4c25516e89b1fe8b31f0a4fd5d4874c0c
[ "MIT" ]
null
null
null
lib/plug_guard.ex
foxzool/plug_guard
a812d4b4c25516e89b1fe8b31f0a4fd5d4874c0c
[ "MIT" ]
null
null
null
lib/plug_guard.ex
foxzool/plug_guard
a812d4b4c25516e89b1fe8b31f0a4fd5d4874c0c
[ "MIT" ]
null
null
null
defmodule PlugGuard do @default_path "/oauth" import Plug.Conn use Plug.Router plug Plug.Logger plug :match plug :dispatch post @default_path <> "/token" do conn |> PlugGuard.Server.call |> send_resp(200, "hello") end end
14.882353
35
0.664032
7918036a61e2d8f6f2893efcbbfd7fe3d92b087c
84
exs
Elixir
test/contento_web/views/layout_view_test.exs
jackmarchant/contento-fork
7da622f27fc2003583bdd9a5e2f76b8a16bf852a
[ "MIT" ]
null
null
null
test/contento_web/views/layout_view_test.exs
jackmarchant/contento-fork
7da622f27fc2003583bdd9a5e2f76b8a16bf852a
[ "MIT" ]
null
null
null
test/contento_web/views/layout_view_test.exs
jackmarchant/contento-fork
7da622f27fc2003583bdd9a5e2f76b8a16bf852a
[ "MIT" ]
1
2020-11-21T20:12:01.000Z
2020-11-21T20:12:01.000Z
defmodule ContentoWeb.LayoutViewTest do use ContentoWeb.ConnCase, async: true end
21
39
0.833333
79181a49385ae756f2f2248411fe9c9fa8f66fda
469
ex
Elixir
lib/kazan/errors.ex
chazsconi/kazan
da42cef9686584ed7b46428780d099ce77dae3ea
[ "MIT" ]
null
null
null
lib/kazan/errors.ex
chazsconi/kazan
da42cef9686584ed7b46428780d099ce77dae3ea
[ "MIT" ]
null
null
null
lib/kazan/errors.ex
chazsconi/kazan
da42cef9686584ed7b46428780d099ce77dae3ea
[ "MIT" ]
null
null
null
defmodule Kazan.RemoteError do @moduledoc """ Raised when we get an error from a Kube server. """ defexception [:reason] def message(error) do "Server responded with #{inspect error.reason}" end end defmodule Kazan.BuildRequestError do @moduledoc """ Raised when we get an error from a Kube server. """ defexception [:reason, :operation] def message(error) do "Error when building #{error.operation} request: #{error.reason}" end end
21.318182
69
0.701493
79182125b3b4f4733682796fd89acc76f40ff1f8
7,754
ex
Elixir
lib/docusign/api/power_forms.ex
gaslight/docusign_elixir
d9d88d53dd85d32a39d537bade9db28d779414e6
[ "MIT" ]
4
2020-12-21T12:50:13.000Z
2022-01-12T16:50:43.000Z
lib/docusign/api/power_forms.ex
gaslight/docusign_elixir
d9d88d53dd85d32a39d537bade9db28d779414e6
[ "MIT" ]
12
2018-09-18T15:26:34.000Z
2019-09-28T15:29:39.000Z
lib/docusign/api/power_forms.ex
gaslight/docusign_elixir
d9d88d53dd85d32a39d537bade9db28d779414e6
[ "MIT" ]
15
2020-04-29T21:50:16.000Z
2022-02-11T18:01:51.000Z
# NOTE: This class is auto generated by the swagger code generator program. # https://github.com/swagger-api/swagger-codegen.git # Do not edit the class manually. defmodule DocuSign.Api.PowerForms do @moduledoc """ API calls for all endpoints tagged `PowerForms`. """ alias DocuSign.Connection import DocuSign.RequestBuilder @doc """ Delete a PowerForm. ## Parameters - connection (DocuSign.Connection): Connection to server - account_id (String.t): The external account number (int) or account ID Guid. - power_form_id (String.t): - opts (KeywordList): [optional] Optional parameters ## Returns {:ok, %{}} on success {:error, info} on failure """ @spec power_forms_delete_power_form(Tesla.Env.client(), String.t(), String.t(), keyword()) :: {:ok, nil} | {:error, Tesla.Env.t()} def power_forms_delete_power_form(connection, account_id, power_form_id, _opts \\ []) do %{} |> method(:delete) |> url("/v2/accounts/#{account_id}/powerforms/#{power_form_id}") |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> decode(false) end @doc """ Deletes one or more PowerForms ## Parameters - connection (DocuSign.Connection): Connection to server - account_id (String.t): The external account number (int) or account ID Guid. - opts (KeywordList): [optional] Optional parameters - :power_forms_request (PowerFormsRequest): ## Returns {:ok, %DocuSign.Model.PowerFormsResponse{}} on success {:error, info} on failure """ @spec power_forms_delete_power_forms_list(Tesla.Env.client(), String.t(), keyword()) :: {:ok, DocuSign.Model.PowerFormsResponse.t()} | {:error, Tesla.Env.t()} def power_forms_delete_power_forms_list(connection, account_id, opts \\ []) do optional_params = %{ powerFormsRequest: :body } %{} |> method(:delete) |> url("/v2/accounts/#{account_id}/powerforms") |> add_optional_params(optional_params, opts) |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> decode(%DocuSign.Model.PowerFormsResponse{}) end @doc """ Returns a single PowerForm. ## Parameters - connection (DocuSign.Connection): Connection to server - account_id (String.t): The external account number (int) or account ID Guid. - power_form_id (String.t): - opts (KeywordList): [optional] Optional parameters ## Returns {:ok, %DocuSign.Model.PowerForms{}} on success {:error, info} on failure """ @spec power_forms_get_power_form(Tesla.Env.client(), String.t(), String.t(), keyword()) :: {:ok, DocuSign.Model.PowerForms.t()} | {:error, Tesla.Env.t()} def power_forms_get_power_form(connection, account_id, power_form_id, _opts \\ []) do %{} |> method(:get) |> url("/v2/accounts/#{account_id}/powerforms/#{power_form_id}") |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> decode(%DocuSign.Model.PowerForms{}) end @doc """ Returns the list of PowerForms available to the user. ## Parameters - connection (DocuSign.Connection): Connection to server - account_id (String.t): The external account number (int) or account ID Guid. - opts (KeywordList): [optional] Optional parameters - :from_date (String.t): Start of the search date range. Only returns templates created on or after this date/time. If no value is specified, there is no limit on the earliest date created. - :order (String.t): An optional value that sets the direction order used to sort the item list. Valid values are: * asc &#x3D; ascending sort order * desc &#x3D; descending sort order - :order_by (String.t): An optional value that sets the file attribute used to sort the item list. Valid values are: * modified * name - :to_date (String.t): End of the search date range. Only returns templates created up to this date/time. If no value is provided, this defaults to the current date. ## Returns {:ok, %DocuSign.Model.PowerFormsResponse{}} on success {:error, info} on failure """ @spec power_forms_get_power_forms_list(Tesla.Env.client(), String.t(), keyword()) :: {:ok, DocuSign.Model.PowerFormsResponse.t()} | {:error, Tesla.Env.t()} def power_forms_get_power_forms_list(connection, account_id, opts \\ []) do optional_params = %{ from_date: :query, order: :query, order_by: :query, to_date: :query } %{} |> method(:get) |> url("/v2/accounts/#{account_id}/powerforms") |> add_optional_params(optional_params, opts) |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> decode(%DocuSign.Model.PowerFormsResponse{}) end @doc """ Returns the list of PowerForms available to the user. ## Parameters - connection (DocuSign.Connection): Connection to server - account_id (String.t): The external account number (int) or account ID Guid. - opts (KeywordList): [optional] Optional parameters - :start_position (String.t): The position within the total result set from which to start returning values. The value **thumbnail** may be used to return the page image. ## Returns {:ok, %DocuSign.Model.PowerFormSendersResponse{}} on success {:error, info} on failure """ @spec power_forms_get_power_forms_senders(Tesla.Env.client(), String.t(), keyword()) :: {:ok, DocuSign.Model.PowerFormSendersResponse.t()} | {:error, Tesla.Env.t()} def power_forms_get_power_forms_senders(connection, account_id, opts \\ []) do optional_params = %{ start_position: :query } %{} |> method(:get) |> url("/v2/accounts/#{account_id}/powerforms/senders") |> add_optional_params(optional_params, opts) |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> decode(%DocuSign.Model.PowerFormSendersResponse{}) end @doc """ Creates a new PowerForm. ## Parameters - connection (DocuSign.Connection): Connection to server - account_id (String.t): The external account number (int) or account ID Guid. - opts (KeywordList): [optional] Optional parameters - :power_forms (PowerForms): ## Returns {:ok, %DocuSign.Model.PowerForms{}} on success {:error, info} on failure """ @spec power_forms_post_power_form(Tesla.Env.client(), String.t(), keyword()) :: {:ok, DocuSign.Model.PowerForms.t()} | {:error, Tesla.Env.t()} def power_forms_post_power_form(connection, account_id, opts \\ []) do optional_params = %{ PowerForms: :body } %{} |> method(:post) |> url("/v2/accounts/#{account_id}/powerforms") |> add_optional_params(optional_params, opts) |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> decode(%DocuSign.Model.PowerForms{}) end @doc """ Creates a new PowerForm. ## Parameters - connection (DocuSign.Connection): Connection to server - account_id (String.t): The external account number (int) or account ID Guid. - power_form_id (String.t): - opts (KeywordList): [optional] Optional parameters - :power_forms (PowerForms): ## Returns {:ok, %DocuSign.Model.PowerForms{}} on success {:error, info} on failure """ @spec power_forms_put_power_form(Tesla.Env.client(), String.t(), String.t(), keyword()) :: {:ok, DocuSign.Model.PowerForms.t()} | {:error, Tesla.Env.t()} def power_forms_put_power_form(connection, account_id, power_form_id, opts \\ []) do optional_params = %{ PowerForms: :body } %{} |> method(:put) |> url("/v2/accounts/#{account_id}/powerforms/#{power_form_id}") |> add_optional_params(optional_params, opts) |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> decode(%DocuSign.Model.PowerForms{}) end end
33.136752
193
0.668429
7918327e3f9a62cc922ead5a6b372fc4469c715e
2,137
exs
Elixir
test/lib/timber/utils/http_event_test.exs
montebrown/timber-elixir
1e177cc426422be3617479143038f5882037752f
[ "0BSD" ]
null
null
null
test/lib/timber/utils/http_event_test.exs
montebrown/timber-elixir
1e177cc426422be3617479143038f5882037752f
[ "0BSD" ]
null
null
null
test/lib/timber/utils/http_event_test.exs
montebrown/timber-elixir
1e177cc426422be3617479143038f5882037752f
[ "0BSD" ]
null
null
null
defmodule Timber.Utils.HTTPEventsTest do use Timber.TestCase alias Timber.Utils.HTTPEvents describe "Timber.Utils.HTTPEvents.normalize_body/1" do test "nil" do assert HTTPEvents.normalize_body(nil) == nil end test "blank string" do assert HTTPEvents.normalize_body("") == "" end test "blank map" do assert HTTPEvents.normalize_body(%{}) == "{}" end test "blank list" do assert HTTPEvents.normalize_body([]) == "" end test "iodata" do assert HTTPEvents.normalize_body(["a", "b", ["c", "d"]]) == "abcd" end test "exceeds length" do body = String.duplicate("a", 2049) assert HTTPEvents.normalize_body(body) == "#{String.duplicate("a", 2033)} (truncated)" end end describe "Timber.Utils.HTTPEvents.normalize_headers/1" do test "nil" do assert HTTPEvents.normalize_headers(nil) == nil end test "blank map" do assert HTTPEvents.normalize_headers(%{}) == %{} end test "real map" do assert HTTPEvents.normalize_headers(%{"key" => "value"}) == %{"key" => "value"} end test "blank list" do assert HTTPEvents.normalize_headers([]) == %{} end test "array value" do assert HTTPEvents.normalize_headers([{"key", ["value1", "value2"]}]) == %{ "key" => "value1,value2" } end test "authorization header" do assert HTTPEvents.normalize_headers([{"Authorization", "value"}]) == %{ "authorization" => "[sanitized]" } end test "x-amz-security-token header" do assert HTTPEvents.normalize_headers([{"x-amz-security-token", "value"}]) == %{ "x-amz-security-token" => "[sanitized]" } end test "custom sensitive header" do assert HTTPEvents.normalize_headers([{"Sensitive-Key", "value"}]) == %{ "sensitive-key" => "[sanitized]" } end test "headers list" do assert HTTPEvents.normalize_headers([{"This-IS-my-HEADER", "value"}]) == %{ "this-is-my-header" => "value" } end end end
26.382716
92
0.581657
791839136e923fa9e253d5906e8288c607841ead
231
ex
Elixir
lib/hologram/compiler/module_def_aggregators/function_definition.ex
gregjohnsonsaltaire/hologram
aa8e9ea0d599def864c263cc37cc8ee31f02ac4a
[ "MIT" ]
40
2022-01-19T20:27:36.000Z
2022-03-31T18:17:41.000Z
lib/hologram/compiler/module_def_aggregators/function_definition.ex
gregjohnsonsaltaire/hologram
aa8e9ea0d599def864c263cc37cc8ee31f02ac4a
[ "MIT" ]
42
2022-02-03T22:52:43.000Z
2022-03-26T20:57:32.000Z
lib/hologram/compiler/module_def_aggregators/function_definition.ex
gregjohnsonsaltaire/hologram
aa8e9ea0d599def864c263cc37cc8ee31f02ac4a
[ "MIT" ]
3
2022-02-10T04:00:37.000Z
2022-03-08T22:07:45.000Z
alias Hologram.Compiler.IR.FunctionDefinition alias Hologram.Compiler.ModuleDefAggregator defimpl ModuleDefAggregator, for: FunctionDefinition do def aggregate(%{body: body}) do ModuleDefAggregator.aggregate(body) end end
25.666667
55
0.822511
7918832791459b8803385f2ce7d6a9b0ad760c5b
457
exs
Elixir
priv/repo/migrations/20180812115408_create_schedules.exs
ConduitMobileRND/tiktak
6676976749c950ad71dc9caa1333e53aa15d0f7b
[ "MIT" ]
24
2018-12-31T09:44:20.000Z
2022-02-02T03:03:00.000Z
priv/repo/migrations/20180812115408_create_schedules.exs
ConduitMobileRND/tiktak
6676976749c950ad71dc9caa1333e53aa15d0f7b
[ "MIT" ]
null
null
null
priv/repo/migrations/20180812115408_create_schedules.exs
ConduitMobileRND/tiktak
6676976749c950ad71dc9caa1333e53aa15d0f7b
[ "MIT" ]
2
2019-01-23T00:54:45.000Z
2019-05-28T10:14:44.000Z
defmodule TikTak.Repo.Migrations.CreateSchedules do use Ecto.Migration def change do create table(:schedules, primary_key: false) do add :id, :string, primary_key: true add :cron, :string add :date, :string add :delay, :integer add :callback_url, :string add :status, :string add :priority, :integer add :execution_count, :integer end create index(:schedules, [:status, :priority]) end end
25.388889
51
0.656455
791893e788e5fe4ac7dd7677c0ba7bbe91a3f785
2,880
ex
Elixir
day07/lib/day07.ex
bjorng/advent-of-code-2015
d59ac2fc4a93c86ebfe3917d89ebaad3b571bdb6
[ "Apache-2.0" ]
null
null
null
day07/lib/day07.ex
bjorng/advent-of-code-2015
d59ac2fc4a93c86ebfe3917d89ebaad3b571bdb6
[ "Apache-2.0" ]
null
null
null
day07/lib/day07.ex
bjorng/advent-of-code-2015
d59ac2fc4a93c86ebfe3917d89ebaad3b571bdb6
[ "Apache-2.0" ]
null
null
null
defmodule Day07 do use Bitwise def part1(input) do parse(input) |> solve end def part2(input) do input = parse(input) b_value = solve(input)[:a] List.keyreplace(input, :b, 1, {:OR, :b, [b_value, 0]}) |> solve end defp solve(instructions) do instructions |> top_sort_input |> Enum.reduce(%{}, &execute/2) end defp top_sort_input(ops) do op_map = ops |> Enum.map(fn {_, dst, _} = op -> {dst, op} end) |> Map.new ops |> Enum.flat_map(fn {_, dst, sources} -> Enum.filter(sources, &is_atom/1) |> Enum.map(&({&1, dst})) end) |> top_sort |> Enum.map(&(Map.fetch!(op_map, &1))) end defp top_sort(deps) do {counts, successors} = top_sort_1(deps, %{}, %{}) q = Enum.flat_map(counts, fn {key, 0} -> [key]; _ -> [] end) |> :queue.from_list top_sort_2(q, counts, successors, []) end defp top_sort_1([{pred,succ}|deps], counts, successors) do counts = Map.update(counts, pred, 0, &(&1)) counts = Map.update(counts, succ, 1, &(&1 + 1)) successors = Map.update(successors, pred, [succ], &([succ|&1])) top_sort_1(deps, counts, successors) end defp top_sort_1([], counts, successors), do: {counts, successors} defp top_sort_2(q, counts, successors, acc) do case :queue.out(q) do {:empty, _} -> Enum.reverse(acc) {{:value,item}, q} -> {counts, q} = top_sort_update(Map.get(successors, item, []), counts, q) top_sort_2(q, counts, successors, [item|acc]) end end defp top_sort_update([item|items], counts, q) do case Map.get_and_update!(counts, item, &({&1 - 1, &1 - 1})) do {0, counts} -> q = :queue.in(item, q) top_sort_update(items, counts, q) {_, counts} -> top_sort_update(items, counts, q) end end defp top_sort_update([], counts, q), do: {counts, q} defp execute({op, dst, sources}, regs) do op = case op do :AND -> &band/2 :OR -> &bor/2 :NOT -> &((bnot &1) &&& 0xffff) :LSHIFT -> &<<</2 :RSHIFT -> &>>>/2 end sources = Enum.map(sources, fn src when is_integer(src) -> src src when is_atom(src) -> Map.get(regs, src, 0) end) Map.put(regs, dst, apply(op, sources)) end defp parse(input) do input |> Enum.map(fn line -> String.split(line) |> Enum.map(fn token -> case Integer.parse(token) do :error -> String.to_atom(token) {int, _} -> int end end) end) |> Enum.map(fn line -> case line do [:NOT, src, :->, dst] -> {:NOT, dst, [src]} [src, :->, wire] -> {:OR, wire, [src, 0]} [src1, op, src2, :->, dst] -> {op, dst, [src1, src2]} end end) end end
24.615385
79
0.522917
791899015dd7eb649252854bd6f34c1aab0991c3
358
ex
Elixir
lib/sanbase_web/admin/intercom/user_attributes.ex
sitedata/sanbase2
8da5e44a343288fbc41b68668c6c80ae8547d557
[ "MIT" ]
null
null
null
lib/sanbase_web/admin/intercom/user_attributes.ex
sitedata/sanbase2
8da5e44a343288fbc41b68668c6c80ae8547d557
[ "MIT" ]
1
2021-07-24T16:26:03.000Z
2021-07-24T16:26:03.000Z
lib/sanbase_web/admin/intercom/user_attributes.ex
sitedata/sanbase2
8da5e44a343288fbc41b68668c6c80ae8547d557
[ "MIT" ]
null
null
null
defmodule SanbaseWeb.ExAdmin.Intercom.UserAttributes do use ExAdmin.Register register_resource Sanbase.Intercom.UserAttributes do action_items(only: [:show]) index do column(:user, link: true) end show configuration do attributes_table do row(:user, link: true) row(:properties) end end end end
18.842105
55
0.673184
7918b30a050416b6f051ac38a3e6c31e1a88a4e6
1,579
ex
Elixir
clients/discovery/lib/google_api/discovery/v1/model/rest_method_request.ex
mocknen/elixir-google-api
dac4877b5da2694eca6a0b07b3bd0e179e5f3b70
[ "Apache-2.0" ]
null
null
null
clients/discovery/lib/google_api/discovery/v1/model/rest_method_request.ex
mocknen/elixir-google-api
dac4877b5da2694eca6a0b07b3bd0e179e5f3b70
[ "Apache-2.0" ]
null
null
null
clients/discovery/lib/google_api/discovery/v1/model/rest_method_request.ex
mocknen/elixir-google-api
dac4877b5da2694eca6a0b07b3bd0e179e5f3b70
[ "Apache-2.0" ]
null
null
null
# Copyright 2017 Google Inc. # # Licensed under the Apache License, Version 2.0 (the &quot;License&quot;); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an &quot;AS IS&quot; BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This class is auto generated by the swagger code generator program. # https://github.com/swagger-api/swagger-codegen.git # Do not edit the class manually. defmodule GoogleApi.Discovery.V1.Model.RestMethodRequest do @moduledoc """ The schema for the request. ## Attributes - $ref (String.t): Schema ID for the request schema. Defaults to: `null`. - parameterName (String.t): parameter name. Defaults to: `null`. """ use GoogleApi.Gax.ModelBase @type t :: %__MODULE__{ :"$ref" => any(), :parameterName => any() } field(:"$ref") field(:parameterName) end defimpl Poison.Decoder, for: GoogleApi.Discovery.V1.Model.RestMethodRequest do def decode(value, options) do GoogleApi.Discovery.V1.Model.RestMethodRequest.decode(value, options) end end defimpl Poison.Encoder, for: GoogleApi.Discovery.V1.Model.RestMethodRequest do def encode(value, options) do GoogleApi.Gax.ModelBase.encode(value, options) end end
30.960784
78
0.730209
7918bd44ec7458c3028436d779e34c5fbfa646b2
780
ex
Elixir
lib/ash_json_api/controllers/post_to_relationship.ex
TheFirstAvenger/ash_json_api
763b63f6e9a4a1fbb9d83229f085a1e37c41d659
[ "MIT" ]
null
null
null
lib/ash_json_api/controllers/post_to_relationship.ex
TheFirstAvenger/ash_json_api
763b63f6e9a4a1fbb9d83229f085a1e37c41d659
[ "MIT" ]
null
null
null
lib/ash_json_api/controllers/post_to_relationship.ex
TheFirstAvenger/ash_json_api
763b63f6e9a4a1fbb9d83229f085a1e37c41d659
[ "MIT" ]
null
null
null
defmodule AshJsonApi.Controllers.PostToRelationship do @moduledoc false alias AshJsonApi.Controllers.{Helpers, Response} alias AshJsonApi.Request def init(options) do # initialize options options end def call(conn, options) do action = options[:action] api = options[:api] route = options[:route] relationship = Ash.Resource.relationship(options[:resource], route.relationship) resource = relationship.destination conn |> Request.from(resource, action, api, route) |> Helpers.fetch_record_from_path(options[:resource]) |> Helpers.add_to_relationship(relationship.name) |> Helpers.render_or_render_errors(conn, fn request -> Response.render_many_relationship(conn, request, 200, relationship) end) end end
28.888889
84
0.730769
7918c3406bed2dc857e23923fff7bccc6335e32e
4,761
ex
Elixir
lib/codes/codes_w00.ex
badubizzle/icd_code
4c625733f92b7b1d616e272abc3009bb8b916c0c
[ "Apache-2.0" ]
null
null
null
lib/codes/codes_w00.ex
badubizzle/icd_code
4c625733f92b7b1d616e272abc3009bb8b916c0c
[ "Apache-2.0" ]
null
null
null
lib/codes/codes_w00.ex
badubizzle/icd_code
4c625733f92b7b1d616e272abc3009bb8b916c0c
[ "Apache-2.0" ]
null
null
null
defmodule IcdCode.ICDCode.Codes_W00 do alias IcdCode.ICDCode def _W000XXA do %ICDCode{full_code: "W000XXA", category_code: "W00", short_code: "0XXA", full_name: "Fall on same level due to ice and snow, initial encounter", short_name: "Fall on same level due to ice and snow, initial encounter", category_name: "Fall on same level due to ice and snow, initial encounter" } end def _W000XXD do %ICDCode{full_code: "W000XXD", category_code: "W00", short_code: "0XXD", full_name: "Fall on same level due to ice and snow, subsequent encounter", short_name: "Fall on same level due to ice and snow, subsequent encounter", category_name: "Fall on same level due to ice and snow, subsequent encounter" } end def _W000XXS do %ICDCode{full_code: "W000XXS", category_code: "W00", short_code: "0XXS", full_name: "Fall on same level due to ice and snow, sequela", short_name: "Fall on same level due to ice and snow, sequela", category_name: "Fall on same level due to ice and snow, sequela" } end def _W001XXA do %ICDCode{full_code: "W001XXA", category_code: "W00", short_code: "1XXA", full_name: "Fall from stairs and steps due to ice and snow, initial encounter", short_name: "Fall from stairs and steps due to ice and snow, initial encounter", category_name: "Fall from stairs and steps due to ice and snow, initial encounter" } end def _W001XXD do %ICDCode{full_code: "W001XXD", category_code: "W00", short_code: "1XXD", full_name: "Fall from stairs and steps due to ice and snow, subsequent encounter", short_name: "Fall from stairs and steps due to ice and snow, subsequent encounter", category_name: "Fall from stairs and steps due to ice and snow, subsequent encounter" } end def _W001XXS do %ICDCode{full_code: "W001XXS", category_code: "W00", short_code: "1XXS", full_name: "Fall from stairs and steps due to ice and snow, sequela", short_name: "Fall from stairs and steps due to ice and snow, sequela", category_name: "Fall from stairs and steps due to ice and snow, sequela" } end def _W002XXA do %ICDCode{full_code: "W002XXA", category_code: "W00", short_code: "2XXA", full_name: "Other fall from one level to another due to ice and snow, initial encounter", short_name: "Other fall from one level to another due to ice and snow, initial encounter", category_name: "Other fall from one level to another due to ice and snow, initial encounter" } end def _W002XXD do %ICDCode{full_code: "W002XXD", category_code: "W00", short_code: "2XXD", full_name: "Other fall from one level to another due to ice and snow, subsequent encounter", short_name: "Other fall from one level to another due to ice and snow, subsequent encounter", category_name: "Other fall from one level to another due to ice and snow, subsequent encounter" } end def _W002XXS do %ICDCode{full_code: "W002XXS", category_code: "W00", short_code: "2XXS", full_name: "Other fall from one level to another due to ice and snow, sequela", short_name: "Other fall from one level to another due to ice and snow, sequela", category_name: "Other fall from one level to another due to ice and snow, sequela" } end def _W009XXA do %ICDCode{full_code: "W009XXA", category_code: "W00", short_code: "9XXA", full_name: "Unspecified fall due to ice and snow, initial encounter", short_name: "Unspecified fall due to ice and snow, initial encounter", category_name: "Unspecified fall due to ice and snow, initial encounter" } end def _W009XXD do %ICDCode{full_code: "W009XXD", category_code: "W00", short_code: "9XXD", full_name: "Unspecified fall due to ice and snow, subsequent encounter", short_name: "Unspecified fall due to ice and snow, subsequent encounter", category_name: "Unspecified fall due to ice and snow, subsequent encounter" } end def _W009XXS do %ICDCode{full_code: "W009XXS", category_code: "W00", short_code: "9XXS", full_name: "Unspecified fall due to ice and snow, sequela", short_name: "Unspecified fall due to ice and snow, sequela", category_name: "Unspecified fall due to ice and snow, sequela" } end end
41.4
105
0.640622
79190561f5cc2386a3e0a84b0b9bb4e8c34e53a5
372
ex
Elixir
lib/app.ex
aifrak/template-elixir
6d4f346b59cd6df03bf75eb5af879b0af5ded9db
[ "MIT" ]
null
null
null
lib/app.ex
aifrak/template-elixir
6d4f346b59cd6df03bf75eb5af879b0af5ded9db
[ "MIT" ]
109
2021-07-14T21:41:23.000Z
2022-03-20T09:31:35.000Z
lib/app.ex
aifrak/template-elixir
6d4f346b59cd6df03bf75eb5af879b0af5ded9db
[ "MIT" ]
null
null
null
defmodule App do @moduledoc """ Documentation for `App`. """ @spec hello :: :world @doc """ Hello world. ## Examples iex> App.hello() :world """ def hello do :world end @doc """ Add a to b. ## Examples iex> App.add(10, 15) 25 """ @spec add(integer, integer) :: integer def add(a, b) do a + b end end
11.625
40
0.510753
79190b47c1c86f7d3ce28ea12f650eaf50bc7bf3
21,988
ex
Elixir
deps/postgrex/lib/postgrex/type_module.ex
rchervin/phoenixportfolio
a5a6a60168d7261647a10a8dbd395b440db8a4f9
[ "MIT" ]
null
null
null
deps/postgrex/lib/postgrex/type_module.ex
rchervin/phoenixportfolio
a5a6a60168d7261647a10a8dbd395b440db8a4f9
[ "MIT" ]
null
null
null
deps/postgrex/lib/postgrex/type_module.ex
rchervin/phoenixportfolio
a5a6a60168d7261647a10a8dbd395b440db8a4f9
[ "MIT" ]
null
null
null
defmodule Postgrex.TypeModule do @moduledoc false alias Postgrex.TypeInfo def define(module, extensions, opts) do opts = opts |> Keyword.put_new(:decode_binary, :copy) |> Keyword.put_new(:date, :elixir) config = configure(extensions, opts) define_inline(module, config, opts) end ## Helpers defp directives(config) do requires = for {extension, _} <- config do quote do: require unquote(extension) end quote do import Postgrex.BinaryUtils require unquote(__MODULE__) unquote(requires) end end defp attributes(opts) do null = Keyword.get(opts, :null) quote do @moduledoc false unquote(bin_opt_info(opts)) @compile {:inline, [encode_value: 2]} @null unquote(Macro.escape(null)) end end defp bin_opt_info(opts) do if Keyword.get(opts, :bin_opt_info) do quote do: @compile :bin_opt_info else [] end end @anno (if :erlang.system_info(:otp_release) >= '19' do [generated: true] else [line: -1] end) defp find(config) do clauses = Enum.flat_map(config, &find_clauses/1) clauses = clauses ++ quote do: (_ -> nil) quote @anno do def find(type_info, formats) do case {type_info, formats} do unquote(clauses) end end end end defp find_clauses({extension, {opts, matching, format}}) do for {key, value} <- matching do [clause] = find_clause(extension, opts, key, value, format) clause end end defp find_clause(extension, opts, key, value, :super_binary) do quote do {%{unquote(key) => unquote(value)} = type_info, formats} when formats in [:any, :binary] -> oids = unquote(extension).oids(type_info, unquote(opts)) {:super_binary, unquote(extension), oids} end end defp find_clause(extension, _opts, key, value, format) do quote do {%{unquote(key) => unquote(value)}, formats} when formats in [:any, unquote(format)] -> {unquote(format), unquote(extension)} end end defp maybe_rewrite(ast, extension, cases, opts) do if Postgrex.Utils.default_extension?(extension) and not Keyword.get(opts, :debug_defaults, false) do ast else rewrite(ast, cases) end end defp rewrite(ast, [{:->, meta, _} | _original]) do location = [file: meta[:file] || "nofile", line: meta[:keep] || 1] Macro.prewalk(ast, fn {left, meta, right} -> {left, location ++ meta, right} other -> other end) end defp encode(config, define_opts) do encodes = for {extension, {opts, [_|_], format}} <- config do encode = extension.encode(opts) clauses = for clause <- encode do encode_type(extension, format, clause) end clauses = [encode_null(extension, format) | clauses] quote do unquote(encode_value(extension, format)) unquote(encode_inline(extension, format)) unquote(clauses |> maybe_rewrite(extension, encode, define_opts)) end end quote location: :keep do unquote(encodes) def encode_params(params, types) do encode_params(params, types, []) end defp encode_params([param | params], [type | types], encoded) do encode_params(params, types, [encode_value(param, type) | encoded]) end defp encode_params([], [], encoded), do: Enum.reverse(encoded) defp encode_params(params, _, _) when is_list(params), do: :error def encode_tuple(tuple, oids, types) do encode_tuple(tuple, 1, oids, types, []) end defp encode_tuple(tuple, n, [oid | oids], [type | types], acc) do param = :erlang.element(n, tuple) acc = [acc, <<oid::uint32>> | encode_value(param, type)] encode_tuple(tuple, n+1, oids, types, acc) end defp encode_tuple(tuple, n, [], [], acc) when tuple_size(tuple) < n do acc end defp encode_tuple(tuple, _, [], [], _) when is_tuple(tuple), do: :error def encode_list(list, type) do encode_list(list, type, []) end defp encode_list([value | rest], type, acc) do encode_list(rest, type, [acc | encode_value(value, type)]) end defp encode_list([], _, acc) do acc end end end defp encode_type(extension, :super_binary, clause) do encode_super(extension, clause) end defp encode_type(extension, _, clause) do encode_extension(extension, clause) end defp encode_extension(extension, clause) do case split_extension(clause) do {pattern, guard, body} -> encode_extension(extension, pattern, guard, body) {pattern, body} -> encode_extension(extension, pattern, body) end end defp encode_extension(extension, pattern, guard, body) do quote do defp unquote(extension)(unquote(pattern)) when unquote(guard) do unquote(body) end end end defp encode_extension(extension, pattern, body) do quote do defp unquote(extension)(unquote(pattern)) do unquote(body) end end end defp encode_super(extension, clause) do case split_super(clause) do {pattern, sub_oids, sub_types, guard, body} -> encode_super(extension, pattern, sub_oids, sub_types, guard, body) {pattern, sub_oids, sub_types, body} -> encode_super(extension, pattern, sub_oids, sub_types, body) end end defp encode_super(extension, pattern, sub_oids, sub_types, guard, body) do quote do defp unquote(extension)(unquote(pattern), unquote(sub_oids), unquote(sub_types)) when unquote(guard) do unquote(body) end end end defp encode_super(extension, pattern, sub_oids, sub_types, body) do quote do defp unquote(extension)(unquote(pattern), unquote(sub_oids), unquote(sub_types)) do unquote(body) end end end defp encode_inline(extension, :super_binary) do quote do @compile {:inline, [{unquote(extension), 3}]} end end defp encode_inline(extension, _) do quote do @compile {:inline, [{unquote(extension), 1}]} end end defp encode_null(extension, :super_binary) do quote do defp unquote(extension)(@null, _sub_oids, _sub_types), do: <<-1::int32>> end end defp encode_null(extension, _) do quote do defp unquote(extension)(@null), do: <<-1::int32>> end end defp encode_value(extension, :super_binary) do quote do def encode_value(value, {unquote(extension), sub_oids, sub_types}) do unquote(extension)(value, sub_oids, sub_types) end end end defp encode_value(extension, _) do quote do def encode_value(value, unquote(extension)) do unquote(extension)(value) end end end defp decode(config, define_opts) do rest = quote do: rest acc = quote do: acc rem = quote do: rem full = quote do: full rows = quote do: rows row_dispatch = for {extension, {_, [_|_], format}} <- config do decode_row_dispatch(extension, format, rest, acc, rem, full, rows) end next_dispatch = decode_rows_dispatch(rest, acc, rem, full, rows) row_dispatch = row_dispatch ++ next_dispatch decodes = for {extension, {opts, [_|_], format}} <- config do decode = extension.decode(opts) clauses = for clause <- decode do decode_type(extension, format, clause, row_dispatch, rest, acc, rem, full, rows) end null_clauses = decode_null(extension, format, row_dispatch, rest, acc, rem, full, rows) quote location: :keep do unquote(clauses |> maybe_rewrite(extension, decode, define_opts)) unquote(null_clauses) end end quote location: :keep do unquote(decode_rows(row_dispatch, rest, acc, rem, full, rows)) unquote(decode_list(config)) unquote(decode_tuple(config)) unquote(decodes) end end defp decode_rows(dispatch, rest, acc, rem, full, rows) do quote location: :keep do def decode_rows(binary, types, rows) do decode_rows(binary, byte_size(binary), types, rows) end defp decode_rows(<<?D, size::int32, _::int16, unquote(rest)::binary>>, rem, unquote(full), unquote(rows)) when rem > size do unquote(rem) = rem - (1 + size) unquote(acc) = [] case unquote(full) do unquote(dispatch) end end defp decode_rows(<<?D, size::int32, rest::binary>>, rem, _, rows) do more = (size+1) - rem {:more, [?D, <<size::int32>> | rest], rows, more} end defp decode_rows(<<?D, rest::binary>>, _, _, rows) do {:more, [?D | rest], rows, 0} end defp decode_rows(<<rest::binary-size(0)>>, _, _, rows) do {:more, [], rows, 0} end defp decode_rows(<<rest::binary>>, _, _, rows) do {:ok, rows, rest} end end end defp decode_row_dispatch(extension, :super_binary, rest, acc, rem, full, rows) do [clause] = quote do [{unquote(extension), sub_oids, sub_types} | types] -> unquote(extension)(unquote(rest), sub_oids, sub_types, types, unquote(acc), unquote(rem), unquote(full), unquote(rows)) end clause end defp decode_row_dispatch(extension, _, rest, acc, rem, full, rows) do [clause] = quote do [unquote(extension) | types2] -> unquote(extension)(unquote(rest), types2, unquote(acc), unquote(rem), unquote(full), unquote(rows)) end clause end defp decode_rows_dispatch(rest, acc, rem, full, rows) do quote do [] -> rows = [Enum.reverse(unquote(acc)) | unquote(rows)] decode_rows(unquote(rest), unquote(rem), unquote(full), rows) end end defp decode_list(config) do rest = quote do: rest dispatch = for {extension, {_, [_|_], format}} <- config do decode_list_dispatch(extension, format, rest) end quote do def decode_list(<<unquote(rest)::binary>>, type) do case type do unquote(dispatch) end end end end defp decode_list_dispatch(extension, :super_binary, rest) do [clause] = quote do {unquote(extension), sub_oids, sub_types} -> unquote(extension)(unquote(rest), sub_oids, sub_types, []) end clause end defp decode_list_dispatch(extension, _, rest) do [clause] = quote do unquote(extension) -> unquote(extension)(unquote(rest), []) end clause end defp decode_tuple(config) do rest = quote do: rest oids = quote do: oids n = quote do: n acc = quote do: acc dispatch = for {extension, {_, [_|_], format}} <- config do decode_tuple_dispatch(extension, format, rest, oids, n, acc) end quote do def decode_tuple(<<rest::binary>>, count, types) when is_integer(count) do decode_tuple(rest, count, types, 0, []) end def decode_tuple(<<rest::binary>>, oids, types) do decode_tuple(rest, oids, types, 0, []) end defp decode_tuple(<<oid::int32, unquote(rest)::binary>>, [oid | unquote(oids)], types, unquote(n), unquote(acc)) do case types do unquote(dispatch) end end defp decode_tuple(<<>>, [], [], n, acc) do :erlang.make_tuple(n, @null, acc) end defp decode_tuple(<<oid::int32, unquote(rest)::binary>>, rem, types, unquote(n), unquote(acc)) when rem > 0 do case Postgrex.Types.fetch(oid, types) do {:ok, {:binary, type}} -> unquote(oids) = rem - 1 case [type | types] do unquote(dispatch) end {:ok, {:text, _}} -> msg = "oid `#{oid}` was bootstrapped in text format and can not " <> "be decoded inside an anonymous record" raise RuntimeError, msg {:error, %TypeInfo{type: pg_type}} -> msg = "type `#{pg_type}` can not be handled by the configured " <> "extensions" raise RuntimeError, msg {:error, nil} -> msg = "oid `#{oid}` was not bootstrapped and lacks type information" raise RuntimeError, msg end end defp decode_tuple(<<>>, 0, _types, n, acc) do :erlang.make_tuple(n, @null, acc) end end end defp decode_tuple_dispatch(extension, :super_binary, rest, oids, n, acc) do [clause] = quote do [{unquote(extension), sub_oids, sub_types} | types] -> unquote(extension)(unquote(rest), sub_oids, sub_types, unquote(oids), types, unquote(n)+1, unquote(acc)) end clause end defp decode_tuple_dispatch(extension, _, rest, oids, n, acc) do [clause] = quote do [unquote(extension) | types] -> unquote(extension)(unquote(rest), unquote(oids), types, unquote(n)+1, unquote(acc)) end clause end defp decode_type(extension, :super_binary, clause, dispatch, rest, acc, rem, full, rows) do decode_super(extension, clause, dispatch, rest, acc, rem, full, rows) end defp decode_type(extension, _, clause, dispatch, rest, acc, rem, full, rows) do decode_extension(extension, clause, dispatch, rest, acc, rem, full, rows) end defp decode_null(extension, :super_binary, dispatch, rest, acc, rem, full, rows) do decode_super_null(extension, dispatch, rest, acc, rem, full, rows) end defp decode_null(extension, _, dispatch, rest, acc, rem, full, rows) do decode_extension_null(extension, dispatch, rest, acc, rem, full, rows) end defp decode_extension(extension, clause, dispatch, rest, acc, rem, full, rows) do case split_extension(clause) do {pattern, guard, body} -> decode_extension(extension, pattern, guard, body, dispatch, rest, acc, rem, full, rows) {pattern, body} -> decode_extension(extension, pattern, body, dispatch, rest, acc, rem, full, rows) end end defp decode_extension(extension, pattern, guard, body, dispatch, rest, acc, rem, full, rows) do quote do defp unquote(extension)(<<unquote(pattern), unquote(rest)::binary>>, types, acc, unquote(rem), unquote(full), unquote(rows)) when unquote(guard) do unquote(acc) = [unquote(body) | acc] case types do unquote(dispatch) end end defp unquote(extension)(<<unquote(pattern), rest::binary>>, acc) when unquote(guard) do unquote(extension)(rest, [unquote(body) | acc]) end defp unquote(extension)(<<unquote(pattern), rest::binary>>, oids, types, n, acc) when unquote(guard) do decode_tuple(rest, oids, types, n, [{n, unquote(body)} | acc]) end end end defp decode_extension(extension, pattern, body, dispatch, rest, acc, rem, full, rows) do quote do defp unquote(extension)(<<unquote(pattern), unquote(rest)::binary>>, types, acc, unquote(rem), unquote(full), unquote(rows)) do unquote(acc) = [unquote(body) | acc] case types do unquote(dispatch) end end defp unquote(extension)(<<unquote(pattern), rest::binary>>, acc) do decoded = unquote(body) unquote(extension)(rest, [decoded | acc]) end defp unquote(extension)(<<unquote(pattern), rest::binary>>, oids, types, n, acc) do decode_tuple(rest, oids, types, n, [{n, unquote(body)} | acc]) end end end defp decode_extension_null(extension, dispatch, rest, acc, rem, full, rows) do quote do defp unquote(extension)(<<-1::int32, unquote(rest)::binary>>, types, acc, unquote(rem), unquote(full), unquote(rows)) do unquote(acc) = [@null | acc] case types do unquote(dispatch) end end defp unquote(extension)(<<-1::int32, rest::binary>>, acc) do unquote(extension)(rest, [@null | acc]) end defp unquote(extension)(<<>>, acc) do acc end defp unquote(extension)(<<-1::int32, rest::binary>>, oids, types, n, acc) do decode_tuple(rest, oids, types, n, acc) end end end defp split_extension({:->, _, [head, body]}) do case head do [{:when, _, [pattern, guard]}] -> {pattern, guard, body} [pattern] -> {pattern, body} end end defp decode_super(extension, clause, dispatch, rest, acc, rem, full, rows) do case split_super(clause) do {pattern, oids, types, guard, body} -> decode_super(extension, pattern, oids, types, guard, body, dispatch, rest, acc, rem, full, rows) {pattern, oids, types, body} -> decode_super(extension, pattern, oids, types, body, dispatch, rest, acc, rem, full, rows) end end defp decode_super(extension, pattern, sub_oids, sub_types, guard, body, dispatch, rest, acc, rem, full, rows) do quote do defp unquote(extension)(<<unquote(pattern), unquote(rest)::binary>>, unquote(sub_oids), unquote(sub_types), types, acc, unquote(rem), unquote(full), unquote(rows)) when unquote(guard) do unquote(acc) = [unquote(body) | acc] case types do unquote(dispatch) end end defp unquote(extension)(<<unquote(pattern), rest::binary>>, unquote(sub_oids), unquote(sub_types), acc) when unquote(guard) do acc = [unquote(body) | acc] unquote(extension)(rest, unquote(sub_oids), unquote(sub_types), acc) end defp unquote(extension)(<<unquote(pattern), rest::binary>>, unquote(sub_oids), unquote(sub_types), oids, types, n, acc) when unquote(guard) do decode_tuple(rest, oids, types, n, [{n, unquote(body)} | acc]) end end end defp decode_super(extension, pattern, sub_oids, sub_types, body, dispatch, rest, acc, rem, full, rows) do quote do defp unquote(extension)(<<unquote(pattern), unquote(rest)::binary>>, unquote(sub_oids), unquote(sub_types), types, acc, unquote(rem), unquote(full), unquote(rows)) do unquote(acc) = [unquote(body) | acc] case types do unquote(dispatch) end end defp unquote(extension)(<<unquote(pattern), rest::binary>>, unquote(sub_oids), unquote(sub_types), acc) do acc = [unquote(body) | acc] unquote(extension)(rest, unquote(sub_oids), unquote(sub_types), acc) end defp unquote(extension)(<<unquote(pattern), rest::binary>>, unquote(sub_oids), unquote(sub_types), oids, types, n, acc) do acc = [{n, unquote(body)} | acc] decode_tuple(rest, oids, types, n, acc) end end end defp decode_super_null(extension, dispatch, rest, acc, rem, full, rows) do quote do defp unquote(extension)(<<-1::int32, unquote(rest)::binary>>, _sub_oids, _sub_types, types, acc, unquote(rem), unquote(full), unquote(rows)) do unquote(acc) = [@null | acc] case types do unquote(dispatch) end end defp unquote(extension)(<<-1::int32, rest::binary>>, sub_oids, sub_types, acc) do unquote(extension)(rest, sub_oids, sub_types, [@null | acc]) end defp unquote(extension)(<<>>, _sub_oid, _sub_types, acc) do acc end defp unquote(extension)(<<-1::int32, rest::binary>>, _sub_oids, _sub_types, oids, types, n, acc) do decode_tuple(rest, oids, types, n, acc) end end end defp split_super({:->, _, [head, body]}) do case head do [{:when, _, [pattern, sub_oids, sub_types, guard]}] -> {pattern, sub_oids, sub_types, guard, body} [pattern, sub_oids, sub_types] -> {pattern, sub_oids, sub_types, body} end end defp configure(extensions, opts) do defaults = Postgrex.Utils.default_extensions(opts) Enum.map(extensions ++ defaults, &configure/1) end defp configure({extension, opts}) do state = extension.init(opts) matching = extension.matching(state) format = extension.format(state) {extension, {state, matching, format}} end defp configure(extension) do configure({extension, []}) end defp define_inline(module, config, opts) do quoted = [directives(config), attributes(opts), find(config), encode(config, opts), decode(config, opts)] Module.create(module, quoted, Macro.Env.location(__ENV__)) end end
30.581363
80
0.574359
79191c8d1e93e8d15496507b222413ddfa62e895
420
ex
Elixir
test/support/channel_case.ex
GrantJamesPowell/battle_box
301091955b68cd4672f6513d645eca4e3c4e17d0
[ "Apache-2.0" ]
2
2020-10-17T05:48:49.000Z
2020-11-11T02:34:15.000Z
test/support/channel_case.ex
FlyingDutchmanGames/battle_box
301091955b68cd4672f6513d645eca4e3c4e17d0
[ "Apache-2.0" ]
3
2020-05-18T05:52:21.000Z
2020-06-09T07:24:14.000Z
test/support/channel_case.ex
FlyingDutchmanGames/battle_box
301091955b68cd4672f6513d645eca4e3c4e17d0
[ "Apache-2.0" ]
null
null
null
defmodule BattleBoxWeb.ChannelCase do use ExUnit.CaseTemplate using do quote do import Phoenix.ChannelTest import BattleBox.Test.DataHelpers @endpoint BattleBoxWeb.Endpoint end end setup tags do :ok = Ecto.Adapters.SQL.Sandbox.checkout(BattleBox.Repo) unless tags[:async] do Ecto.Adapters.SQL.Sandbox.mode(BattleBox.Repo, {:shared, self()}) end :ok end end
18.26087
71
0.690476
791922bd32ee8390033906769f424b6473c7e467
165
exs
Elixir
test/test_helper.exs
nsweeting/exenv
88a9863fd055aa4d99ab9bf416c0b35bc86eadac
[ "MIT" ]
35
2019-03-10T05:16:16.000Z
2021-12-05T00:12:55.000Z
test/test_helper.exs
nsweeting/exenv
88a9863fd055aa4d99ab9bf416c0b35bc86eadac
[ "MIT" ]
2
2019-03-08T17:01:50.000Z
2019-03-14T09:20:22.000Z
test/test_helper.exs
nsweeting/exenv
88a9863fd055aa4d99ab9bf416c0b35bc86eadac
[ "MIT" ]
null
null
null
Application.stop(:exenv) {:ok, files} = File.ls("./test/support") Enum.each(files, fn file -> Code.require_file("support/#{file}", __DIR__) end) ExUnit.start()
16.5
47
0.672727
79193de0f49cca6139114ddce5843f8a34e886dc
33
exs
Elixir
hello.exs
danilobarion1986/elixir_scripts
211e9d57b2204b60de45afbfb2c22fb3e0157119
[ "MIT" ]
null
null
null
hello.exs
danilobarion1986/elixir_scripts
211e9d57b2204b60de45afbfb2c22fb3e0157119
[ "MIT" ]
null
null
null
hello.exs
danilobarion1986/elixir_scripts
211e9d57b2204b60de45afbfb2c22fb3e0157119
[ "MIT" ]
null
null
null
IO.puts "Hello world of Elixir!"
16.5
32
0.727273
791940feabebd3ae53f706dae6c265692a1c4dfa
1,544
ex
Elixir
lib/app_web/uploaders/file_image.ex
ThanhUong/Chronos
5e1b0823c585b784f5c51212513d518cab53a571
[ "MIT" ]
null
null
null
lib/app_web/uploaders/file_image.ex
ThanhUong/Chronos
5e1b0823c585b784f5c51212513d518cab53a571
[ "MIT" ]
null
null
null
lib/app_web/uploaders/file_image.ex
ThanhUong/Chronos
5e1b0823c585b784f5c51212513d518cab53a571
[ "MIT" ]
null
null
null
defmodule App.FileImage do use Waffle.Definition # Include ecto support (requires package waffle_ecto installed): use Waffle.Ecto.Definition @versions [:original] # To add a thumbnail version: # @versions [:original, :thumb] # Override the bucket on a per definition basis: # def bucket do # :custom_bucket_name # end # Whitelist file extensions: def validate({file, _}) do file_extension = file.file_name |> Path.extname() |> String.downcase() case Enum.member?(~w(.jpg .jpeg .gif .png), file_extension) do true -> :ok false -> {:error, "invalid file type"} end end # Define a thumbnail transformation: # def transform(:thumb, _) do # {:convert, "-strip -thumbnail 250x250^ -gravity center -extent 250x250 -format png", :png} # end # Override the persisted filenames: # def filename(version, _) do # version # end # Override the storage directory: # def storage_dir(version, {file, scope}) do # "uploads/user/avatars/#{scope.id}" # end # Provide a default URL if there hasn't been a file uploaded # def default_url(version, scope) do # "/images/avatars/default_#{version}.png" # end # Specify custom headers for s3 objects # Available options are [:cache_control, :content_disposition, # :content_encoding, :content_length, :content_type, # :expect, :expires, :storage_class, :website_redirect_location] # # def s3_object_headers(version, {file, scope}) do # [content_type: MIME.from_path(file.file_name)] # end end
27.571429
96
0.682642
79195e00b351e9652b75368e8f993e21e80a03e0
18,776
ex
Elixir
deps/timex/lib/datetime/datetime.ex
alex-philippov/jwt-google-tokens
18aa3eccc9a2c1a6016b2fe53b0bc6b1612a04b7
[ "Apache-2.0" ]
null
null
null
deps/timex/lib/datetime/datetime.ex
alex-philippov/jwt-google-tokens
18aa3eccc9a2c1a6016b2fe53b0bc6b1612a04b7
[ "Apache-2.0" ]
null
null
null
deps/timex/lib/datetime/datetime.ex
alex-philippov/jwt-google-tokens
18aa3eccc9a2c1a6016b2fe53b0bc6b1612a04b7
[ "Apache-2.0" ]
1
2019-11-23T12:09:14.000Z
2019-11-23T12:09:14.000Z
defimpl Timex.Protocol, for: DateTime do @moduledoc """ A type which represents a date and time with timezone information (optional, UTC will be assumed for date/times with no timezone information provided). Functions that produce time intervals use UNIX epoch (or simly Epoch) as the default reference date. Epoch is defined as UTC midnight of January 1, 1970. Time intervals in this module don't account for leap seconds. """ import Timex.Macros use Timex.Constants alias Timex.{Duration, AmbiguousDateTime} alias Timex.{Timezone, TimezoneInfo} alias Timex.Types alias Timex.DateTime.Helpers @epoch_seconds :calendar.datetime_to_gregorian_seconds({{1970,1,1},{0,0,0}}) @spec to_julian(DateTime.t) :: integer def to_julian(%DateTime{:year => y, :month => m, :day => d}) do Timex.Calendar.Julian.julian_date(y, m, d) end @spec to_gregorian_seconds(DateTime.t) :: integer def to_gregorian_seconds(date), do: to_seconds(date, :zero) @spec to_gregorian_microseconds(DateTime.t) :: integer def to_gregorian_microseconds(%DateTime{microsecond: {us,_}} = date) do s = to_seconds(date, :zero) (s*(1_000*1_000))+us end @spec to_unix(DateTime.t) :: integer def to_unix(date), do: trunc(to_seconds(date, :epoch)) @spec to_date(DateTime.t) :: Date.t def to_date(date), do: DateTime.to_date(date) @spec to_datetime(DateTime.t, timezone :: Types.valid_timezone) :: DateTime.t | AmbiguousDateTime.t | {:error, term} def to_datetime(%DateTime{time_zone: timezone} = d, timezone), do: d def to_datetime(%DateTime{} = d, timezone), do: Timezone.convert(d, timezone) @spec to_naive_datetime(DateTime.t) :: NaiveDateTime.t def to_naive_datetime(%DateTime{time_zone: nil} = d) do %NaiveDateTime{ year: d.year, month: d.month, day: d.day, hour: d.hour, minute: d.minute, second: d.second, microsecond: d.microsecond } end def to_naive_datetime(%DateTime{} = d) do nd = %NaiveDateTime{ year: d.year, month: d.month, day: d.day, hour: d.hour, minute: d.minute, second: d.second, microsecond: d.microsecond } Timex.shift(nd, [seconds: Timex.Timezone.total_offset(d.std_offset, d.utc_offset)]) end @spec to_erl(DateTime.t) :: Types.datetime def to_erl(%DateTime{} = d) do {{d.year,d.month,d.day},{d.hour,d.minute,d.second}} end @spec century(DateTime.t) :: non_neg_integer def century(%DateTime{:year => year}), do: Timex.century(year) @spec is_leap?(DateTime.t) :: boolean def is_leap?(%DateTime{year: year}), do: :calendar.is_leap_year(year) @spec beginning_of_day(DateTime.t) :: DateTime.t def beginning_of_day(%DateTime{} = datetime) do Timex.Timezone.beginning_of_day(datetime) end @spec end_of_day(DateTime.t) :: DateTime.t def end_of_day(%DateTime{} = datetime) do Timex.Timezone.end_of_day(datetime) end @spec beginning_of_week(DateTime.t, Types.weekday) :: DateTime.t | AmbiguousDateTime.t def beginning_of_week(%DateTime{} = date, weekstart) do case Timex.days_to_beginning_of_week(date, weekstart) do {:error, _} = err -> err days -> beginning_of_day(shift(date, [days: -days])) end end @spec end_of_week(DateTime.t, Types.weekday) :: DateTime.t | AmbiguousDateTime.t def end_of_week(%DateTime{} = date, weekstart) do case Timex.days_to_end_of_week(date, weekstart) do {:error, _} = err -> err days_to_end -> end_of_day(shift(date, [days: days_to_end])) end end @spec beginning_of_year(DateTime.t) :: DateTime.t def beginning_of_year(%DateTime{year: year, time_zone: tz}) do Timex.to_datetime({year, 1, 1}, tz) end @spec end_of_year(DateTime.t) :: DateTime.t def end_of_year(%DateTime{year: year, time_zone: tz}), do: %{Timex.to_datetime({{year, 12, 31}, {23, 59, 59}}, tz) | :microsecond => {999_999, 6}} @spec beginning_of_quarter(DateTime.t) :: DateTime.t def beginning_of_quarter(%DateTime{year: year, month: month, time_zone: tz}) do month = 1 + (3 * (Timex.quarter(month) - 1)) Timex.DateTime.Helpers.construct({year, month, 1}, tz) end @spec end_of_quarter(DateTime.t) :: DateTime.t | AmbiguousDateTime.t def end_of_quarter(%DateTime{year: year, month: month, time_zone: tz}) do month = 3 * Timex.quarter(month) case Timex.DateTime.Helpers.construct({year,month,1}, tz) do {:error, _} = err -> err %DateTime{} = d -> end_of_month(d) %AmbiguousDateTime{:before => b, :after => a} -> %AmbiguousDateTime{:before => end_of_month(b), :after => end_of_month(a)} end end @spec beginning_of_month(DateTime.t) :: DateTime.t def beginning_of_month(%DateTime{microsecond: {_, _precision}} = datetime), do: %{datetime | :day => 1, :hour => 0, :minute => 0, :second => 0, :microsecond => {0, 0}} @spec end_of_month(DateTime.t) :: DateTime.t def end_of_month(%DateTime{year: year, month: month, time_zone: tz} = date), do: Timex.DateTime.Helpers.construct({{year, month, days_in_month(date)},{23,59,59,999_999}}, tz) @spec quarter(DateTime.t) :: integer def quarter(%DateTime{month: month}), do: Timex.quarter(month) def days_in_month(%DateTime{:year => y, :month => m}), do: Timex.days_in_month(y, m) def week_of_month(%DateTime{:year => y, :month => m, :day => d}), do: Timex.week_of_month(y,m,d) def weekday(%DateTime{:year => y, :month => m, :day => d}), do: :calendar.day_of_the_week({y, m, d}) def day(%DateTime{} = date) do ref = beginning_of_year(date) 1 + Timex.diff(date, ref, :days) end def is_valid?(%DateTime{:year => y, :month => m, :day => d, :hour => h, :minute => min, :second => sec}) do :calendar.valid_date({y,m,d}) and Timex.is_valid_time?({h,min,sec}) end def iso_week(%DateTime{:year => y, :month => m, :day => d}), do: Timex.iso_week(y, m, d) def from_iso_day(%DateTime{year: year} = date, day) when is_day_of_year(day) do {year, month, day_of_month} = Timex.Helpers.iso_day_to_date_tuple(year, day) %{date | :year => year, :month => month, :day => day_of_month} end @spec set(DateTime.t, list({atom(), term})) :: DateTime.t | {:error, term} def set(%DateTime{} = date, options) do validate? = Keyword.get(options, :validate, true) Enum.reduce(options, date, fn _option, {:error, _} = err -> err option, result -> case option do {:validate, _} -> result {:datetime, {{y, m, d}, {h, min, sec}}} -> if validate? do %{result | :year => Timex.normalize(:year, y), :month => Timex.normalize(:month, m), :day => Timex.normalize(:day, {y,m,d}), :hour => Timex.normalize(:hour, h), :minute => Timex.normalize(:minute, min), :second => Timex.normalize(:second, sec) } else %{result | :year => y, :month => m, :day => d, :hour => h, :minute => min, :second => sec} end {:date, {y, m, d}} -> if validate? do {yn,mn,dn} = Timex.normalize(:date, {y,m,d}) %{result | :year => yn, :month => mn, :day => dn} else %{result | :year => y, :month => m, :day => d} end {:time, {h, m, s}} -> if validate? do %{result | :hour => Timex.normalize(:hour, h), :minute => Timex.normalize(:minute, m), :second => Timex.normalize(:second, s)} else %{result | :hour => h, :minute => m, :second => s} end {:day, d} -> if validate? do %{result | :day => Timex.normalize(:day, {result.year, result.month, d})} else %{result | :day => d} end {:timezone, tz} -> tz = case tz do %TimezoneInfo{} -> tz _ -> Timezone.get(tz, result) end %{result | :time_zone => tz.full_name, :zone_abbr => tz.abbreviation, :utc_offset => tz.offset_utc, :std_offset => tz.offset_std} {name, val} when name in [:year, :month, :hour, :minute, :second, :microsecond] -> if validate? do Map.put(result, name, Timex.normalize(name, val)) else Map.put(result, name, val) end {option_name, _} -> {:error, {:bad_option, option_name}} end end) end @doc """ Shifts the given DateTime based on a series of options. See docs for Timex.shift/2 for details. """ @spec shift(DateTime.t, list({atom(), term})) :: DateTime.t | {:error, term} def shift(%DateTime{} = datetime, shifts) when is_list(shifts) do apply_shifts(datetime, shifts) end defp apply_shifts(datetime, []), do: datetime defp apply_shifts(datetime, [{:duration, %Duration{} = duration} | rest]) do total_microseconds = Duration.to_microseconds(duration) seconds = div(total_microseconds, 1_000*1_000) rem_microseconds = rem(total_microseconds, 1_000*1_000) shifted = case shift_by(datetime, seconds, :seconds) do %AmbiguousDateTime{before: b, after: a} = adt -> %{adt | :before => %{b | :microsecond => Helpers.construct_microseconds(rem_microseconds)}, :after => %{a | :microsecond => Helpers.construct_microseconds(rem_microseconds)}} %DateTime{} = dt -> %{dt | :microsecond => Helpers.construct_microseconds(rem_microseconds)} end apply_shifts(shifted, rest) end defp apply_shifts(datetime, [{unit, 0} | rest]) when is_atom(unit), do: apply_shifts(datetime, rest) defp apply_shifts(datetime, [{unit, value} | rest]) when is_atom(unit) and is_integer(value) do shifted = shift_by(datetime, value, unit) apply_shifts(shifted, rest) end defp apply_shifts({:error, _} = err, _), do: err defp shift_by(%AmbiguousDateTime{:before => before_dt, :after => after_dt}, value, unit) do # Since we're presumably in the middle of a shifting operation, rather than failing because # we're crossing an ambiguous time period, process both the before and after DateTime individually, # and if both return AmbiguousDateTimes, choose the AmbiguousDateTime from :after to return, # if one returns a valid DateTime, return that instead, since the shift has resolved the ambiguity. # if one returns an error, but the other does not, return the non-errored one. case {shift_by(before_dt, value, unit), shift_by(after_dt, value, unit)} do # other could be an error too, but that's fine {{:error, _}, other} -> other {other, {:error, _}} -> other # We'll always use :after when choosing between two ambiguous datetimes {%AmbiguousDateTime{}, %AmbiguousDateTime{} = new_after} -> new_after # The shift resolved the ambiguity! {%AmbiguousDateTime{}, %DateTime{} = resolved} -> resolved {%DateTime{}, %AmbiguousDateTime{} = resolved} -> resolved end end defp shift_by(%DateTime{:year => y} = datetime, value, :years) do shifted = %{datetime | :year => y + value} # If a plain shift of the year fails, then it likely falls on a leap day, # so set the day to the last day of that month case :calendar.valid_date({shifted.year,shifted.month,shifted.day}) do false -> last_day = :calendar.last_day_of_the_month(shifted.year, shifted.month) shifted = cond do shifted.day <= last_day -> shifted :else -> %{shifted | :day => last_day} end resolve_timezone_info(shifted) true -> resolve_timezone_info(shifted) end end defp shift_by(%DateTime{:year => year, :month => month} = datetime, value, :months) do m = month + value shifted = cond do value == 12 -> %{datetime | :year => year + 1} value == -12 -> %{datetime | :year => year - 1} m == 0 -> %{datetime | :year => year - 1, :month => 12} m > 12 -> %{datetime | :year => year + div(m, 12), :month => rem(m, 12)} m < 0 -> %{datetime | :year => year + min(div(m, 12), -1), :month => 12 + rem(m, 12)} :else -> %{datetime | :month => m} end # setting months to remainders may result in invalid :month => 0 shifted = case shifted.month do 0 -> %{ shifted | :year => shifted.year - 1, :month => 12 } _ -> shifted end # If the shift fails, it's because it's a high day number, and the month # shifted to does not have that many days. This will be handled by always # shifting to the last day of the month shifted to. case :calendar.valid_date({shifted.year,shifted.month,shifted.day}) do false -> last_day = :calendar.last_day_of_the_month(shifted.year, shifted.month) shifted = cond do shifted.day <= last_day -> shifted :else -> %{shifted | :day => last_day} end resolve_timezone_info(shifted) true -> resolve_timezone_info(shifted) end end defp shift_by(%DateTime{microsecond: {current_usecs, _}} = datetime, value, :microseconds) do usecs_from_zero = :calendar.datetime_to_gregorian_seconds({ {datetime.year,datetime.month,datetime.day}, {datetime.hour,datetime.minute,datetime.second} }) * (1_000*1_000) + current_usecs + value secs_from_zero = div(usecs_from_zero, 1_000*1_000) rem_microseconds = rem(usecs_from_zero, 1_000*1_000) {{_y,_m,_d}=date,{h,mm,s}} = :calendar.gregorian_seconds_to_datetime(secs_from_zero) Timezone.resolve(datetime.time_zone, {date, {h,mm,s}}) |> Map.merge(%{microsecond: Helpers.construct_microseconds(rem_microseconds)}) end defp shift_by(%DateTime{microsecond: {current_usecs, _}} = datetime, value, :milliseconds) do usecs_from_zero = :calendar.datetime_to_gregorian_seconds({ {datetime.year,datetime.month,datetime.day}, {datetime.hour,datetime.minute,datetime.second} }) * (1_000*1_000) + current_usecs + (value*1_000) secs_from_zero = div(usecs_from_zero, 1_000*1_000) rem_microseconds = rem(usecs_from_zero, 1_000*1_000) {{_y,_m,_d}=date,{h,mm,s}} = :calendar.gregorian_seconds_to_datetime(secs_from_zero) Timezone.resolve(datetime.time_zone, {date, {h,mm,s}}) |> Map.merge(%{microsecond: Helpers.construct_microseconds(rem_microseconds)}) end defp shift_by(%DateTime{microsecond: {us, p}} = datetime, value, units) do secs_from_zero = :calendar.datetime_to_gregorian_seconds({ {datetime.year,datetime.month,datetime.day}, {datetime.hour,datetime.minute,datetime.second} }) shift_by = case units do :microseconds -> div(value + us, 1_000) :milliseconds -> div(value + (us*1_000), 1_000) :seconds -> value :minutes -> value * 60 :hours -> value * 60 * 60 :days -> value * 60 * 60 * 24 :weeks -> value * 60 * 60 * 24 * 7 _ -> {:error, {:unknown_shift_unit, units}} end case shift_by do {:error, _} = err -> err 0 when units in [:microseconds] -> total_us = rem(value + us, 1_000) %{datetime | :microsecond => Helpers.construct_microseconds(total_us)} 0 when units in [:milliseconds] -> total_ms = rem(value + (us*1_000), 1_000) %{datetime | :microsecond => Helpers.construct_microseconds(total_ms*1_000)} 0 -> datetime _ -> new_secs_from_zero = secs_from_zero + shift_by cond do new_secs_from_zero <= 0 -> {:error, :shift_to_invalid_date} :else -> {{y,m,d}=date,{h,mm,s}} = :calendar.gregorian_seconds_to_datetime(new_secs_from_zero) resolved = Timezone.resolve(datetime.time_zone, {date, {h,mm,s}}) case {resolved, units} do {%DateTime{} = dt, :microseconds} -> %{dt | :microsecond => Helpers.construct_microseconds(rem(value+us, 1_000))} {%DateTime{} = dt, :milliseconds} -> %{dt | :microsecond => Helpers.construct_microseconds(rem(value+(us*1_000), 1_000))} {%AmbiguousDateTime{before: b, after: a}, :microseconds} -> bd = %{b | :microsecond => Helpers.construct_microseconds(rem(value+us, 1_000))} ad = %{a | :microsecond => Helpers.construct_microseconds(rem(value+us, 1_000))} %AmbiguousDateTime{before: bd, after: ad} {%AmbiguousDateTime{before: b, after: a}, :milliseconds} -> bd = %{b | :microsecond => Helpers.construct_microseconds(rem(value+(us*1_000), 1_000))} ad = %{a | :microsecond => Helpers.construct_microseconds(rem(value+(us*1_000), 1_000))} %AmbiguousDateTime{before: bd, after: ad} {%DateTime{} = dt, _} -> %{dt | :microsecond => {us,p}} {%AmbiguousDateTime{before: b, after: a}, _} -> bd = %{b | :microsecond => {us,p}} ad = %{a | :microsecond => {us,p}} %AmbiguousDateTime{before: bd, after: ad} end end end end defp resolve_timezone_info(%DateTime{:time_zone => tzname} = datetime) do Timezone.resolve(tzname, { {datetime.year, datetime.month, datetime.day}, {datetime.hour, datetime.minute, datetime.second, datetime.microsecond}}) end @spec to_seconds(DateTime.t, :epoch | :zero) :: integer | {:error, atom} @spec to_seconds(DateTime.t, :epoch | :zero, [utc: false | true]) :: integer | {:error, atom} defp to_seconds(date, reference, options \\ [utc: true]) defp to_seconds(%DateTime{} = date, :epoch, utc: true) do case to_seconds(date, :zero, utc: true) do {:error, _} = err -> err secs -> secs - @epoch_seconds end end defp to_seconds(%DateTime{} = date, :zero, utc: true) do total_offset = Timezone.total_offset(date.std_offset, date.utc_offset) * -1 date = %{date | :time_zone => "Etc/UTC", :zone_abbr => "UTC", :std_offset => 0, :utc_offset => 0} date = Timex.shift(date, seconds: total_offset) utc_to_secs(date) end defp to_seconds(%DateTime{} = date, :epoch, utc: false) do case to_seconds(date, :zero, utc: false) do {:error, _} = err -> err secs -> secs - @epoch_seconds end end defp to_seconds(%DateTime{} = date, :zero, utc: false), do: utc_to_secs(date) defp to_seconds(_, _, _), do: {:error, :badarg} defp utc_to_secs(%DateTime{:year => y, :month => m, :day => d, :hour => h, :minute => mm, :second => s}) do :calendar.datetime_to_gregorian_seconds({{y,m,d},{h,mm,s}}) end end
41.724444
140
0.617118
7919829c44d7bbddcfb76239e2c8f7294e2cd130
2,444
ex
Elixir
clients/pub_sub/lib/google_api/pub_sub/v1/model/pubsub_message.ex
leandrocp/elixir-google-api
a86e46907f396d40aeff8668c3bd81662f44c71e
[ "Apache-2.0" ]
null
null
null
clients/pub_sub/lib/google_api/pub_sub/v1/model/pubsub_message.ex
leandrocp/elixir-google-api
a86e46907f396d40aeff8668c3bd81662f44c71e
[ "Apache-2.0" ]
null
null
null
clients/pub_sub/lib/google_api/pub_sub/v1/model/pubsub_message.ex
leandrocp/elixir-google-api
a86e46907f396d40aeff8668c3bd81662f44c71e
[ "Apache-2.0" ]
1
2020-11-10T16:58:27.000Z
2020-11-10T16:58:27.000Z
# Copyright 2017 Google Inc. # # Licensed under the Apache License, Version 2.0 (the &quot;License&quot;); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an &quot;AS IS&quot; BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This class is auto generated by the swagger code generator program. # https://github.com/swagger-api/swagger-codegen.git # Do not edit the class manually. defmodule GoogleApi.PubSub.V1.Model.PubsubMessage do @moduledoc """ A message data and its attributes. The message payload must not be empty; it must contain either a non-empty data field, or at least one attribute. ## Attributes - attributes (%{optional(String.t) &#x3D;&gt; String.t}): Optional attributes for this message. Defaults to: `null`. - data (binary()): The message payload. Defaults to: `null`. - messageId (String.t): ID of this message, assigned by the server when the message is published. Guaranteed to be unique within the topic. This value may be read by a subscriber that receives a &#x60;PubsubMessage&#x60; via a &#x60;Pull&#x60; call or a push delivery. It must not be populated by the publisher in a &#x60;Publish&#x60; call. Defaults to: `null`. - publishTime (DateTime.t): The time at which the message was published, populated by the server when it receives the &#x60;Publish&#x60; call. It must not be populated by the publisher in a &#x60;Publish&#x60; call. Defaults to: `null`. """ use GoogleApi.Gax.ModelBase @type t :: %__MODULE__{ :attributes => map(), :data => any(), :messageId => any(), :publishTime => DateTime.t() } field(:attributes, type: :map) field(:data) field(:messageId) field(:publishTime, as: DateTime) end defimpl Poison.Decoder, for: GoogleApi.PubSub.V1.Model.PubsubMessage do def decode(value, options) do GoogleApi.PubSub.V1.Model.PubsubMessage.decode(value, options) end end defimpl Poison.Encoder, for: GoogleApi.PubSub.V1.Model.PubsubMessage do def encode(value, options) do GoogleApi.Gax.ModelBase.encode(value, options) end end
42.877193
364
0.725041
7919932b23dc0a3af0e4a3e723d310c3f8ffd3c4
1,265
exs
Elixir
config/prod.secret.exs
mikebobadilla/elixir-chat
e0955f9048dd088da8850a05dae5850a4e1f6124
[ "MIT" ]
null
null
null
config/prod.secret.exs
mikebobadilla/elixir-chat
e0955f9048dd088da8850a05dae5850a4e1f6124
[ "MIT" ]
2
2021-03-10T18:12:02.000Z
2021-05-11T14:11:28.000Z
config/prod.secret.exs
mikebobadilla/elixir-chat
e0955f9048dd088da8850a05dae5850a4e1f6124
[ "MIT" ]
null
null
null
# In this file, we load production configuration and secrets # from environment variables. You can also hardcode secrets, # although such is generally not recommended and you have to # remember to add this file to your .gitignore. use Mix.Config database_url = System.get_env("DATABASE_URL") || raise """ environment variable DATABASE_URL is missing. For example: ecto://USER:PASS@HOST/DATABASE """ config :elixir_chat, ElixirChat.Repo, # ssl: true, url: database_url, pool_size: String.to_integer(System.get_env("POOL_SIZE") || "2") secret_key_base = System.get_env("SECRET_KEY_BASE") || raise """ environment variable SECRET_KEY_BASE is missing. You can generate one by calling: mix phx.gen.secret """ config :elixir_chat, ElixirChatWeb.Endpoint, http: [ port: String.to_integer(System.get_env("PORT") || "4000"), transport_options: [socket_opts: [:inet6]] ], secret_key_base: secret_key_base # ## Using releases (Elixir v1.9+) # # If you are doing OTP releases, you need to instruct Phoenix # to start each relevant endpoint: # # config :elixir_chat, ElixirChatWeb.Endpoint, server: true # # Then you can assemble a release by calling `mix release`. # See `mix help release` for more information.
30.119048
66
0.72332
7919b03d7b562e53d87601bf84dc11ce6c544995
1,668
ex
Elixir
clients/domains/lib/google_api/domains/v1alpha2/model/search_domains_response.ex
pojiro/elixir-google-api
928496a017d3875a1929c6809d9221d79404b910
[ "Apache-2.0" ]
1
2021-12-20T03:40:53.000Z
2021-12-20T03:40:53.000Z
clients/domains/lib/google_api/domains/v1alpha2/model/search_domains_response.ex
pojiro/elixir-google-api
928496a017d3875a1929c6809d9221d79404b910
[ "Apache-2.0" ]
1
2020-08-18T00:11:23.000Z
2020-08-18T00:44:16.000Z
clients/domains/lib/google_api/domains/v1alpha2/model/search_domains_response.ex
pojiro/elixir-google-api
928496a017d3875a1929c6809d9221d79404b910
[ "Apache-2.0" ]
null
null
null
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This file is auto generated by the elixir code generator program. # Do not edit this file manually. defmodule GoogleApi.Domains.V1alpha2.Model.SearchDomainsResponse do @moduledoc """ Response for the `SearchDomains` method. ## Attributes * `registerParameters` (*type:* `list(GoogleApi.Domains.V1alpha2.Model.RegisterParameters.t)`, *default:* `nil`) - Results of the domain name search. """ use GoogleApi.Gax.ModelBase @type t :: %__MODULE__{ :registerParameters => list(GoogleApi.Domains.V1alpha2.Model.RegisterParameters.t()) | nil } field(:registerParameters, as: GoogleApi.Domains.V1alpha2.Model.RegisterParameters, type: :list) end defimpl Poison.Decoder, for: GoogleApi.Domains.V1alpha2.Model.SearchDomainsResponse do def decode(value, options) do GoogleApi.Domains.V1alpha2.Model.SearchDomainsResponse.decode(value, options) end end defimpl Poison.Encoder, for: GoogleApi.Domains.V1alpha2.Model.SearchDomainsResponse do def encode(value, options) do GoogleApi.Gax.ModelBase.encode(value, options) end end
34.75
153
0.752998
7919b97694c6cfcb3cd66c4efa81fe1547a0cbd6
706
ex
Elixir
lib/my_app_web/gettext.ex
ViniciusLinharesAO/phx_api
22168407c0c037b4ae709306aa254cb7e1a16c6d
[ "MIT" ]
31
2019-10-29T11:08:32.000Z
2020-01-28T16:16:04.000Z
lib/my_app_web/gettext.ex
ViniciusLinharesAO/phx_api
22168407c0c037b4ae709306aa254cb7e1a16c6d
[ "MIT" ]
2
2020-04-11T21:56:21.000Z
2020-04-15T12:22:05.000Z
lib/my_app_web/gettext.ex
brandedux/phoenix_api
3613d3d2a232a0d39cd125bd09cceee876fbf475
[ "MIT" ]
1
2019-10-29T14:38:44.000Z
2019-10-29T14:38:44.000Z
defmodule MyAppWeb.Gettext do @moduledoc """ A module providing Internationalization with a gettext-based API. By using [Gettext](https://hexdocs.pm/gettext), your module gains a set of macros for translations, for example: import MyAppWeb.Gettext # Simple translation gettext("Here is the string to translate") # Plural translation ngettext("Here is the string to translate", "Here are the strings to translate", 3) # Domain-based translation dgettext("errors", "Here is the error message to translate") See the [Gettext Docs](https://hexdocs.pm/gettext) for detailed usage. """ use Gettext, otp_app: :my_app end
28.24
72
0.675637
7919cdcc3c3aeb5f7f27d6a0e4f2e70bb0c5c082
3,221
ex
Elixir
lib/thrift/generator/behaviour.ex
rchallapalli/elixir-thrift
729e3f616947a6c75762252bb2726221eea2e31b
[ "Apache-2.0" ]
null
null
null
lib/thrift/generator/behaviour.ex
rchallapalli/elixir-thrift
729e3f616947a6c75762252bb2726221eea2e31b
[ "Apache-2.0" ]
null
null
null
lib/thrift/generator/behaviour.ex
rchallapalli/elixir-thrift
729e3f616947a6c75762252bb2726221eea2e31b
[ "Apache-2.0" ]
null
null
null
defmodule Thrift.Generator.Behaviour do @moduledoc """ A generator for a handler module's behaviour. Takes a thrift service definition and creates a behavoiur module for users to implement. Thrift types are converted into Elixir typespecs that are equivalent to their thrift counterparts. """ alias Thrift.AST.{ Exception, Field, Struct, TypeRef, TEnum, Union, } alias Thrift.Generator.Utils alias Thrift.Parser.FileGroup require Logger def generate(schema, service) do file_group = schema.file_group dest_module = Module.concat(FileGroup.dest_module(file_group, service), Handler) callbacks = service.functions |> Map.values |> Enum.map(&create_callback(file_group, &1)) behaviour_module = quote do defmodule unquote(dest_module) do unquote_splicing(callbacks) end end {dest_module, behaviour_module} end defp create_callback(file_group, function) do callback_name = Utils.underscore(function.name) return_type = typespec(function.return_type, file_group) params = function.params |> Enum.map(&FileGroup.resolve(file_group, &1)) |> Enum.map(&to_arg_spec(&1, file_group)) quote do @callback unquote(callback_name)(unquote_splicing(params)) :: unquote(return_type) end end def to_arg_spec(%Field{name: name, type: type}, file_group) do quote do unquote(Macro.var(name, nil)) :: unquote(typespec(type, file_group)) end end defp typespec(:void, _), do: quote do: no_return() defp typespec(:bool, _), do: quote do: boolean() defp typespec(:string, _), do: quote do: String.t defp typespec(:binary, _), do: quote do: binary defp typespec(:i8, _), do: quote do: Thrift.i8 defp typespec(:i16, _), do: quote do: Thrift.i16 defp typespec(:i32, _), do: quote do: Thrift.i32 defp typespec(:i64, _), do: quote do: Thrift.i64 defp typespec(:double, _), do: quote do: Thrift.double defp typespec(%TypeRef{} = ref, file_group) do file_group |> FileGroup.resolve(ref) |> typespec(file_group) end defp typespec(%TEnum{}, _) do quote do non_neg_integer end end defp typespec(%Union{name: name}, file_group) do dest_module = FileGroup.dest_module(file_group, name) quote do %unquote(dest_module){} end end defp typespec(%Exception{name: name}, file_group) do dest_module = FileGroup.dest_module(file_group, name) quote do %unquote(dest_module){} end end defp typespec(%Struct{name: name}, file_group) do dest_module = FileGroup.dest_module(file_group, name) quote do %unquote(dest_module){} end end defp typespec({:set, _t}, _) do quote do %MapSet{} end end defp typespec({:list, t}, file_group) do quote do [unquote(typespec(t, file_group))] end end defp typespec({:map, {k, v}}, file_group) do key_type = typespec(k, file_group) val_type = typespec(v, file_group) quote do %{unquote(key_type) => unquote(val_type)} end end defp typespec(unknown_typespec, _) do Logger.error("Unknown type: #{inspect unknown_typespec}. Falling back to any()") quote do any end end end
27.067227
88
0.678671
7919d6e3f662336311f9453d746a424f69f2f710
24,378
exs
Elixir
apps/astarte_realm_management/test/astarte_realm_management/engine_test.exs
matt-mazzucato/astarte
34d84941a5019efc42321052f7f34b7d907a38f2
[ "Apache-2.0" ]
null
null
null
apps/astarte_realm_management/test/astarte_realm_management/engine_test.exs
matt-mazzucato/astarte
34d84941a5019efc42321052f7f34b7d907a38f2
[ "Apache-2.0" ]
7
2018-03-23T10:53:06.000Z
2019-11-28T14:52:29.000Z
apps/astarte_realm_management/test/astarte_realm_management/engine_test.exs
matt-mazzucato/astarte
34d84941a5019efc42321052f7f34b7d907a38f2
[ "Apache-2.0" ]
2
2018-03-23T10:29:19.000Z
2019-11-19T15:10:24.000Z
# # This file is part of Astarte. # # Copyright 2017,2018 Ispirata Srl # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # defmodule Astarte.RealmManagement.EngineTest do use ExUnit.Case require Logger alias Astarte.Core.CQLUtils alias Astarte.DataAccess.Database alias Astarte.RealmManagement.DatabaseTestHelper alias Astarte.RealmManagement.Engine @test_interface_a_0 """ { "interface_name": "com.ispirata.Hemera.DeviceLog.Status", "version_major": 1, "version_minor": 0, "type": "properties", "ownership": "device", "mappings": [ { "endpoint": "/filterRules/%{ruleId}/%{filterKey}/value", "type": "string", "allow_unset": true } ] } """ @test_interface_a_1 """ { "interface_name": "com.ispirata.Hemera.DeviceLog.Status", "version_major": 1, "version_minor": 2, "type": "properties", "ownership": "device", "mappings": [ { "endpoint": "/filterRules/%{ruleId}/%{filterKey}/value", "type": "string", "allow_unset": true } ] } """ @test_interface_a_2 """ { "interface_name": "com.ispirata.Hemera.DeviceLog.Status", "version_major": 2, "version_minor": 2, "type": "properties", "ownership": "device", "mappings": [ { "endpoint": "/filterRules/%{ruleId}/%{filterKey}/value", "type": "string", "allow_unset": true } ] } """ @test_interface_a_name_mismatch """ { "interface_name": "com.ispirata.Hemera.devicelog.Status", "version_major": 2, "version_minor": 2, "type": "properties", "ownership": "device", "mappings": [ { "endpoint": "/filterRules/%{ruleId}/%{filterKey}/value", "type": "string", "allow_unset": true } ] } """ @test_interface_b_0 """ { "interface_name": "com.ispirata.Hemera.DeviceLog.Configuration", "version_major": 1, "version_minor": 0, "type": "properties", "ownership": "server", "mappings": [ { "endpoint": "/filterRules/%{ruleId}/%{filterKey}/value", "type": "string", "allow_unset": true } ] } """ @test_draft_interface_a_0 """ { "interface_name": "com.ispirata.Draft", "version_major": 0, "version_minor": 2, "type": "properties", "ownership": "server", "mappings": [ { "endpoint": "/filterRules/%{ruleId}/%{filterKey}/value", "type": "string", "allow_unset": true }, { "endpoint": "/filterRules/%{ruleId}/%{filterKey}/foo", "type": "boolean" } ] } """ @test_draft_interface_b_0 """ { "interface_name": "com.ObjectAggregation", "version_major": 0, "version_minor": 3, "type": "datastream", "ownership": "device", "aggregation": "object", "description": "Interface description.", "doc": "Interface documentation.", "mappings": [ { "endpoint": "/x", "type": "double", "explicit_timestamp": true }, { "endpoint": "/y", "type": "double", "explicit_timestamp": true } ] } """ @test_draft_interface_b_1 """ { "interface_name": "com.ObjectAggregation", "version_major": 0, "version_minor": 4, "type": "datastream", "ownership": "device", "aggregation": "object", "description": "Interface description.", "doc": "Interface documentation.", "mappings": [ { "endpoint": "/x", "type": "double", "explicit_timestamp": true }, { "endpoint": "/y", "type": "double", "explicit_timestamp": true }, { "endpoint": "/z", "type": "double", "explicit_timestamp": true }, { "endpoint": "/speed", "type": "double", "explicit_timestamp": true } ] } """ @test_draft_interface_c_0 """ { "interface_name": "com.ispirata.TestDatastream", "version_major": 0, "version_minor": 10, "type": "datastream", "ownership": "device", "mappings": [ { "endpoint": "/%{sensorId}/realValues", "type": "double", "description": "A real values test mapping.", "doc": "Real values mappings documentation." }, { "endpoint": "/%{sensorId}/integerValues", "type": "integer", "description": "A integer values test mapping." } ] } """ @test_draft_interface_c_1 """ { "interface_name": "com.ispirata.TestDatastream", "version_major": 0, "version_minor": 15, "type": "datastream", "ownership": "device", "mappings": [ { "endpoint": "/%{sensorId}/realValues", "type": "double", "description": "A real values test mapping.", "doc": "Real values mappings documentation." }, { "endpoint": "/%{sensorId}/integerValues", "type": "integer", "description": "A integer values test mapping." }, { "endpoint": "/%{sensorId}/stringValues", "type": "string" }, { "endpoint": "/testLong/something", "type": "longinteger" } ] } """ @test_draft_interface_c_downgrade """ { "interface_name": "com.ispirata.TestDatastream", "version_major": 0, "version_minor": 14, "type": "datastream", "ownership": "device", "mappings": [ { "endpoint": "/%{sensorId}/realValues", "type": "double" }, { "endpoint": "/%{sensorId}/integerValues", "type": "integer" }, { "endpoint": "/%{sensorId}/stringValues", "type": "string" }, { "endpoint": "/testLong/something/downgrade", "type": "longinteger" } ] } """ @test_draft_interface_c_invalid_change """ { "interface_name": "com.ispirata.TestDatastream", "version_major": 0, "version_minor": 15, "type": "properties", "ownership": "device", "mappings": [ { "endpoint": "/%{sensorId}/realValues", "type": "double" }, { "endpoint": "/%{sensorId}/integerValues", "type": "integer" }, { "endpoint": "/%{sensorId}/stringValues", "type": "string" }, { "endpoint": "/testLong/something", "type": "longinteger" } ] } """ @test_draft_interface_c_incompatible_change """ { "interface_name": "com.ispirata.TestDatastream", "version_major": 0, "version_minor": 15, "type": "datastream", "ownership": "device", "mappings": [ { "endpoint": "/%{sensorId}/realValues", "type": "double" }, { "endpoint": "/%{sensorId}/integerValues", "type": "double" }, { "endpoint": "/%{sensorId}/stringValues", "type": "string" }, { "endpoint": "/testLong/something", "type": "longinteger" } ] } """ @test_draft_interface_c_wrong_update """ { "interface_name": "com.ispirata.TestDatastream", "version_major": 0, "version_minor": 20, "type": "datastream", "ownership": "device", "mappings": [ { "endpoint": "/%{sensorId}/realValues", "type": "double" } ] } """ setup do with {:ok, client} <- DatabaseTestHelper.connect_to_test_database() do DatabaseTestHelper.seed_test_data(client) end end setup_all do with {:ok, client} <- DatabaseTestHelper.connect_to_test_database() do DatabaseTestHelper.create_test_keyspace(client) end on_exit(fn -> with {:ok, client} <- DatabaseTestHelper.connect_to_test_database() do DatabaseTestHelper.drop_test_keyspace(client) end end) end test "install interface" do assert Engine.get_interfaces_list("autotestrealm") == {:ok, []} assert Engine.install_interface("autotestrealm", @test_interface_a_0) == :ok assert Engine.install_interface("autotestrealm", @test_interface_b_0) == :ok assert Engine.install_interface("autotestrealm", @test_interface_a_1) == {:error, :already_installed_interface} assert Engine.install_interface("autotestrealm", @test_interface_a_2) == :ok # It is not possible to delete an interface with a major version different than 0 assert Engine.delete_interface("autotestrealm", "com.ispirata.Hemera.DeviceLog.Status", 1) == {:error, :forbidden} assert unpack_source( Engine.interface_source("autotestrealm", "com.ispirata.Hemera.DeviceLog.Status", 1) ) == unpack_source({:ok, @test_interface_a_0}) assert unpack_source( Engine.interface_source( "autotestrealm", "com.ispirata.Hemera.DeviceLog.Configuration", 1 ) ) == unpack_source({:ok, @test_interface_b_0}) assert unpack_source( Engine.interface_source("autotestrealm", "com.ispirata.Hemera.DeviceLog.Status", 2) ) == unpack_source({:ok, @test_interface_a_2}) assert unpack_source( Engine.interface_source( "autotestrealm", "com.ispirata.Hemera.DeviceLog.Missing", 1 ) ) == unpack_source({:error, :interface_not_found}) assert Engine.list_interface_versions( "autotestrealm", "com.ispirata.Hemera.DeviceLog.Configuration" ) == {:ok, [[major_version: 1, minor_version: 0]]} assert Engine.list_interface_versions( "autotestrealm", "com.ispirata.Hemera.DeviceLog.Missing" ) == {:error, :interface_not_found} {:ok, interfaces_list} = Engine.get_interfaces_list("autotestrealm") sorted_interfaces = interfaces_list |> Enum.sort() assert sorted_interfaces == [ "com.ispirata.Hemera.DeviceLog.Configuration", "com.ispirata.Hemera.DeviceLog.Status" ] end test "interface name case mismatch fail" do assert Engine.install_interface("autotestrealm", @test_interface_a_0) == :ok assert Engine.install_interface("autotestrealm", @test_interface_a_name_mismatch) == {:error, :invalid_name_casing} end test "delete interface" do assert Engine.install_interface("autotestrealm", @test_draft_interface_a_0) == :ok assert Engine.get_interfaces_list("autotestrealm") == {:ok, ["com.ispirata.Draft"]} assert unpack_source(Engine.interface_source("autotestrealm", "com.ispirata.Draft", 0)) == unpack_source({:ok, @test_draft_interface_a_0}) assert Engine.list_interface_versions("autotestrealm", "com.ispirata.Draft") == {:ok, [[major_version: 0, minor_version: 2]]} {:ok, client} = Database.connect("autotestrealm") d = :crypto.strong_rand_bytes(16) e1 = CQLUtils.endpoint_id( "com.ispirata.TestDatastream", 0, "/filterRules/%{ruleId}/%{filterKey}/value" ) p1 = "/filterRules/0/TEST/value" DatabaseTestHelper.seed_properties_test_value(client, d, "com.ispirata.Draft", 0, e1, p1) assert DatabaseTestHelper.count_interface_properties_for_device( client, d, "com.ispirata.Draft", 0 ) == 1 assert Engine.delete_interface("autotestrealm", "com.ispirata.Draft", 0) == :ok assert DatabaseTestHelper.count_interface_properties_for_device( client, d, "com.ispirata.Draft", 0 ) == 0 assert Engine.get_interfaces_list("autotestrealm") == {:ok, []} assert Engine.interface_source("autotestrealm", "com.ispirata.Draft", 0) == {:error, :interface_not_found} assert Engine.list_interface_versions("autotestrealm", "com.ispirata.Draft") == {:error, :interface_not_found} assert Engine.install_interface("autotestrealm", @test_draft_interface_a_0) == :ok assert Engine.get_interfaces_list("autotestrealm") == {:ok, ["com.ispirata.Draft"]} assert unpack_source(Engine.interface_source("autotestrealm", "com.ispirata.Draft", 0)) == unpack_source({:ok, @test_draft_interface_a_0}) assert Engine.list_interface_versions("autotestrealm", "com.ispirata.Draft") == {:ok, [[major_version: 0, minor_version: 2]]} end test "install object aggregated interface" do assert Engine.install_interface("autotestrealm", @test_draft_interface_b_0) == :ok assert Engine.get_interfaces_list("autotestrealm") == {:ok, ["com.ObjectAggregation"]} assert Engine.list_interface_versions("autotestrealm", "com.ObjectAggregation") == {:ok, [[major_version: 0, minor_version: 3]]} assert Engine.delete_interface("autotestrealm", "com.ObjectAggregation", 0) == :ok assert Engine.get_interfaces_list("autotestrealm") == {:ok, []} assert Engine.list_interface_versions("autotestrealm", "com.ObjectAggregation") == {:error, :interface_not_found} # Try again so we can verify if it has been completely deleted assert Engine.install_interface("autotestrealm", @test_draft_interface_b_0) == :ok assert Engine.get_interfaces_list("autotestrealm") == {:ok, ["com.ObjectAggregation"]} assert Engine.list_interface_versions("autotestrealm", "com.ObjectAggregation") == {:ok, [[major_version: 0, minor_version: 3]]} assert Engine.delete_interface("autotestrealm", "com.ObjectAggregation", 0) == :ok end test "delete datastream interface" do assert Engine.install_interface("autotestrealm", @test_draft_interface_c_0) == :ok assert Engine.get_interfaces_list("autotestrealm") == {:ok, ["com.ispirata.TestDatastream"]} assert Engine.list_interface_versions("autotestrealm", "com.ispirata.TestDatastream") == {:ok, [[major_version: 0, minor_version: 10]]} {:ok, client} = Database.connect("autotestrealm") d = :crypto.strong_rand_bytes(16) e1 = CQLUtils.endpoint_id("com.ispirata.TestDatastream", 0, "/%{sensorId}/realValues") p1 = "/0/realValues" DatabaseTestHelper.seed_datastream_test_data( client, d, "com.ispirata.TestDatastream", 0, e1, p1 ) e2 = CQLUtils.endpoint_id("com.ispirata.TestDatastream", 0, "/%{sensorId}/integerValues") p2 = "/0/integerValues" DatabaseTestHelper.seed_datastream_test_data( client, d, "com.ispirata.TestDatastream", 0, e2, p2 ) assert Engine.delete_interface("autotestrealm", "com.ispirata.TestDatastream", 0) == :ok assert DatabaseTestHelper.count_rows_for_datastream( client, d, "com.ispirata.TestDatastream", 0, e1, p1 ) == 0 assert DatabaseTestHelper.count_rows_for_datastream( client, d, "com.ispirata.TestDatastream", 0, e2, p2 ) == 0 end test "update individual datastream interface" do assert Engine.install_interface("autotestrealm", @test_draft_interface_c_0) == :ok assert unpack_source( Engine.interface_source("autotestrealm", "com.ispirata.TestDatastream", 0) ) == unpack_source({:ok, @test_draft_interface_c_0}) assert Engine.get_interfaces_list("autotestrealm") == {:ok, ["com.ispirata.TestDatastream"]} assert Engine.list_interface_versions("autotestrealm", "com.ispirata.TestDatastream") == {:ok, [[major_version: 0, minor_version: 10]]} assert Engine.update_interface("autotestrealm", @test_draft_interface_c_1) == :ok assert unpack_source( Engine.interface_source("autotestrealm", "com.ispirata.TestDatastream", 0) ) == unpack_source({:ok, @test_draft_interface_c_1}) assert Engine.get_interfaces_list("autotestrealm") == {:ok, ["com.ispirata.TestDatastream"]} assert Engine.list_interface_versions("autotestrealm", "com.ispirata.TestDatastream") == {:ok, [[major_version: 0, minor_version: 15]]} end test "update object aggregated interface" do assert Engine.install_interface("autotestrealm", @test_draft_interface_b_0) == :ok assert unpack_source(Engine.interface_source("autotestrealm", "com.ObjectAggregation", 0)) == unpack_source({:ok, @test_draft_interface_b_0}) assert Engine.get_interfaces_list("autotestrealm") == {:ok, ["com.ObjectAggregation"]} assert Engine.list_interface_versions("autotestrealm", "com.ObjectAggregation") == {:ok, [[major_version: 0, minor_version: 3]]} assert Engine.update_interface("autotestrealm", @test_draft_interface_b_1) == :ok assert unpack_source(Engine.interface_source("autotestrealm", "com.ObjectAggregation", 0)) == unpack_source({:ok, @test_draft_interface_b_1}) assert Engine.get_interfaces_list("autotestrealm") == {:ok, ["com.ObjectAggregation"]} assert Engine.list_interface_versions("autotestrealm", "com.ObjectAggregation") == {:ok, [[major_version: 0, minor_version: 4]]} assert Engine.delete_interface("autotestrealm", "com.ObjectAggregation", 0) == :ok assert Engine.get_interfaces_list("autotestrealm") == {:ok, []} end test "fail update missing interface" do assert Engine.update_interface("autotestrealm", @test_draft_interface_b_1) == {:error, :interface_major_version_does_not_exist} assert Engine.update_interface("autotestrealm", @test_draft_interface_c_1) == {:error, :interface_major_version_does_not_exist} end test "fail update with less mappings" do assert Engine.install_interface("autotestrealm", @test_draft_interface_c_0) == :ok assert Engine.get_interfaces_list("autotestrealm") == {:ok, ["com.ispirata.TestDatastream"]} assert Engine.list_interface_versions("autotestrealm", "com.ispirata.TestDatastream") == {:ok, [[major_version: 0, minor_version: 10]]} assert Engine.update_interface("autotestrealm", @test_draft_interface_c_wrong_update) == {:error, :missing_endpoints} assert Engine.get_interfaces_list("autotestrealm") == {:ok, ["com.ispirata.TestDatastream"]} assert Engine.list_interface_versions("autotestrealm", "com.ispirata.TestDatastream") == {:ok, [[major_version: 0, minor_version: 10]]} assert Engine.update_interface("autotestrealm", @test_draft_interface_c_1) == :ok assert unpack_source( Engine.interface_source("autotestrealm", "com.ispirata.TestDatastream", 0) ) == unpack_source({:ok, @test_draft_interface_c_1}) assert Engine.install_interface("autotestrealm", @test_draft_interface_c_wrong_update) == {:error, :already_installed_interface} assert Engine.get_interfaces_list("autotestrealm") == {:ok, ["com.ispirata.TestDatastream"]} assert Engine.list_interface_versions("autotestrealm", "com.ispirata.TestDatastream") == {:ok, [[major_version: 0, minor_version: 15]]} end test "fail on interface type change" do assert Engine.install_interface("autotestrealm", @test_draft_interface_c_0) == :ok assert Engine.get_interfaces_list("autotestrealm") == {:ok, ["com.ispirata.TestDatastream"]} assert Engine.list_interface_versions("autotestrealm", "com.ispirata.TestDatastream") == {:ok, [[major_version: 0, minor_version: 10]]} assert Engine.update_interface("autotestrealm", @test_draft_interface_c_invalid_change) == {:error, :invalid_update} assert unpack_source( Engine.interface_source("autotestrealm", "com.ispirata.TestDatastream", 0) ) == unpack_source({:ok, @test_draft_interface_c_0}) assert Engine.get_interfaces_list("autotestrealm") == {:ok, ["com.ispirata.TestDatastream"]} assert Engine.list_interface_versions("autotestrealm", "com.ispirata.TestDatastream") == {:ok, [[major_version: 0, minor_version: 10]]} end test "fail on mapping incompatible change" do assert Engine.install_interface("autotestrealm", @test_draft_interface_c_0) == :ok assert Engine.get_interfaces_list("autotestrealm") == {:ok, ["com.ispirata.TestDatastream"]} assert Engine.list_interface_versions("autotestrealm", "com.ispirata.TestDatastream") == {:ok, [[major_version: 0, minor_version: 10]]} assert Engine.update_interface("autotestrealm", @test_draft_interface_c_incompatible_change) == {:error, :incompatible_endpoint_change} assert unpack_source( Engine.interface_source("autotestrealm", "com.ispirata.TestDatastream", 0) ) == unpack_source({:ok, @test_draft_interface_c_0}) assert Engine.get_interfaces_list("autotestrealm") == {:ok, ["com.ispirata.TestDatastream"]} assert Engine.list_interface_versions("autotestrealm", "com.ispirata.TestDatastream") == {:ok, [[major_version: 0, minor_version: 10]]} end test "fail on interface downgrade" do assert Engine.install_interface("autotestrealm", @test_draft_interface_c_0) == :ok assert unpack_source( Engine.interface_source("autotestrealm", "com.ispirata.TestDatastream", 0) ) == unpack_source({:ok, @test_draft_interface_c_0}) assert Engine.list_interface_versions("autotestrealm", "com.ispirata.TestDatastream") == {:ok, [[major_version: 0, minor_version: 10]]} assert Engine.update_interface("autotestrealm", @test_draft_interface_c_1) == :ok assert unpack_source( Engine.interface_source("autotestrealm", "com.ispirata.TestDatastream", 0) ) == unpack_source({:ok, @test_draft_interface_c_1}) assert Engine.list_interface_versions("autotestrealm", "com.ispirata.TestDatastream") == {:ok, [[major_version: 0, minor_version: 15]]} assert Engine.update_interface("autotestrealm", @test_draft_interface_c_downgrade) == {:error, :downgrade_not_allowed} assert unpack_source( Engine.interface_source("autotestrealm", "com.ispirata.TestDatastream", 0) ) == unpack_source({:ok, @test_draft_interface_c_1}) assert Engine.list_interface_versions("autotestrealm", "com.ispirata.TestDatastream") == {:ok, [[major_version: 0, minor_version: 15]]} end test "get JWT public key PEM with existing realm" do assert Engine.get_jwt_public_key_pem("autotestrealm") == {:ok, DatabaseTestHelper.jwt_public_key_pem_fixture()} end test "get JWT public key PEM with unexisting realm" do assert Engine.get_jwt_public_key_pem("notexisting") == {:error, :realm_not_found} end test "update JWT public key PEM" do new_pem = "not_exactly_a_PEM_but_will_do" assert Engine.update_jwt_public_key_pem("autotestrealm", new_pem) == :ok assert Engine.get_jwt_public_key_pem("autotestrealm") == {:ok, new_pem} # Put the PEM fixture back assert Engine.update_jwt_public_key_pem( "autotestrealm", DatabaseTestHelper.jwt_public_key_pem_fixture() ) == :ok assert Engine.get_jwt_public_key_pem("autotestrealm") == {:ok, DatabaseTestHelper.jwt_public_key_pem_fixture()} end test "update JWT public key PEM with unexisting realm" do assert Engine.get_jwt_public_key_pem("notexisting") == {:error, :realm_not_found} end defp unpack_source({:ok, source}) when is_binary(source) do interface_obj = Jason.decode!(source) mappings = interface_obj["mappings"] |> Enum.sort() new_obj = Map.put(interface_obj, "mappings", mappings) {:ok, new_obj} end defp unpack_source(any) do any end end
31.253846
99
0.633973
791a1582c6243a2d32103113ac6dc5795b569d7c
194
ex
Elixir
lib/remote_retro_web/plugs/set_current_user.ex
notactuallypagemcconnell/remote_retro
972e24ee3d7132a1646473ebb3b6b2fda4d6bf2e
[ "MIT" ]
null
null
null
lib/remote_retro_web/plugs/set_current_user.ex
notactuallypagemcconnell/remote_retro
972e24ee3d7132a1646473ebb3b6b2fda4d6bf2e
[ "MIT" ]
null
null
null
lib/remote_retro_web/plugs/set_current_user.ex
notactuallypagemcconnell/remote_retro
972e24ee3d7132a1646473ebb3b6b2fda4d6bf2e
[ "MIT" ]
null
null
null
defmodule SetCurrentUser do import Plug.Conn def init(options) do options end def call(conn, _) do conn |> assign(:current_user, get_session(conn, :current_user)) end end
16.166667
62
0.690722
791a1bce424749808675926868b88306684fdc4f
1,153
ex
Elixir
apps/core/test/support/channel_case.ex
votiakov/petal
ec03551da6dadc0c3482b25a5f5dcd400c36db43
[ "MIT" ]
null
null
null
apps/core/test/support/channel_case.ex
votiakov/petal
ec03551da6dadc0c3482b25a5f5dcd400c36db43
[ "MIT" ]
null
null
null
apps/core/test/support/channel_case.ex
votiakov/petal
ec03551da6dadc0c3482b25a5f5dcd400c36db43
[ "MIT" ]
null
null
null
defmodule Legendary.CoreWeb.ChannelCase do @moduledoc """ This module defines the test case to be used by channel tests. Such tests rely on `Phoenix.ChannelTest` and also import other functionality to make it easier to build common data structures and query the data layer. Finally, if the test case interacts with the database, we enable the SQL sandbox, so changes done to the database are reverted at the end of every test. If you are using PostgreSQL, you can even run database tests asynchronously by setting `use Legendary.CoreWeb.ChannelCase, async: true`, although this option is not recommended for other databases. """ use ExUnit.CaseTemplate using do quote do # Import conveniences for testing with channels import Phoenix.ChannelTest import Legendary.CoreWeb.ChannelCase # The default endpoint for testing @endpoint Legendary.CoreWeb.Endpoint end end setup tags do :ok = Ecto.Adapters.SQL.Sandbox.checkout(Legendary.Core.Repo) unless tags[:async] do Ecto.Adapters.SQL.Sandbox.mode(Legendary.Core.Repo, {:shared, self()}) end :ok end end
28.121951
76
0.732003
791a21ec7e93e16f441ff65146a34043ac483360
3,369
ex
Elixir
lib/surface/components/context.ex
capitalist/surface
f1c75f92513b607c98ba578030a647e0f5d6d11c
[ "MIT" ]
null
null
null
lib/surface/components/context.ex
capitalist/surface
f1c75f92513b607c98ba578030a647e0f5d6d11c
[ "MIT" ]
null
null
null
lib/surface/components/context.ex
capitalist/surface
f1c75f92513b607c98ba578030a647e0f5d6d11c
[ "MIT" ]
null
null
null
defmodule Surface.Components.Context do @moduledoc """ A built-in component that allows users to set and retrieve values from the context. """ use Surface.Component @doc """ Puts a value into the context. ## Usage ``` <Context put={{ scope, values }}> ... </Context> ``` Where: * `scope` - Optional. Is an atom representing the scope where the values will be stored. If no scope is provided, the value is stored at the root of the context map. * `values`- A keyword list containing the key-value pairs that will be stored in the context. ## Examples With scope: ``` <Context put={{ __MODULE__, form: @form }}> ... </Context> ``` Without scope: ``` <Context put={{ key1: @value1, key2: "some other value" }}> ... </Context> ``` """ prop put, :context_put, accumulate: true, default: [] @doc """ Retrieves a set of values from the context binding them to local variables. ## Usage ``` <Context get={{ scope, bindings }}> ... </Context> ``` Where: * `scope` - Optional. Is an atom representing the scope where the values will be stored. If no scope is provided, the value is stored at the root of the context map. * `bindings`- A keyword list of bindings that will be retrieved from the context as local variables. ## Examples ``` <Context get={{ Form, form: form }} get={{ Field, field: my_field }}> <MyTextInput form={{ form }} field={{ my_field }} /> </Context> ``` """ prop get, :context_get, accumulate: true, default: [] @doc "The content of the `<Context>`" slot default, required: true def transform(node) do Module.put_attribute(node.meta.caller.module, :use_context?, true) let = node.props |> Enum.filter(fn %{name: name} -> name == :get end) |> Enum.map(fn %{value: %{value: value}} -> value end) |> Enum.flat_map(fn {scope, values} -> if scope == nil do values else Enum.map(values, fn {key, value} -> {{scope, key}, value} end) end end) update_let_for_template(node, :default, let) end def render(assigns) do ~H""" {{ case context_map(@__context__, @put, @get) do {ctx, props} -> render_inner(@inner_content, {:__default__, 0, props, ctx}) end }} """ end defp context_map(context, puts, gets) do ctx = for {scope, values} <- puts, {key, value} <- values, reduce: context do acc -> {full_key, value} = normalize_set(scope, key, value) Map.put(acc, full_key, value) end props = for {scope, values} <- gets, {key, _value} <- values, into: %{} do key = if scope == nil do key else {scope, key} end {key, Map.get(ctx, key, nil)} end {ctx, props} end defp normalize_set(nil, key, value) do {key, value} end defp normalize_set(scope, key, value) do {{scope, key}, value} end defp update_let_for_template(node, template_name, let) do updated = node.templates |> Map.get(template_name, []) |> Enum.map(fn template -> %{template | let: let} end) templates = Map.put(node.templates, template_name, updated) Map.put(node, :templates, templates) end end
21.876623
85
0.584743
791a2d5dbdf42947202f8b27a4353667df59547b
1,127
ex
Elixir
lib/exonerate/filter/max_contains.ex
ityonemo/Exonerate
42b888c156c9179d222b78609d34c07f0b887eaf
[ "MIT" ]
14
2021-01-14T20:14:30.000Z
2022-01-28T00:58:07.000Z
lib/exonerate/filter/max_contains.ex
ityonemo/Exonerate
42b888c156c9179d222b78609d34c07f0b887eaf
[ "MIT" ]
13
2019-09-11T17:48:48.000Z
2021-11-22T23:02:44.000Z
lib/exonerate/filter/max_contains.ex
ityonemo/Exonerate
42b888c156c9179d222b78609d34c07f0b887eaf
[ "MIT" ]
1
2021-09-12T13:08:54.000Z
2021-09-12T13:08:54.000Z
defmodule Exonerate.Filter.MaxContains do @moduledoc false @behaviour Exonerate.Filter @derive Exonerate.Compiler @derive {Inspect, except: [:context]} alias Exonerate.Validator import Validator, only: [fun: 2] defstruct [:context, :maximum] def parse(artifact = %{context: context}, %{"contains" => _, "maxContains" => maximum}) do %{artifact | needs_accumulator: true, accumulator_pipeline: [fun(artifact, "maxContains") | artifact.accumulator_pipeline], accumulator_init: Map.put_new(artifact.accumulator_init, :contains, 0), filters: [%__MODULE__{context: context, maximum: maximum} | artifact.filters]} end def parse(artifact, %{"maxContains" => _}), do: artifact # ignore when there is no "contains" def compile(filter = %__MODULE__{maximum: maximum}) do {[], [ quote do defp unquote(fun(filter, "maxContains"))(%{contains: contains}, {path, array}) when contains > unquote(maximum) do Exonerate.mismatch(array, path) end defp unquote(fun(filter, "maxContains"))(acc, {_path, _array}), do: acc end ]} end end
33.147059
122
0.673469
791a5bebd4c9bf243bc8e4fc3fe8a4f4b9025f12
15,602
ex
Elixir
lib/wax/metadata.ex
4eek/wax
eee7c5460267dce2cd8fe76df2e05f46e90e50b6
[ "Apache-2.0" ]
null
null
null
lib/wax/metadata.ex
4eek/wax
eee7c5460267dce2cd8fe76df2e05f46e90e50b6
[ "Apache-2.0" ]
null
null
null
lib/wax/metadata.ex
4eek/wax
eee7c5460267dce2cd8fe76df2e05f46e90e50b6
[ "Apache-2.0" ]
null
null
null
defmodule Wax.Metadata do require Logger use GenServer @moduledoc false @fido_alliance_root_cer_der \ """ -----BEGIN CERTIFICATE----- MIICQzCCAcigAwIBAgIORqmxkzowRM99NQZJurcwCgYIKoZIzj0EAwMwUzELMAkG A1UEBhMCVVMxFjAUBgNVBAoTDUZJRE8gQWxsaWFuY2UxHTAbBgNVBAsTFE1ldGFk YXRhIFRPQyBTaWduaW5nMQ0wCwYDVQQDEwRSb290MB4XDTE1MDYxNzAwMDAwMFoX DTQ1MDYxNzAwMDAwMFowUzELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUZJRE8gQWxs aWFuY2UxHTAbBgNVBAsTFE1ldGFkYXRhIFRPQyBTaWduaW5nMQ0wCwYDVQQDEwRS b290MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEFEoo+6jdxg6oUuOloqPjK/nVGyY+ AXCFz1i5JR4OPeFJs+my143ai0p34EX4R1Xxm9xGi9n8F+RxLjLNPHtlkB3X4ims rfIx7QcEImx1cMTgu5zUiwxLX1ookVhIRSoso2MwYTAOBgNVHQ8BAf8EBAMCAQYw DwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU0qUfC6f2YshA1Ni9udeO0VS7vEYw HwYDVR0jBBgwFoAU0qUfC6f2YshA1Ni9udeO0VS7vEYwCgYIKoZIzj0EAwMDaQAw ZgIxAKulGbSFkDSZusGjbNkAhAkqTkLWo3GrN5nRBNNk2Q4BlG+AvM5q9wa5WciW DcMdeQIxAMOEzOFsxX9Bo0h4LOFE5y5H8bdPFYW+l5gy1tQiJv+5NUyM2IBB55XU YjdBz56jSA== -----END CERTIFICATE----- """ |> X509.Certificate.from_pem!() |> X509.Certificate.to_der() @table :wax_metadata @crl_uris [ "http://mds.fidoalliance.org/Root.crl", "http://mds.fidoalliance.org/CA-1.crl" ] # client API def start_link do GenServer.start_link(__MODULE__, %{}, name: __MODULE__) end @spec get_by_aaguid(binary(), Wax.Challenge.t()) :: Wax.Metadata.Statement.t() | nil def get_by_aaguid( aaguid_bin, %Wax.Challenge{acceptable_authenticator_statuses: acceptable_authenticator_statuses} ) do # it is needed to convert binary aaguid (16 bytes) to its string representation as # used in the metadata service, such as `77010bd7-212a-4fc9-b236-d2ca5e9d4084` << a::binary-size(8), b::binary-size(4), c::binary-size(4), d::binary-size(4), e::binary-size(12) >> = Base.encode16(aaguid_bin, case: :lower) aaguid_str = a <> "-" <> b <> "-" <> c <> "-" <> d <> "-" <> e case GenServer.call(__MODULE__, {:get, {:aaguid, aaguid_str}}) do {nil, metadata_statement} -> metadata_statement {toc_entry, metadata_statement} -> if authenticator_status_allowed?(toc_entry, acceptable_authenticator_statuses) do metadata_statement else Logger.warn( "Authenticator `#{metadata_statement}` was not used because its status is " <> "not whitelisted (TOC entry: `#{toc_entry}`)" ) nil end _ -> nil end end @spec get_by_acki(binary(), Wax.Challenge.t()) :: Wax.Metadata.Statement.t() | nil def get_by_acki( acki_bin, %Wax.Challenge{acceptable_authenticator_statuses: acceptable_authenticator_statuses} ) do acki_str = Base.encode16(acki_bin, case: :lower) case GenServer.call(__MODULE__, {:get, {:acki, acki_str}}) do {nil, metadata_statement} -> metadata_statement {toc_entry, metadata_statement} -> if authenticator_status_allowed?(toc_entry, acceptable_authenticator_statuses) do metadata_statement else Logger.warn( "Authenticator `#{metadata_statement}` was not used because its status is " <> "not whitelisted (TOC entry: `#{toc_entry}`)" ) nil end nil -> nil end end @spec authenticator_status_allowed?(map(), [Wax.Metadata.TOCEntry.StatusReport.status()]) :: bool() defp authenticator_status_allowed?( %{status_reports: status_reports}, acceptable_authenticator_statuses ) do latest_report = List.last(status_reports) latest_report.status in acceptable_authenticator_statuses end # server callbacks @impl true def init(_state) do :ets.new(@table, [:named_table, :set, :protected, {:read_concurrency, true}]) {:ok, [serial_number: 0], {:continue, :update_metadata}} end @impl true def handle_continue(:update_metadata, state) do serial_number = case update_metadata(state[:serial_number]) do new_serial_number when is_integer(new_serial_number) -> new_serial_number _ -> state[:serial_number] end schedule_update() Process.send(self(), :update_from_file, []) {:noreply, [serial_number: serial_number]} end @impl true def handle_call({:get, {type, value}}, _from, state) do case :ets.lookup(@table, {type, value}) do [{_, toc_payload_entry, metadata_statement, _source}] -> {:reply, {toc_payload_entry, metadata_statement}, state} _ -> {:reply, nil, state} end end def handle_call(_, _, state), do: {:noreply, state} @impl true def handle_cast(_, state), do: {:noreply, state} @impl true def handle_info(:update_metadata, state) do serial_number = case update_metadata(state[:serial_number]) do new_serial_number when is_integer(new_serial_number) -> new_serial_number _ -> state[:serial_number] end schedule_update() {:noreply, [serial_number: serial_number]} end def handle_info(:update_from_file, state) do load_from_dir() {:noreply, state} end def handle_info(reason, state) do Logger.debug("#{__MODULE__}: received handle_info/2 message: #{inspect(reason)}") {:noreply, state} end defp schedule_update() do Process.send_after(self(), :update_metadata, Application.get_env(:wax, :metadata_update_interval, 12 * 3600) * 1000) end def update_metadata(serial_number) do Logger.info("Starting FIDO metadata update process") access_token = Application.get_env(:wax, :metadata_access_token) if access_token do case HTTPoison.get("https://mds2.fidoalliance.org/?token=" <> access_token) do {:ok, %HTTPoison.Response{status_code: 200, body: jws_toc}} -> process_metadata_toc(jws_toc, serial_number) e -> Logger.warn("Unable to download metadata (#{inspect(e)})") :not_updated end else Logger.warn("No access token configured for FIDO metadata, metadata not updated. " <> "Some attestation formats and types won't be supported") :not_updated end end @spec process_metadata_toc(String.t(), non_neg_integer()) :: non_neg_integer() | :not_updated defp process_metadata_toc(jws, serial_number) do case Wax.Utils.JWS.verify_with_x5c(jws, @fido_alliance_root_cer_der, @crl_uris) do :ok -> {%{"alg" => alg}, metadata} = parse_jwt(jws) if metadata["no"] > serial_number do # one of sha256, sha512, etc digest_alg = digest_from_jws_alg(alg) tasks = Enum.map( metadata["entries"], fn entry -> Task.async(fn -> get_metadata_statement(entry, digest_alg) end) end ) toc_payload_entry = Enum.map(metadata["entries"], &build_toc_payload_entry/1) :ets.match_delete(:wax_metadata, {:_, :_, :_, :MDSv2}) Enum.each( Enum.zip(toc_payload_entry, tasks), fn {toc_entry, task} -> metadata_statement = Task.await(task) case metadata_statement do %Wax.Metadata.Statement{} -> save_metadata_statement(metadata_statement, :MDSv2, toc_entry) _ -> Logger.error("Failed to load data for TOC entry `#{inspect(toc_entry)}`") :ok end end ) metadata["no"] else Logger.info("Metadata not updated (`no` has not changed)") :not_updated end {:error, reason} -> Logger.warn( "Invalid TOC metadata JWS signature, metadata not updated #{inspect(reason)}") end rescue _e -> {:error, :crl_retrieval_failed} end @spec get_metadata_statement(map(), atom()) :: Wax.Metadata.Statement.t() | :error def get_metadata_statement(entry, digest_alg) do HTTPoison.get( entry["url"] <> "?token=" <> Application.get_env(:wax, :metadata_access_token), [], follow_redirect: true) |> case do {:ok, %HTTPoison.Response{status_code: 200, body: body}} -> if :crypto.hash(digest_alg, body) == Base.url_decode64!(entry["hash"], padding: false) do body |> Base.url_decode64!() |> Jason.decode!() |> Wax.Metadata.Statement.from_json!() else Logger.warn("Invalid hash for metadata entry at " <> entry["url"]) :error end {:error, reason} -> Logger.warn( "Failed to download metadata statement at #{entry["url"]} (reason: #{inspect(reason)})" ) :error end end @spec parse_jwt(binary()) :: {map(), map()} defp parse_jwt(binary) do [header_b64, body_b64, _sig] = String.split(binary, ".") { header_b64 |> Base.url_decode64!(padding: false) |> Jason.decode!(), body_b64 |> Base.url_decode64!(padding: false) |> Jason.decode!(), } end @spec build_toc_payload_entry(map()) :: Wax.Metadata.TOCEntry.t() defp build_toc_payload_entry(entry) do %Wax.Metadata.TOCEntry{ aaid: entry["aaid"], aaguid: entry["aaguid"], attestation_certificate_key_identifiers: entry["attestationCertificateKeyIdentifiers"], hash: entry["hash"], url: entry["url"], biometric_status_reports: Enum.map(entry["biometricStatusReports"] || [], &build_biometric_status_report/1), status_reports: Enum.map(entry["statusReports"], &build_status_report/1), time_of_last_status_change: if entry["timeOfLastStatusChange"] do Date.from_iso8601!(entry["timeOfLastStatusChange"]) end, rogue_list_url: entry["rogueListURL"], rogue_list_hash: entry["rogueListHash"] } end @spec build_biometric_status_report(map()) :: Wax.Metadata.TOCEntry.BiometricStatusReport.t() defp build_biometric_status_report(status) do %Wax.Metadata.TOCEntry.BiometricStatusReport{ cert_level: status["certLevel"], modality: status["modality"], effective_date: if status["effectiveDate"] do Date.from_iso8601!(status["effectiveDate"]) end, certification_descriptor: status["certificationDescriptor"], certificate_number: status["certificateNumber"], certification_policy_version: status["certificationPolicyVersion"], certification_requirements_version: status["certificationRequirementsVersion"] } end @spec build_status_report(map()) :: Wax.Metadata.TOCEntry.StatusReport.t() defp build_status_report(status) do %Wax.Metadata.TOCEntry.StatusReport{ status: authenticator_status(status["status"]), effective_date: if status["effectiveDate"] do Date.from_iso8601!(status["effectiveDate"]) end, certificate: status["certificate"], url: status["url"], certification_descriptor: status["certificationDescriptor"], certificate_number: status["certificateNumber"], certification_policy_version: status["certificationPolicyVersion"], certification_requirements_version: status["certificationRequirementsVersion"] } end @spec authenticator_status(String.t()) :: Wax.Metadata.TOCEntry.StatusReport.status() defp authenticator_status("NOT_FIDO_CERTIFIED"), do: :not_fido_certified defp authenticator_status("FIDO_CERTIFIED"), do: :fido_certified defp authenticator_status("USER_VERIFICATION_BYPASS"), do: :user_verification_bypass defp authenticator_status("ATTESTATION_KEY_COMPROMISE"), do: :attestation_key_compromise defp authenticator_status("USER_KEY_REMOTE_COMPROMISE"), do: :user_key_remote_compromise defp authenticator_status("USER_KEY_PHYSICAL_COMPROMISE"), do: :user_key_physical_compromise defp authenticator_status("UPDATE_AVAILABLE"), do: :update_available defp authenticator_status("REVOKED"), do: :revoked defp authenticator_status("SELF_ASSERTION_SUBMITTED"), do: :self_assertion_submitted defp authenticator_status("FIDO_CERTIFIED_L1"), do: :fido_certified_l1 defp authenticator_status("FIDO_CERTIFIED_L1plus"), do: :fido_certified_l1plus defp authenticator_status("FIDO_CERTIFIED_L2"), do: :fido_certified_l2 defp authenticator_status("FIDO_CERTIFIED_L2plus"), do: :fido_certified_l2plus defp authenticator_status("FIDO_CERTIFIED_L3"), do: :fido_certified_l3 defp authenticator_status("FIDO_CERTIFIED_L3plus"), do: :fido_certified_l3plus #see section 3.1 of https://www.rfc-editor.org/rfc/rfc7518.txt @spec digest_from_jws_alg(String.t()) :: atom() defp digest_from_jws_alg("HS256"), do: :sha256 defp digest_from_jws_alg("HS384"), do: :sha384 defp digest_from_jws_alg("HS512"), do: :sha512 defp digest_from_jws_alg("RS256"), do: :sha256 defp digest_from_jws_alg("RS384"), do: :sha384 defp digest_from_jws_alg("RS512"), do: :sha512 defp digest_from_jws_alg("ES256"), do: :sha256 defp digest_from_jws_alg("ES384"), do: :sha384 defp digest_from_jws_alg("ES512"), do: :sha512 defp digest_from_jws_alg("PS256"), do: :sha256 defp digest_from_jws_alg("PS384"), do: :sha384 defp digest_from_jws_alg("PS512"), do: :sha512 @spec load_from_dir() :: any() defp load_from_dir() do :ets.match_delete(:wax_metadata, {:_, :_, :_, :file}) files = case Application.get_env(:wax, :metadata_dir, nil) do nil -> [] app when is_atom(app) -> app |> :code.priv_dir() |> List.to_string() |> Kernel.<>("/fido2_metadata/*") |> Path.wildcard() path when is_binary(path) -> Path.wildcard(path <> "/*") end Enum.each( files, fn file_path -> with {:ok, file_content} <- File.read(file_path), {:ok, parsed_json} <- Jason.decode(file_content), {:ok, metadata_statement} <- Wax.Metadata.Statement.from_json(parsed_json) do save_metadata_statement(metadata_statement, :file, nil) else {:error, reason} -> Logger.warn( "Failed to load metadata statement from `#{file_path}` (reason: #{inspect(reason)})" ) end end ) end @spec save_metadata_statement( Wax.Metadata.Statement.t(), source :: atom(), Wax.Metadata.TOCEntry.t() | nil ) :: any() defp save_metadata_statement(metadata_statement, source, maybe_toc_entry) do desc = metadata_statement.description case metadata_statement do %Wax.Metadata.Statement{aaguid: aaguid} when is_binary(aaguid) -> Logger.debug("Saving metadata for aaguid `#{aaguid}` (#{desc})") :ets.insert( :wax_metadata, {{:aaguid, aaguid}, maybe_toc_entry, metadata_statement, source} ) %Wax.Metadata.Statement{aaid: aaid} when is_binary(aaid) -> Logger.debug("Saving metadata for aaid `#{aaid}` (#{desc})") :ets.insert( :wax_metadata, {{:aaguid, aaid}, maybe_toc_entry, metadata_statement, source} ) %Wax.Metadata.Statement{attestation_certificate_key_identifiers: acki_list} -> Enum.each( acki_list, fn acki -> Logger.debug( "Saving metadata for attestation certificate key identifier `#{acki}` (#{desc})" ) :ets.insert( :wax_metadata, {{:acki, acki}, maybe_toc_entry, metadata_statement, source} ) end ) end end end
32.43659
98
0.660236
791a7880a433e9e91c73cc96ca0d2c98e09b6fda
681
ex
Elixir
apps/fz_common/lib/fz_integer.ex
bhardwajRahul/firezone
836bfda9e28350443f2093f810872f2bee7c6cdc
[ "Apache-2.0" ]
null
null
null
apps/fz_common/lib/fz_integer.ex
bhardwajRahul/firezone
836bfda9e28350443f2093f810872f2bee7c6cdc
[ "Apache-2.0" ]
1
2020-04-24T01:53:41.000Z
2020-04-24T01:53:41.000Z
apps/fz_common/lib/fz_integer.ex
CloudFire-LLC/cloudfire-ce
416ea0d9c9528790fdf70c432aa4eb507d7b2074
[ "Apache-2.0" ]
null
null
null
defmodule FzCommon.FzInteger do @moduledoc """ Utility functions for working with Integers. """ # Postgres max int size is 4 bytes @max_integer 2_147_483_647 @byte_size_opts [ precision: 2, delimiter: "" ] def clamp(num, min, _max) when is_integer(num) and num < min, do: min def clamp(num, _min, max) when is_integer(num) and num > max, do: max def clamp(num, _min, _max) when is_integer(num), do: num def max_pg_integer do @max_integer end def to_human_bytes(nil), do: to_human_bytes(0) def to_human_bytes(bytes) when is_integer(bytes) do FileSize.from_bytes(bytes, scale: :iec) |> FileSize.format(@byte_size_opts) end end
23.482759
71
0.697504
791a96608a5c765ddb93141ef66c548f072c15eb
906
exs
Elixir
lib/logger/mix.exs
mszczygiel/elixir
7dd86ec1f782debcb00d9f078478c3a9509a6375
[ "Apache-2.0" ]
null
null
null
lib/logger/mix.exs
mszczygiel/elixir
7dd86ec1f782debcb00d9f078478c3a9509a6375
[ "Apache-2.0" ]
null
null
null
lib/logger/mix.exs
mszczygiel/elixir
7dd86ec1f782debcb00d9f078478c3a9509a6375
[ "Apache-2.0" ]
null
null
null
defmodule Logger.MixProject do use Mix.Project def project do [ app: :logger, version: System.version(), build_per_environment: false ] end def application do [ registered: [Logger, Logger.BackendSupervisor, Logger.Supervisor, Logger.Watcher], mod: {Logger.App, []}, env: [ level: :debug, utc_log: false, truncate: 8096, backends: [:console], translators: [{Logger.Translator, :translate}], sync_threshold: 20, discard_threshold: 500, handle_otp_reports: true, handle_sasl_reports: false, discard_threshold_periodic_check: 30_000, discard_threshold_for_error_logger: 500, compile_time_purge_matching: [], compile_time_application: nil, translator_inspect_opts: [], console: [], start_options: [] ] ] end end
24.486486
88
0.611479
791aab02b324fd724d810b02392f9fd21a451250
1,096
ex
Elixir
apps/authenticator/lib/crypto/commands/verify_hash.ex
dcdourado/watcher_ex
ce80df81610a6e9b77612911aac2a6d6cf4de8d5
[ "Apache-2.0" ]
9
2020-10-13T14:11:37.000Z
2021-08-12T18:40:08.000Z
apps/authenticator/lib/crypto/commands/verify_hash.ex
dcdourado/watcher_ex
ce80df81610a6e9b77612911aac2a6d6cf4de8d5
[ "Apache-2.0" ]
28
2020-10-04T14:43:48.000Z
2021-12-07T16:54:22.000Z
apps/authenticator/lib/crypto/commands/verify_hash.ex
dcdourado/watcher_ex
ce80df81610a6e9b77612911aac2a6d6cf4de8d5
[ "Apache-2.0" ]
3
2020-11-25T20:59:47.000Z
2021-08-30T10:36:58.000Z
defmodule Authenticator.Crypto.Commands.VerifyHash do @moduledoc """ Verify if a given hash matches the given value. """ @typedoc "All possible hash algorithms" @type algorithms :: :argon2 | :bcrypt | :pbkdf2 @doc "Verifies if a credential matches the given secret" @spec execute(credential :: map(), value :: String.t()) :: boolean() def execute(%{password: %{password_hash: hash, algorithm: algorithm}}, password) when is_binary(password), do: execute(password, hash, String.to_atom(algorithm)) @doc "Verifies if a hash matches the given credential using the passed algorithm" @spec execute(value :: String.t(), hash :: String.t(), algorithm :: algorithms()) :: boolean() def execute(value, hash, :argon2) when is_binary(value) and is_binary(hash), do: Argon2.verify_pass(value, hash) def execute(value, hash, :bcrypt) when is_binary(value) and is_binary(hash), do: Bcrypt.verify_pass(value, hash) def execute(value, hash, :pbkdf2) when is_binary(value) and is_binary(hash), do: Pbkdf2.verify_pass(value, hash) end
37.793103
96
0.695255
791afb2a74f40766def92b45c7d82efd76781f43
2,003
ex
Elixir
clients/analytics_reporting/lib/google_api/analytics_reporting/v4/model/dynamic_segment.ex
GoNZooo/elixir-google-api
cf3ad7392921177f68091f3d9001f1b01b92f1cc
[ "Apache-2.0" ]
null
null
null
clients/analytics_reporting/lib/google_api/analytics_reporting/v4/model/dynamic_segment.ex
GoNZooo/elixir-google-api
cf3ad7392921177f68091f3d9001f1b01b92f1cc
[ "Apache-2.0" ]
null
null
null
clients/analytics_reporting/lib/google_api/analytics_reporting/v4/model/dynamic_segment.ex
GoNZooo/elixir-google-api
cf3ad7392921177f68091f3d9001f1b01b92f1cc
[ "Apache-2.0" ]
1
2018-07-28T20:50:50.000Z
2018-07-28T20:50:50.000Z
# Copyright 2017 Google Inc. # # Licensed under the Apache License, Version 2.0 (the &quot;License&quot;); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an &quot;AS IS&quot; BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This class is auto generated by the swagger code generator program. # https://github.com/swagger-api/swagger-codegen.git # Do not edit the class manually. defmodule GoogleApi.AnalyticsReporting.V4.Model.DynamicSegment do @moduledoc """ Dynamic segment definition for defining the segment within the request. A segment can select users, sessions or both. ## Attributes - name (String): The name of the dynamic segment. Defaults to: `null`. - sessionSegment (SegmentDefinition): Session Segment to select sessions to include in the segment. Defaults to: `null`. - userSegment (SegmentDefinition): User Segment to select users to include in the segment. Defaults to: `null`. """ defstruct [ :"name", :"sessionSegment", :"userSegment" ] end defimpl Poison.Decoder, for: GoogleApi.AnalyticsReporting.V4.Model.DynamicSegment do import GoogleApi.AnalyticsReporting.V4.Deserializer def decode(value, options) do value |> deserialize(:"sessionSegment", :struct, GoogleApi.AnalyticsReporting.V4.Model.SegmentDefinition, options) |> deserialize(:"userSegment", :struct, GoogleApi.AnalyticsReporting.V4.Model.SegmentDefinition, options) end end defimpl Poison.Encoder, for: GoogleApi.AnalyticsReporting.V4.Model.DynamicSegment do def encode(value, options) do GoogleApi.AnalyticsReporting.V4.Deserializer.serialize_non_nil(value, options) end end
37.792453
122
0.763854
791b0ba396d15fad28b53af0655e5e21142ce3b1
2,294
ex
Elixir
lib/mechanize/form/submit_button.ex
paultannenbaum/mechanize
97fd54c0421689026c01b9bf38206fa74e8f7e1a
[ "MIT" ]
25
2020-06-26T02:21:35.000Z
2022-03-05T18:51:46.000Z
lib/mechanize/form/submit_button.ex
paultannenbaum/mechanize
97fd54c0421689026c01b9bf38206fa74e8f7e1a
[ "MIT" ]
29
2019-07-02T21:50:06.000Z
2020-05-28T18:34:01.000Z
lib/mechanize/form/submit_button.ex
paultannenbaum/mechanize
97fd54c0421689026c01b9bf38206fa74e8f7e1a
[ "MIT" ]
4
2020-06-24T02:11:47.000Z
2022-03-06T00:50:59.000Z
defmodule Mechanize.Form.SubmitButton do @moduledoc false alias Mechanize.Page.{Element, Elementable} alias Mechanize.{Form, Query} alias Mechanize.Form.ParameterizableField alias Mechanize.Query.BadQueryError @derive [ParameterizableField, Elementable] defstruct [:element, :name, :value, :visible_text] @type t :: %__MODULE__{ element: Element.t(), name: String.t(), value: String.t(), visible_text: String.t() } def new(%Element{name: "button"} = el) do %__MODULE__{ element: el, name: Element.attr(el, :name), value: Element.attr(el, :value), visible_text: Element.text(el) } end def new(%Element{name: "input"} = el) do %__MODULE__{ element: el, name: Element.attr(el, :name), value: Element.attr(el, :value), visible_text: Element.attr(el, :value) } end def submit_buttons_with(form, query \\ []) do get_in(form, [ Access.key(:fields), Access.filter(&Query.match?(&1, __MODULE__, query)) ]) end def click_button!(_form, nil) do raise ArgumentError, message: "Can't click on button because button is nil." end def click_button!(form, query) when is_list(query) do form |> submit_buttons_with(query) |> maybe_click_on_button(form) end def click_button!(form, visible_text) when is_binary(visible_text) do form |> submit_buttons_with() |> Enum.filter(&(&1.visible_text == visible_text)) |> maybe_click_on_button(form) end def click_button!(form, %__MODULE__{} = button) do Form.submit!(form, button) end def click_button!(form, visible_text) do form |> submit_buttons_with() |> Enum.filter(&(&1.visible_text != nil and &1.visible_text =~ visible_text)) |> maybe_click_on_button(form) end defp maybe_click_on_button(buttons, form) do case buttons do [] -> raise BadQueryError, message: "Can't click on submit button because no button was found for given query" [button] -> click_button!(form, button) buttons -> raise BadQueryError, message: "Can't decide which submit button to click because #{length(buttons)} buttons were found for given query" end end end
26.068182
117
0.644725
791b17d16f023cbeb63e69ba664bf1d1db3b47ab
330
exs
Elixir
priv/repo/migrations/20180728205319_create_principals_to_roles.exs
trutvo/gatehouse
027d4dd35703d84e15b9b2297347350b9a8f5a6b
[ "Apache-2.0" ]
1
2019-07-21T03:48:31.000Z
2019-07-21T03:48:31.000Z
priv/repo/migrations/20180728205319_create_principals_to_roles.exs
trutvo/gatehouse
027d4dd35703d84e15b9b2297347350b9a8f5a6b
[ "Apache-2.0" ]
1
2021-03-07T17:54:41.000Z
2021-03-07T17:54:41.000Z
priv/repo/migrations/20180728205319_create_principals_to_roles.exs
trutvo/gatehouse
027d4dd35703d84e15b9b2297347350b9a8f5a6b
[ "Apache-2.0" ]
2
2019-06-14T06:25:25.000Z
2019-07-21T03:48:33.000Z
defmodule Gatehouse.Repo.Migrations.CreatePrincipalsToRoles do use Ecto.Migration def change do create table(:principals_to_roles) do add :principal_id, references(:principals) add :role_id, references(:roles) end create unique_index(:principals_to_roles, [:principal_id, :role_id]) end end
27.5
74
0.730303
791b19dcbbc9f54e00eaba937baa0e67d3ebdf32
2,197
ex
Elixir
clients/language/lib/google_api/language/v1/model/token.ex
medikent/elixir-google-api
98a83d4f7bfaeac15b67b04548711bb7e49f9490
[ "Apache-2.0" ]
null
null
null
clients/language/lib/google_api/language/v1/model/token.ex
medikent/elixir-google-api
98a83d4f7bfaeac15b67b04548711bb7e49f9490
[ "Apache-2.0" ]
1
2020-12-18T09:25:12.000Z
2020-12-18T09:25:12.000Z
clients/language/lib/google_api/language/v1/model/token.ex
medikent/elixir-google-api
98a83d4f7bfaeac15b67b04548711bb7e49f9490
[ "Apache-2.0" ]
1
2020-10-04T10:12:44.000Z
2020-10-04T10:12:44.000Z
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This file is auto generated by the elixir code generator program. # Do not edit this file manually. defmodule GoogleApi.Language.V1.Model.Token do @moduledoc """ Represents the smallest syntactic building block of the text. ## Attributes * `dependencyEdge` (*type:* `GoogleApi.Language.V1.Model.DependencyEdge.t`, *default:* `nil`) - Dependency tree parse for this token. * `lemma` (*type:* `String.t`, *default:* `nil`) - [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token. * `partOfSpeech` (*type:* `GoogleApi.Language.V1.Model.PartOfSpeech.t`, *default:* `nil`) - Parts of speech tag for this token. * `text` (*type:* `GoogleApi.Language.V1.Model.TextSpan.t`, *default:* `nil`) - The token text. """ use GoogleApi.Gax.ModelBase @type t :: %__MODULE__{ :dependencyEdge => GoogleApi.Language.V1.Model.DependencyEdge.t(), :lemma => String.t(), :partOfSpeech => GoogleApi.Language.V1.Model.PartOfSpeech.t(), :text => GoogleApi.Language.V1.Model.TextSpan.t() } field(:dependencyEdge, as: GoogleApi.Language.V1.Model.DependencyEdge) field(:lemma) field(:partOfSpeech, as: GoogleApi.Language.V1.Model.PartOfSpeech) field(:text, as: GoogleApi.Language.V1.Model.TextSpan) end defimpl Poison.Decoder, for: GoogleApi.Language.V1.Model.Token do def decode(value, options) do GoogleApi.Language.V1.Model.Token.decode(value, options) end end defimpl Poison.Encoder, for: GoogleApi.Language.V1.Model.Token do def encode(value, options) do GoogleApi.Gax.ModelBase.encode(value, options) end end
39.232143
137
0.719162
791b42848240b6f0c4be9f80668323e495241284
243
exs
Elixir
priv/repo/migrations/2016032505124138_alter_docks.exs
simwms/apiv4
c3da7407eaf3580b759f49726028439b4b8ea9d0
[ "MIT" ]
2
2016-02-25T20:12:35.000Z
2018-01-03T00:03:12.000Z
priv/repo/migrations/2016032505124138_alter_docks.exs
simwms/apiv4
c3da7407eaf3580b759f49726028439b4b8ea9d0
[ "MIT" ]
1
2016-01-11T04:50:39.000Z
2016-01-12T05:00:08.000Z
priv/repo/migrations/2016032505124138_alter_docks.exs
simwms/apiv4
c3da7407eaf3580b759f49726028439b4b8ea9d0
[ "MIT" ]
null
null
null
defmodule Apiv4.Repo.Migrations.AlterDocks do use Ecto.Migration def change do alter table(:docks) do add :account_id, references(:accounts, on_delete: :nothing) end create index(:docks, [:account_id]) end end
18.692308
65
0.683128
791b5c100db41a18de684dab0ad7c09efe053a8d
1,972
exs
Elixir
config/prod.exs
TDogVoid/health_demo
4e9fbf79c32145cf563cdbdb3ea4a0f594a87053
[ "MIT" ]
null
null
null
config/prod.exs
TDogVoid/health_demo
4e9fbf79c32145cf563cdbdb3ea4a0f594a87053
[ "MIT" ]
2
2021-03-10T04:15:17.000Z
2021-05-10T23:54:35.000Z
config/prod.exs
TDogVoid/health_demo
4e9fbf79c32145cf563cdbdb3ea4a0f594a87053
[ "MIT" ]
null
null
null
use Mix.Config # For production, don't forget to configure the url host # to something meaningful, Phoenix uses this information # when generating URLs. # # Note we also include the path to a cache manifest # containing the digested version of static files. This # manifest is generated by the `mix phx.digest` task, # which you should run after static files are built and # before starting your production server. config :health, HealthWeb.Endpoint, url: [host: "example.com", port: 80], cache_static_manifest: "priv/static/cache_manifest.json" # Do not print debug messages in production config :logger, level: :info # ## SSL Support # # To get SSL working, you will need to add the `https` key # to the previous section and set your `:url` port to 443: # # config :health, HealthWeb.Endpoint, # ... # url: [host: "example.com", port: 443], # https: [ # :inet6, # port: 443, # cipher_suite: :strong, # keyfile: System.get_env("SOME_APP_SSL_KEY_PATH"), # certfile: System.get_env("SOME_APP_SSL_CERT_PATH") # ] # # The `cipher_suite` is set to `:strong` to support only the # latest and more secure SSL ciphers. This means old browsers # and clients may not be supported. You can set it to # `:compatible` for wider support. # # `:keyfile` and `:certfile` expect an absolute path to the key # and cert in disk or a relative path inside priv, for example # "priv/ssl/server.key". For all supported SSL configuration # options, see https://hexdocs.pm/plug/Plug.SSL.html#configure/1 # # We also recommend setting `force_ssl` in your endpoint, ensuring # no data is ever sent via http, always redirecting to https: # # config :health, HealthWeb.Endpoint, # force_ssl: [hsts: true] # # Check `Plug.SSL` for all available options in `force_ssl`. # Finally import the config/prod.secret.exs which loads secrets # and configuration from environment variables. # import_config "prod.secret.exs"
35.214286
66
0.711968
791b6ad33748c8fa78831d5276075476dea4332b
6,586
ex
Elixir
lib/excg.ex
laozhp/excg
be946bc19011bf17f35d4fa01ed69ad1a0b9dcaa
[ "MIT" ]
1
2016-08-17T09:34:07.000Z
2016-08-17T09:34:07.000Z
lib/excg.ex
laozhp/excg
be946bc19011bf17f35d4fa01ed69ad1a0b9dcaa
[ "MIT" ]
3
2015-09-17T02:47:35.000Z
2015-09-18T02:51:49.000Z
lib/excg.ex
laozhp/excg
be946bc19011bf17f35d4fa01ed69ad1a0b9dcaa
[ "MIT" ]
null
null
null
defmodule Excg do defmacro __using__(_) do quote do import Excg @excg_cur nil for attr <- [:excg_flds, :excg_types, :excg_cfgs, :excg_msgs] do Module.register_attribute(__MODULE__, attr, accumulate: true) end @before_compile unquote(__MODULE__) end end defmacro __before_compile__(env) do flds = Module.get_attribute(env.module, :excg_flds) types = Enum.reverse(Module.get_attribute(env.module, :excg_types)) cfgs = Enum.reverse(Module.get_attribute(env.module, :excg_cfgs)) msgs = Enum.reverse(Module.get_attribute(env.module, :excg_msgs)) if length(cfgs) > 1, do: raise "一个文件只能使用一个config" if cfgs != [] and msgs != [] do raise "一个文件不能同时使用config和message" end map = reduce_flds(flds) [gen_types(map, types), gen_cfgs(map, cfgs), gen_msgs(map, msgs)] end defmacro field(name, desc, type, opts \\ []) do quote bind_quoted: [name: name, desc: desc, type: type, opts: opts] do cls_name = Module.get_attribute(__MODULE__, :excg_cur) Module.put_attribute(__MODULE__, :excg_flds, {cls_name, %{ kind: :field, name: name, desc: desc, type: type, opts: opts}}) end end defmacro array(name, desc, type, opts \\ []) do quote bind_quoted: [name: name, desc: desc, type: type, opts: opts] do cls_name = Module.get_attribute(__MODULE__, :excg_cur) Module.put_attribute(__MODULE__, :excg_flds, {cls_name, %{ kind: :array, name: name, desc: desc, type: type, opts: opts}}) end end defmacro type(name, desc, opts \\ [], [do: block]) do quote do name = unquote(name) desc = unquote(desc) opts = unquote(opts) Module.put_attribute(__MODULE__, :excg_cur, {:type, name}) list = Module.get_attribute(__MODULE__, :excg_types) if List.keymember?(list, name, 0), do: raise "duplicated type #{name}" Module.put_attribute(__MODULE__, :excg_types, %{ name: name, desc: desc, opts: opts}) unquote(block) end end defmacro config(name, desc, opts \\ [], [do: block]) do quote do unless String.ends_with?(to_string(__MODULE__), "Cfg") do raise "config只能在后缀为Cfg的模块内使用" end name = unquote(name) desc = unquote(desc) opts = unquote(opts) Module.put_attribute(__MODULE__, :excg_cur, {:config, name}) list = Module.get_attribute(__MODULE__, :excg_cfgs) if List.keymember?(list, name, 0), do: raise "duplicated config #{name}" Module.put_attribute(__MODULE__, :excg_cfgs, %{ name: name, desc: desc, opts: opts}) unquote(block) end end defmacro message(id, name, desc, opts \\ [], [do: block]) do quote do unless String.ends_with?(to_string(__MODULE__), "Msg") do raise "message只能在后缀为Msg的模块内使用" end id = unquote(id) name = unquote(name) desc = unquote(desc) opts = unquote(opts) Module.put_attribute(__MODULE__, :excg_cur, {:message, name}) list = Module.get_attribute(__MODULE__, :excg_msgs) if List.keymember?(list, name, 0), do: raise "duplicated message #{name}" Module.put_attribute(__MODULE__, :excg_msgs, %{ id: id, name: name, desc: desc, opts: opts}) unquote(block) end end defmacro module(id, name, desc, opts \\ []) do quote do def module do %{id: unquote(id), name: unquote(name), desc: unquote(desc), opts: unquote(opts)} end end end def basic_type?(type) do type in [:boolean, :float, :integer, :string] end def type_def_val(:boolean), do: false def type_def_val(:float), do: 0.0 def type_def_val(:integer), do: 0 def type_def_val(:string), do: "" def cfg_xml_file(cfg_info) do Keyword.get(cfg_info.opts, :xml_file, "#{cfg_info.name}.xml") end defp reduce_flds(flds) do map = %{flds_map: %{}, name_map: %{}} Enum.reduce(flds, map, fn({cls_name, fld}, map) -> field_list = Map.get(map.flds_map, cls_name, []) name_map = Map.get(map.name_map, cls_name, %{}) fld_name = fld.name if name_map[fld_name], do: raise "duplicated field #{fld_name}" map |> put_in([:flds_map, cls_name], [fld_name | field_list]) |> put_in([:name_map, cls_name], Map.put(name_map, fld_name, fld)) end) end defp gen_types(map, types) do list = for type <- types, do: type.name q = quote do def types, do: unquote(list) end Enum.reduce(types, [q], fn(type, acc) -> %{name: name, desc: desc, opts: opts} = type cls_name = {:type, name} field_list = map.flds_map[cls_name] unless field_list, do: raise "type #{name} has no field" name_map = map.name_map[cls_name] q = quote do def unquote(:"type_info_#{name}")(), do: %{name: unquote(name), desc: unquote(desc), opts: unquote(opts)} def unquote(:"type_list_#{name}")(), do: unquote(field_list) def unquote(:"type_map_#{name}")(), do: unquote(Macro.escape(name_map)) end [q | acc] end) end defp gen_cfgs(map, cfgs) do list = for cfg <- cfgs, do: cfg.name q = quote do def cfgs, do: unquote(list) end Enum.reduce(cfgs, [q], fn(cfg, acc) -> %{name: name, desc: desc, opts: opts} = cfg cls_name = {:config, name} field_list = map.flds_map[cls_name] unless field_list, do: raise "config #{name} has no field" name_map = map.name_map[cls_name] q = quote do def unquote(:"config_info_#{name}")(), do: %{name: unquote(name), desc: unquote(desc), opts: unquote(opts)} def unquote(:"config_list_#{name}")(), do: unquote(field_list) def unquote(:"config_map_#{name}")(), do: unquote(Macro.escape(name_map)) end [q | acc] end) end defp gen_msgs(map, msgs) do list = for msg <- msgs, do: msg.name q = quote do def msgs, do: unquote(list) end Enum.reduce(msgs, [q], fn(msg, acc) -> %{id: id, name: name, desc: desc, opts: opts} = msg cls_name = {:message, name} field_list = map.flds_map[cls_name] || [] name_map = map.name_map[cls_name] || %{} q = quote do def unquote(:"message_info_#{name}")(), do: %{id: unquote(id), name: unquote(name), desc: unquote(desc), opts: unquote(opts)} def unquote(:"message_list_#{name}")(), do: unquote(field_list) def unquote(:"message_map_#{name}")(), do: unquote(Macro.escape(name_map)) end [q | acc] end) end end
33.431472
79
0.611297
791bc35d2be4519f5946164cd80bb507ab2f4bc6
61
ex
Elixir
phoenix0/web/views/page_view.ex
JacobOscarson/elexir-0
f4e67bb4a68c6a0cba5b410d80427e721ac7826a
[ "MIT" ]
null
null
null
phoenix0/web/views/page_view.ex
JacobOscarson/elexir-0
f4e67bb4a68c6a0cba5b410d80427e721ac7826a
[ "MIT" ]
null
null
null
phoenix0/web/views/page_view.ex
JacobOscarson/elexir-0
f4e67bb4a68c6a0cba5b410d80427e721ac7826a
[ "MIT" ]
null
null
null
defmodule Phoenix0.PageView do use Phoenix0.Web, :view end
15.25
30
0.786885
791bfc870e713f5190c92cb8f85df6e3520bc95a
1,985
ex
Elixir
lib/phoenix/live_dashboard/pages/ports_page.ex
RomanKotov/phoenix_live_dashboard
439283fa625f5af876e01eb5edcb20aec7f3b2da
[ "MIT" ]
1
2020-11-04T16:18:16.000Z
2020-11-04T16:18:16.000Z
lib/phoenix/live_dashboard/pages/ports_page.ex
RomanKotov/phoenix_live_dashboard
439283fa625f5af876e01eb5edcb20aec7f3b2da
[ "MIT" ]
null
null
null
lib/phoenix/live_dashboard/pages/ports_page.ex
RomanKotov/phoenix_live_dashboard
439283fa625f5af876e01eb5edcb20aec7f3b2da
[ "MIT" ]
null
null
null
defmodule Phoenix.LiveDashboard.PortsPage do @moduledoc false use Phoenix.LiveDashboard.PageBuilder alias Phoenix.LiveDashboard.SystemInfo @table_id :table @menu_text "Ports" @impl true def render_page(_assigns) do table( columns: columns(), id: @table_id, row_attrs: &row_attrs/1, row_fetcher: &fetch_ports/2, title: "Ports" ) end defp fetch_ports(params, node) do %{search: search, sort_by: sort_by, sort_dir: sort_dir, limit: limit} = params SystemInfo.fetch_ports(node, search, sort_by, sort_dir, limit) end defp columns() do [ %{ field: :port, header_attrs: [class: "pl-4"], cell_attrs: [class: "tabular-column-id pl-4"], format: &(&1[:port] |> encode_port() |> String.replace_prefix("Port", "")) }, %{ field: :name, header: "Name or path", cell_attrs: [class: "w-50"], format: &format_path(&1[:name]) }, %{ field: :os_pid, header: "OS pid", format: &if(&1[:os_pid] != :undefined, do: &1[:os_pid]) }, %{ field: :input, header_attrs: [class: "text-right"], cell_attrs: [class: "tabular-column-bytes"], format: &format_bytes(&1[:input]), sortable: :desc }, %{ field: :output, header_attrs: [class: "text-right pr-4"], cell_attrs: [class: "tabular-column-bytes pr-4"], format: &format_bytes(&1[:output]), sortable: :desc }, %{ field: :id, header_attrs: [class: "text-right"], cell_attrs: [class: "text-right"] }, %{ field: :owner, format: &inspect(&1[:connected]) } ] end defp row_attrs(port) do [ {"phx-click", "show_info"}, {"phx-value-info", encode_port(port[:port])}, {"phx-page-loading", true} ] end @impl true def menu_link(_, _) do {:ok, @menu_text} end end
23.352941
82
0.547103
791c4461dcab2545df15e4415404ec1cdd72e09e
1,647
ex
Elixir
web/web.ex
rdiego26/elixir-web-hello-world
c584699a7266414d5a6229f977dcb21282061e3a
[ "MIT" ]
null
null
null
web/web.ex
rdiego26/elixir-web-hello-world
c584699a7266414d5a6229f977dcb21282061e3a
[ "MIT" ]
null
null
null
web/web.ex
rdiego26/elixir-web-hello-world
c584699a7266414d5a6229f977dcb21282061e3a
[ "MIT" ]
null
null
null
defmodule HelloWorld.Web do @moduledoc """ A module that keeps using definitions for controllers, views and so on. This can be used in your application as: use HelloWorld.Web, :controller use HelloWorld.Web, :view The definitions below will be executed for every view, controller, etc, so keep them short and clean, focused on imports, uses and aliases. Do NOT define functions inside the quoted expressions below. """ def model do quote do use Ecto.Schema import Ecto import Ecto.Changeset import Ecto.Query end end def controller do quote do use Phoenix.Controller alias HelloWorld.Repo import Ecto import Ecto.Query import HelloWorld.Router.Helpers import HelloWorld.Gettext end end def view do quote do use Phoenix.View, root: "web/templates" # Import convenience functions from controllers import Phoenix.Controller, only: [get_csrf_token: 0, get_flash: 2, view_module: 1] # Use all HTML functionality (forms, tags, etc) use Phoenix.HTML import HelloWorld.Router.Helpers import HelloWorld.ErrorHelpers import HelloWorld.Gettext end end def router do quote do use Phoenix.Router end end def channel do quote do use Phoenix.Channel alias HelloWorld.Repo import Ecto import Ecto.Query import HelloWorld.Gettext end end @doc """ When used, dispatch to the appropriate controller/view/etc. """ defmacro __using__(which) when is_atom(which) do apply(__MODULE__, which, []) end end
20.085366
88
0.672738
791c4e20590043ee5f87e373a5080df576e6e273
1,165
exs
Elixir
src/047/problem047.exs
fredericojordan/project-euler
75c3f519d5a6ad610362b6904f8fa4d1cde05448
[ "MIT" ]
9
2018-05-06T04:43:08.000Z
2020-12-01T20:51:34.000Z
src/047/problem047.exs
fredericojordan/project-euler
75c3f519d5a6ad610362b6904f8fa4d1cde05448
[ "MIT" ]
null
null
null
src/047/problem047.exs
fredericojordan/project-euler
75c3f519d5a6ad610362b6904f8fa4d1cde05448
[ "MIT" ]
null
null
null
#!/usr/bin/env elixir defmodule Problem047 do @moduledoc """ The first two consecutive numbers to have two distinct prime factors are: 14 = 2 x 7 15 = 3 x 5 The first three consecutive numbers to have three distinct prime factors are: 644 = 2² x 7 x 23 645 = 3 x 5 x 43 646 = 2 x 17 x 19. Find the first four consecutive integers to have four distinct prime factors each. What is the first of these numbers? """ defp factorize(x, n, prime_factors) when n > x, do: prime_factors defp factorize(x, n, prime_factors) when rem(x, n) == 0, do: factorize(div(x,n), n, [n | prime_factors]) defp factorize(x, n, prime_factors), do: factorize(x, n+1, prime_factors) defp factorize(x) when is_integer(x) and x > 0, do: factorize(x, 2, []) defp unique_factors(x) do factorize(x) |> Enum.uniq() |> Enum.count() end def solve do Stream.iterate(1, &(&1+1)) |> Stream.map(&unique_factors/1) |> Stream.chunk_every(4,1) |> Stream.with_index(1) |> Stream.filter(fn {list, _} -> Enum.all?(list, fn x -> x == 4 end) end) |> Enum.take(1) |> List.first() |> elem(1) end end IO.puts Problem047.solve
27.738095
120
0.648069
791c65da0c491134b6c0ef367772e59d6fba8480
358
ex
Elixir
fixtures/elixir_output/get_user_agent.ex
martinsirbe/curlconverter
c5324e85d2ca24ef4743fb2bb36139d23367e293
[ "MIT" ]
4,955
2015-01-02T09:04:20.000Z
2021-10-06T03:54:43.000Z
fixtures/elixir_output/get_user_agent.ex
martinsirbe/curlconverter
c5324e85d2ca24ef4743fb2bb36139d23367e293
[ "MIT" ]
242
2015-03-27T05:59:11.000Z
2021-10-03T08:36:05.000Z
fixtures/elixir_output/get_user_agent.ex
martinsirbe/curlconverter
c5324e85d2ca24ef4743fb2bb36139d23367e293
[ "MIT" ]
504
2015-01-02T16:04:36.000Z
2021-10-01T03:43:55.000Z
request = %HTTPoison.Request{ method: :get, url: "http://205.147.98.6/vc/moviesmagic", options: [], headers: [ {~s|x-msisdn|, ~s|XXXXXXXXXXXXX|}, {~s|User-Agent|, ~s|Mozilla Android6.1|}, ], params: [ {~s|p|, ~s|5|}, {~s|pub|, ~s|testmovie|}, {~s|tkn|, ~s|817263812|}, ], body: "" } response = HTTPoison.request(request)
19.888889
45
0.550279
791c93889a487b0d487e9597ffbd3cd61cb87507
1,742
ex
Elixir
clients/content/lib/google_api/content/v2/model/datafeed_status_example.ex
leandrocp/elixir-google-api
a86e46907f396d40aeff8668c3bd81662f44c71e
[ "Apache-2.0" ]
null
null
null
clients/content/lib/google_api/content/v2/model/datafeed_status_example.ex
leandrocp/elixir-google-api
a86e46907f396d40aeff8668c3bd81662f44c71e
[ "Apache-2.0" ]
null
null
null
clients/content/lib/google_api/content/v2/model/datafeed_status_example.ex
leandrocp/elixir-google-api
a86e46907f396d40aeff8668c3bd81662f44c71e
[ "Apache-2.0" ]
1
2020-11-10T16:58:27.000Z
2020-11-10T16:58:27.000Z
# Copyright 2017 Google Inc. # # Licensed under the Apache License, Version 2.0 (the &quot;License&quot;); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an &quot;AS IS&quot; BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This class is auto generated by the swagger code generator program. # https://github.com/swagger-api/swagger-codegen.git # Do not edit the class manually. defmodule GoogleApi.Content.V2.Model.DatafeedStatusExample do @moduledoc """ An example occurrence for a particular error. ## Attributes - itemId (String.t): The ID of the example item. Defaults to: `null`. - lineNumber (String.t): Line number in the data feed where the example is found. Defaults to: `null`. - value (String.t): The problematic value. Defaults to: `null`. """ use GoogleApi.Gax.ModelBase @type t :: %__MODULE__{ :itemId => any(), :lineNumber => any(), :value => any() } field(:itemId) field(:lineNumber) field(:value) end defimpl Poison.Decoder, for: GoogleApi.Content.V2.Model.DatafeedStatusExample do def decode(value, options) do GoogleApi.Content.V2.Model.DatafeedStatusExample.decode(value, options) end end defimpl Poison.Encoder, for: GoogleApi.Content.V2.Model.DatafeedStatusExample do def encode(value, options) do GoogleApi.Gax.ModelBase.encode(value, options) end end
32.259259
104
0.726751
791cb1b50442d4a7e6dd922645e05f3eeb7c2af6
510
ex
Elixir
lib/meeseeks/accumulator/one.ex
RichMorin/meeseeks
d52a15a0b78acfc4d7b979d1df6e146482dc3a10
[ "Apache-2.0", "MIT" ]
291
2017-03-27T15:53:36.000Z
2022-03-14T23:01:42.000Z
lib/meeseeks/accumulator/one.ex
RichMorin/meeseeks
d52a15a0b78acfc4d7b979d1df6e146482dc3a10
[ "Apache-2.0", "MIT" ]
70
2017-03-30T23:32:34.000Z
2021-06-27T06:26:28.000Z
lib/meeseeks/accumulator/one.ex
RichMorin/meeseeks
d52a15a0b78acfc4d7b979d1df6e146482dc3a10
[ "Apache-2.0", "MIT" ]
23
2017-06-18T10:29:04.000Z
2021-11-04T13:08:12.000Z
defmodule Meeseeks.Accumulator.One do use Meeseeks.Accumulator @moduledoc false alias Meeseeks.{Accumulator, Result} defstruct value: nil @impl true def add(%Accumulator.One{value: nil} = acc, document, id) do result = %Result{document: document, id: id} %{acc | value: result} end @impl true def complete?(%Accumulator.One{value: nil}), do: false def complete?(%Accumulator.One{value: _some}), do: true @impl true def return(%Accumulator.One{value: value}), do: value end
23.181818
62
0.698039
791cc0664e8137ac1ca096d7541842c92cb6ffd0
9,764
ex
Elixir
lib/operators/operators.ex
carmaproject/towel
471953af77efa675beaa5055e24e7ae645d565c8
[ "MIT" ]
null
null
null
lib/operators/operators.ex
carmaproject/towel
471953af77efa675beaa5055e24e7ae645d565c8
[ "MIT" ]
null
null
null
lib/operators/operators.ex
carmaproject/towel
471953af77efa675beaa5055e24e7ae645d565c8
[ "MIT" ]
null
null
null
defmodule Result.Operators do @moduledoc """ A result operators. """ alias Result.Utils @doc """ Chain together a sequence of computations that may fail. ## Examples iex> val = {:ok, 1} iex> Result.Operators.and_then(val, fn (x) -> {:ok, x + 1} end) {:ok, 2} iex> val = {:error, 1} iex> Result.Operators.and_then(val, fn (x) -> {:ok, x + 1} end) {:error, 1} """ @spec and_then(Result.t(b, a), (a -> Result.t(c, d))) :: Result.t(b | c, d) when a: var, b: var, c: var, d: var def and_then({:ok, val}, f) do f.(val) end def and_then({:error, val}, _f) do {:error, val} end @doc """ Chain together a sequence of computations that may fail for functions with multiple argumets. ## Examples iex> args = [{:ok, 1}, {:ok, 2}] iex> Result.Operators.and_then_x(args, fn (x, y) -> {:ok, x + y} end) {:ok, 3} iex> args = [{:ok, 1}, {:error, "ERROR"}] iex> Result.Operators.and_then_x(args, fn (x, y) -> {:ok, x + y} end) {:error, "ERROR"} """ @spec and_then_x([Result.t(any(), any())], (... -> Result.t(any(), any()))) :: Result.t(any(), any()) def and_then_x(args, f) do args |> fold() |> and_then(&apply(f, &1)) end @doc """ Fold function returns tuple `{:ok, [...]}` if all tuples in list contain `:ok` or `{:error, ...}` if only one tuple contains `:error`. ## Examples iex> val = [{:ok, 3}, {:ok, 5}, {:ok, 12}] iex> Result.Operators.fold(val) {:ok, [3, 5, 12]} iex> val = [{:ok, 3}, {:error, 1}, {:ok, 2}, {:error, 2}] iex> Result.Operators.fold(val) {:error, 1} """ @spec fold([Result.t(any, any)]) :: Result.t(any, [any]) def fold(list) do fold(list, []) end defp fold([{:ok, v} | tail], acc) do fold(tail, [v | acc]) end defp fold([{:error, v} | _tail], _acc) do {:error, v} end defp fold([], acc) do {:ok, Enum.reverse(acc)} end @doc """ Convert maybe to result type. ## Examples iex> Result.Operators.from(123, "msg") {:ok, 123} iex> Result.Operators.from(nil, "msg") {:error, "msg"} iex> Result.Operators.from(:ok, 123) {:ok, 123} iex> Result.Operators.from(:error, 456) {:error, 456} iex> Result.Operators.from({:ok, 123}, "value") {:ok, 123} iex> Result.Operators.from({:error, "msg"}, "value") {:error, "msg"} """ @spec from(any | nil | :ok | :error | Result.t(any, any), any) :: Result.t(any, any) def from(nil, msg), do: {:error, msg} def from(:ok, value), do: {:ok, value} def from(:error, value), do: {:error, value} def from({:ok, val}, _value), do: {:ok, val} def from({:error, msg}, _value), do: {:error, msg} def from(value, _msg), do: {:ok, value} @doc """ Apply a function `f` to `value` if result is Ok. ## Examples iex> ok = {:ok, 3} iex> Result.Operators.map(ok, fn(x) -> x + 10 end) {:ok, 13} iex> error = {:error, 3} iex> Result.Operators.map(error, fn(x) -> x + 10 end) {:error, 3} """ @spec map(Result.t(any, a), (a -> b)) :: Result.t(any, b) when a: var, b: var def map({:ok, value}, f) when is_function(f, 1) do {:ok, f.(value)} end def map({:error, _} = result, _f), do: result @doc """ Apply a function if both results are Ok. If not, the first Err will propagate through. ## Examples iex> Result.Operators.map2({:ok, 1}, {:ok, 2}, fn(x, y) -> x + y end) {:ok, 3} iex> Result.Operators.map2({:ok, 1}, {:error, 2}, fn(x, y) -> x + y end) {:error, 2} iex> Result.Operators.map2({:error, 1}, {:error, 2}, fn(x, y) -> x + y end) {:error, 1} """ @spec map2(Result.t(any, a), Result.t(any, b), (a, b -> c)) :: Result.t(any, c) when a: var, b: var, c: var def map2({:ok, val1}, {:ok, val2}, f) when is_function(f, 2) do {:ok, f.(val1, val2)} end def map2({:error, _} = result, _, _f), do: result def map2(_, {:error, _} = result, _f), do: result @doc """ Apply a function `f` to `value` if result is Error. Transform an Error value. For example, say the errors we get have too much information ## Examples iex> error = {:error, %{msg: "ERROR", status: 4321}} iex> Result.Operators.map_error(error, &(&1.msg)) {:error, "ERROR"} iex> ok = {:ok, 3} iex> Result.Operators.map_error(ok, fn(x) -> x + 10 end) {:ok, 3} """ @spec map_error(Result.t(a, any()), (a -> b)) :: Result.t(b, any()) when a: var, b: var def map_error({:error, value}, f) when is_function(f, 1) do {:error, f.(value)} end def map_error({:ok, _} = result, _f), do: result @doc """ Catch specific error `expected_error` and call function `f` with it. Others errors or oks pass untouched. ## Examples iex> error = {:error, :foo} iex> Result.Operators.catch_error(error, :foo, fn _ -> {:ok, "FOO"} end) {:ok, "FOO"} iex> error = {:error, :bar} iex> Result.Operators.catch_error(error, :foo, fn _ -> {:ok, "FOO"} end) {:error, :bar} iex> ok = {:ok, 3} iex> Result.Operators.catch_error(ok, :foo, fn _ -> {:ok, "FOO"} end) {:ok, 3} """ @spec catch_error(Result.t(a, b), a, (a -> Result.t(c, d))) :: Result.t(a, b) | Result.t(c, d) when a: var, b: var, c: var, d: var def catch_error({:error, err}, expected_error, f) when is_function(f, 1) do result = if err == expected_error do f.(err) else {:error, err} end Utils.check(result) end def catch_error(result, _, _f), do: result @doc """ Catch all errors and call function `f` with it. # ## Examples iex> error = {:error, :foo} iex> Result.Operators.catch_all_errors(error, fn err -> {:ok, Atom.to_string(err)} end) {:ok, "foo"} iex> error = {:error, :bar} iex> Result.Operators.catch_all_errors(error, fn err -> {:ok, Atom.to_string(err)} end) {:ok, "bar"} iex> ok = {:ok, 3} iex> Result.Operators.catch_all_errors(ok, fn err -> {:ok, Atom.to_string(err)} end) {:ok, 3} """ @spec catch_all_errors(Result.t(a, b), (a -> Result.t(c, d))) :: Result.t(c, b | d) when a: var, b: var, c: var, d: var def catch_all_errors({:error, err}, f) when is_function(f, 1) do err |> f.() |> Utils.check() end def catch_all_errors(result, _f), do: result @doc """ Perform function `f` on Ok result and return it ## Examples iex> Result.Operators.perform({:ok, 123}, fn(x) -> x * 100 end) {:ok, 123} iex> Result.Operators.perform({:error, 123}, fn(x) -> IO.puts(x) end) {:error, 123} """ @spec perform(Result.t(err, val), (val -> any)) :: Result.t(err, val) when err: var, val: var def perform({:ok, value} = result, f) do f.(value) result end def perform({:error, _} = result, _f), do: result @doc """ Return `value` if result is ok, otherwise `default` ## Examples iex> Result.Operators.with_default({:ok, 123}, 456) 123 iex> Result.Operators.with_default({:error, 123}, 456) 456 """ @spec with_default(Result.t(any, val), val) :: val when val: var def with_default({:ok, value}, _default), do: value def with_default({:error, _}, default), do: default @doc """ Return `true` if result is error ## Examples iex> Result.Operators.error?({:error, 123}) true iex> Result.Operators.error?({:ok, 123}) false """ @spec error?(Result.t(any, any)) :: boolean def error?({:error, _}), do: true def error?(_result), do: false @doc """ Return `true` if result is ok ## Examples iex> Result.Operators.ok?({:ok, 123}) true iex> Result.Operators.ok?({:error, 123}) false """ @spec ok?(Result.t(any, any)) :: boolean def ok?({:ok, _}), do: true def ok?(_result), do: false @doc """ Flatten nested results resolve :: Result x (Result x a) -> Result x a ## Examples iex> Result.Operators.resolve({:ok, {:ok, 1}}) {:ok, 1} iex> Result.Operators.resolve({:ok, {:error, "one"}}) {:error, "one"} iex> Result.Operators.resolve({:error, "two"}) {:error, "two"} """ @spec resolve(Result.t(any, Result.t(any, any))) :: Result.t(any, any) def resolve({:ok, {state, _value} = result}) when state in [:ok, :error] do result end def resolve({:error, _value} = result) do result end @doc """ Retry `count` times the function `f` if the result is negative retry :: Result err a -> (a -> Result err b) -> Int -> Int -> Result err b * `res` - input result * `f` - function retruns result * `count` - try count * `timeout` - timeout between retries ## Examples iex> Result.Operators.retry({:error, "Error"}, fn(x) -> {:ok, x} end, 3) {:error, "Error"} iex> Result.Operators.retry({:ok, "Ok"}, fn(x) -> {:ok, x} end, 3) {:ok, "Ok"} iex> Result.Operators.retry({:ok, "Ok"}, fn(_) -> {:error, "Error"} end, 3, 0) {:error, "Error"} """ @spec retry(Result.t(any, val), (val -> Result.t(any, any)), integer, integer) :: Result.t(any, any) when val: var def retry(res, f, count, timeout \\ 1000) def retry({:ok, value}, f, count, timeout) do value |> f.() |> again(value, f, count, timeout) end def retry({:error, _} = error, _f, _count, _timeout) do error end defp again({:error, _} = error, _value, _f, 0, _timeout) do error end defp again({:error, _}, value, f, count, timeout) do Process.sleep(timeout) again(f.(value), value, f, count - 1, timeout) end defp again(res, _value, _f, _count, _timeout) do res end end
25.100257
96
0.55254
791cce90a1f0f88099895bf7d18ea045c58dceb6
365
ex
Elixir
lib/course_planner_web/views/course_matrix_view.ex
digitalnatives/course_planner
27b1c8067edc262685e9c4dcbfcf82633bc8b8dc
[ "MIT" ]
38
2017-04-11T13:37:38.000Z
2021-05-22T19:35:36.000Z
lib/course_planner_web/views/course_matrix_view.ex
digitalnatives/course_planner
27b1c8067edc262685e9c4dcbfcf82633bc8b8dc
[ "MIT" ]
226
2017-04-07T13:14:14.000Z
2018-03-08T16:50:11.000Z
lib/course_planner_web/views/course_matrix_view.ex
digitalnatives/course_planner
27b1c8067edc262685e9c4dcbfcf82633bc8b8dc
[ "MIT" ]
7
2017-08-30T23:58:13.000Z
2021-03-28T11:50:45.000Z
defmodule CoursePlannerWeb.CourseMatrixView do @moduledoc false use CoursePlannerWeb, :view def course_name(offered_courses, id) do offered_courses[id].course.name end def total_students(offered_courses, id) do length(offered_courses[id].students) end def format_student_names(student_names) do Enum.join(student_names, "\n") end end
21.470588
46
0.764384
791cde850540f0b5723ece032086003079db57ae
4,256
ex
Elixir
clients/data_catalog/lib/google_api/data_catalog/v1/model/binding.ex
renovate-bot/elixir-google-api
1da34cd39b670c99f067011e05ab90af93fef1f6
[ "Apache-2.0" ]
1
2021-12-20T03:40:53.000Z
2021-12-20T03:40:53.000Z
clients/data_catalog/lib/google_api/data_catalog/v1/model/binding.ex
swansoffiee/elixir-google-api
9ea6d39f273fb430634788c258b3189d3613dde0
[ "Apache-2.0" ]
1
2020-08-18T00:11:23.000Z
2020-08-18T00:44:16.000Z
clients/data_catalog/lib/google_api/data_catalog/v1/model/binding.ex
dazuma/elixir-google-api
6a9897168008efe07a6081d2326735fe332e522c
[ "Apache-2.0" ]
null
null
null
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This file is auto generated by the elixir code generator program. # Do not edit this file manually. defmodule GoogleApi.DataCatalog.V1.Model.Binding do @moduledoc """ Associates `members`, or principals, with a `role`. ## Attributes * `condition` (*type:* `GoogleApi.DataCatalog.V1.Model.Expr.t`, *default:* `nil`) - The condition that is associated with this binding. If the condition evaluates to `true`, then this binding applies to the current request. If the condition evaluates to `false`, then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies). * `members` (*type:* `list(String.t)`, *default:* `nil`) - Specifies the principals requesting access for a Cloud Platform resource. `members` can have the following values: * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. * `user:{emailid}`: An email address that represents a specific Google account. For example, `[email protected]` . * `serviceAccount:{emailid}`: An email address that represents a service account. For example, `[email protected]`. * `group:{emailid}`: An email address that represents a Google group. For example, `[email protected]`. * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a user that has been recently deleted. For example, `[email protected]?uid=123456789012345678901`. If the user is recovered, this value reverts to `user:{emailid}` and the recovered user retains the role in the binding. * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a service account that has been recently deleted. For example, `[email protected]?uid=123456789012345678901`. If the service account is undeleted, this value reverts to `serviceAccount:{emailid}` and the undeleted service account retains the role in the binding. * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a Google group that has been recently deleted. For example, `[email protected]?uid=123456789012345678901`. If the group is recovered, this value reverts to `group:{emailid}` and the recovered group retains the role in the binding. * `domain:{domain}`: The G Suite domain (primary) that represents all the users of that domain. For example, `google.com` or `example.com`. * `role` (*type:* `String.t`, *default:* `nil`) - Role that is assigned to the list of `members`, or principals. For example, `roles/viewer`, `roles/editor`, or `roles/owner`. """ use GoogleApi.Gax.ModelBase @type t :: %__MODULE__{ :condition => GoogleApi.DataCatalog.V1.Model.Expr.t() | nil, :members => list(String.t()) | nil, :role => String.t() | nil } field(:condition, as: GoogleApi.DataCatalog.V1.Model.Expr) field(:members, type: :list) field(:role) end defimpl Poison.Decoder, for: GoogleApi.DataCatalog.V1.Model.Binding do def decode(value, options) do GoogleApi.DataCatalog.V1.Model.Binding.decode(value, options) end end defimpl Poison.Encoder, for: GoogleApi.DataCatalog.V1.Model.Binding do def encode(value, options) do GoogleApi.Gax.ModelBase.encode(value, options) end end
80.301887
1,972
0.75188
791ce4a8134d4add91195b445140ed79771c08fc
862
exs
Elixir
mix.exs
pk4media/elixir_device
54aa60ebc294fb9523ac836cc86705410afda6b5
[ "MIT" ]
1
2017-02-21T06:17:15.000Z
2017-02-21T06:17:15.000Z
mix.exs
pk4media/elixir_device
54aa60ebc294fb9523ac836cc86705410afda6b5
[ "MIT" ]
null
null
null
mix.exs
pk4media/elixir_device
54aa60ebc294fb9523ac836cc86705410afda6b5
[ "MIT" ]
null
null
null
defmodule Device.Mixfile do use Mix.Project def project do [app: :device, version: "1.0.0", elixir: "~> 1.3", build_embedded: Mix.env == :prod, start_permanent: Mix.env == :prod, description: description(), package: package(), deps: deps()] end def application do [applications: [:logger], env: [unknown: :phone, empty: :desktop]] end defp deps do [{:benchfella, "~> 0.3.0", only: [:dev, :test]}, {:ex_doc, ">= 0.0.0", only: :dev}] end defp description do """ Elixir User-Agent device detection library based on the device npm library """ end defp package do [files: ["lib", "mix.exs", "README*", "LICENSE*"], maintainers: ["David Negstad"], licenses: ["MIT"], links: %{"GitHub" => "https://github.com/pk4media/elixir_device"}] end end
22.102564
78
0.577726