-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup ability to manage lxd cluster pool for testing images
- Loading branch information
Showing
10 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
defmodule Polar.Encrypted.Map do | ||
use Cloak.Ecto.Map, vault: Polar.Vault | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
defmodule Polar.Machines do | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
defmodule Polar.Machines.Cluster do | ||
use Ecto.Schema | ||
import Ecto.Changeset | ||
|
||
schema "clusters" do | ||
field :name, :string | ||
field :current_state, :string, default: "created" | ||
|
||
field :type, :string | ||
field :architecture, :string | ||
|
||
field :credential, Polar.Encrypted.Map | ||
|
||
timestamps(type: :utc_datetime) | ||
end | ||
|
||
@doc false | ||
def changeset(cluster, attrs) do | ||
cluster | ||
|> cast(attrs, [:name, :type, :architecture, :current_state, :credential]) | ||
|> validate_required([:name, :type, :architecture, :current_state, :credential]) | ||
end | ||
end |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
defmodule Polar.Vault do | ||
use Cloak.Vault, otp_app: :polar | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
defmodule Polar.Repo.Migrations.CreateClusters do | ||
use Ecto.Migration | ||
|
||
def change do | ||
create table(:clusters) do | ||
add :name, :citext, null: false | ||
add :type, :citext, null: false | ||
add :arch, :citext, null: false | ||
add :credential, :binary, null: false | ||
add :current_state, :citext, default: "created" | ||
|
||
timestamps(type: :utc_datetime_usec) | ||
end | ||
end | ||
end |