summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHentioe <me@bluerain.io>2020-10-20 15:41:18 +0800
committerHentioe <me@bluerain.io>2020-10-20 15:41:18 +0800
commitfff3e55d01630293dbae0f4c427e4e7f88ad1fc8 (patch)
tree437f2543a9cd76c8071af5f709afa295a9ae87c0
parentAdd deps (diff)
Add some models
-rw-r--r--.formatter.exs3
-rw-r--r--lib/model/virtual_machine.ex21
-rw-r--r--lib/model/virtual_machine_list_result.ex17
-rw-r--r--mix.exs3
-rw-r--r--mix.lock1
5 files changed, 43 insertions, 2 deletions
diff --git a/.formatter.exs b/.formatter.exs
index d2cda26..376fc86 100644
--- a/.formatter.exs
+++ b/.formatter.exs
@@ -1,4 +1,5 @@
# Used by "mix format"
[
- inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
+ inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"],
+ import_deps: [:typed_struct]
]
diff --git a/lib/model/virtual_machine.ex b/lib/model/virtual_machine.ex
new file mode 100644
index 0000000..2886c14
--- /dev/null
+++ b/lib/model/virtual_machine.ex
@@ -0,0 +1,21 @@
+defmodule AzureEx.Model.VirtualMachine do
+ @moduledoc """
+ A struct representing a virtual machine.
+ """
+ use TypedStruct
+
+ typedstruct do
+ @typedoc "Describes a Virtual Machine."
+
+ # Resource Id.
+ field :id, String.t()
+ # Resource location.
+ field :location, String.t()
+ # Resource name.
+ field :name, String.t()
+ # Resource type.
+ field :type, String.t()
+ # The virtual machine zones.
+ field :zones, [String.t()]
+ end
+end
diff --git a/lib/model/virtual_machine_list_result.ex b/lib/model/virtual_machine_list_result.ex
new file mode 100644
index 0000000..87d6475
--- /dev/null
+++ b/lib/model/virtual_machine_list_result.ex
@@ -0,0 +1,17 @@
+defmodule AzureEx.Model.VirtualMachineListResult do
+ @moduledoc """
+ A struct representing a list virtual machine operation response.
+ """
+
+ use TypedStruct
+
+ typedstruct do
+ @typedoc "The List Virtual Machine operation response."
+
+ # The URI to fetch the next page of VMs.
+ # Call ListNext() with this URI to fetch the next page of Virtual Machines.
+ field :next_link, String.t()
+ # The list of virtual machines.
+ field :value, [AzureEx.Model.VirtualMachine.t()]
+ end
+end
diff --git a/mix.exs b/mix.exs
index 00495b4..d67ed26 100644
--- a/mix.exs
+++ b/mix.exs
@@ -21,7 +21,8 @@ defmodule AzureEx.MixProject do
# Run "mix help deps" to learn about dependencies.
defp deps do
[
- {:httpoison, "~> 1.7"}
+ {:httpoison, "~> 1.7"},
+ {:typed_struct, "~> 0.2.1"}
]
end
end
diff --git a/mix.lock b/mix.lock
index 5dab878..d3d8069 100644
--- a/mix.lock
+++ b/mix.lock
@@ -7,5 +7,6 @@
"mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"},
"parse_trans": {:hex, :parse_trans, "3.3.0", "09765507a3c7590a784615cfd421d101aec25098d50b89d7aa1d66646bc571c1", [:rebar3], [], "hexpm", "17ef63abde837ad30680ea7f857dd9e7ced9476cdd7b0394432af4bfc241b960"},
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.6", "cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0", [:make, :mix, :rebar3], [], "hexpm", "bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680"},
+ "typed_struct": {:hex, :typed_struct, "0.2.1", "e1993414c371f09ff25231393b6430bd89d780e2a499ae3b2d2b00852f593d97", [:mix], [], "hexpm", "8f5218c35ec38262f627b2c522542f1eae41f625f92649c0af701a6fab2e11b3"},
"unicode_util_compat": {:hex, :unicode_util_compat, "0.5.0", "8516502659002cec19e244ebd90d312183064be95025a319a6c7e89f4bccd65b", [:rebar3], [], "hexpm", "d48d002e15f5cc105a696cf2f1bbb3fc72b4b770a184d8420c8db20da2674b38"},
}