summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHentioe <me@bluerain.io>2020-12-10 22:06:59 +0800
committerHentioe <me@bluerain.io>2020-12-10 22:06:59 +0800
commit441e623d2be762f35b0cb4dfcb652c29a3530a69 (patch)
tree8963e4e129d0dcf2f1ed6a81af21758d30e91f97
parentAutomatic retry of token application failure (diff)
Add run command related APIs
-rw-r--r--lib/azure_ex.ex10
-rw-r--r--lib/azure_ex/model/virtual_machine_run_commands/create_or_update.ex41
-rw-r--r--lib/azure_ex/model/virtual_machines_run_commands/run_commands.ex15
3 files changed, 66 insertions, 0 deletions
diff --git a/lib/azure_ex.ex b/lib/azure_ex.ex
index 4e8b5dd..106776e 100644
--- a/lib/azure_ex.ex
+++ b/lib/azure_ex.ex
@@ -135,4 +135,14 @@ defmodule AzureEx do
"ListByResourceGroupResources",
"GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/resources?api-version=2020-06-01"
)
+
+ defendpoint(
+ "RunCommandVirtualMachinesRunCommands",
+ "POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand?api-version=2020-06-01"
+ )
+
+ defendpoint(
+ "CreateOrUpdateVirtualMachineRunCommands",
+ "PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}?api-version=2020-06-01"
+ )
end
diff --git a/lib/azure_ex/model/virtual_machine_run_commands/create_or_update.ex b/lib/azure_ex/model/virtual_machine_run_commands/create_or_update.ex
new file mode 100644
index 0000000..6bcfc85
--- /dev/null
+++ b/lib/azure_ex/model/virtual_machine_run_commands/create_or_update.ex
@@ -0,0 +1,41 @@
+defmodule AzureEx.Model.VirtualMachineRunCommands.CreateOrUpdate do
+ @moduledoc false
+
+ use TypedStruct
+
+ alias __MODULE__.{Properties, RunCommandInputParameter, VirtualMachineRunCommandScriptSource}
+
+ typedstruct module: RunCommandInputParameter do
+ @derive Jason.Encoder
+
+ field :name, String.t()
+ field :value, String.t()
+ end
+
+ typedstruct module: VirtualMachineRunCommandScriptSource do
+ @derive Jason.Encoder
+
+ field :commandId, String.t()
+ field :script, String.t()
+ field :scriptUri, String.t()
+ end
+
+ typedstruct module: Properties do
+ @derive Jason.Encoder
+
+ field :asyncExecution, boolean()
+ field :parameters, [RunCommandInputParameter]
+ field :protectedParameters, [RunCommandInputParameter]
+ field :runAsPassword, String.t()
+ field :runAsUser, String.t()
+ field :source, VirtualMachineRunCommandScriptSource.t()
+ field :timeoutInSeconds, integer
+ end
+
+ typedstruct do
+ @derive Jason.Encoder
+
+ field :location, String.t()
+ field :properties, Properties.t()
+ end
+end
diff --git a/lib/azure_ex/model/virtual_machines_run_commands/run_commands.ex b/lib/azure_ex/model/virtual_machines_run_commands/run_commands.ex
new file mode 100644
index 0000000..5be6f50
--- /dev/null
+++ b/lib/azure_ex/model/virtual_machines_run_commands/run_commands.ex
@@ -0,0 +1,15 @@
+defmodule AzureEx.Model.VirtualMachinesRunCommands.RunCommand do
+ @moduledoc false
+
+ use TypedStruct
+
+ alias __MODULE__.{RunCommandInputParameter}
+
+ typedstruct do
+ @derive Jason.Encoder
+
+ field :commandId, String.t()
+ field :parameters, [RunCommandInputParameter]
+ field :script, [String]
+ end
+end