Skip to content

Commit

Permalink
Pass options to formation
Browse files Browse the repository at this point in the history
Signed-off-by: Zack Siri <[email protected]>
  • Loading branch information
zacksiri committed Nov 21, 2023
1 parent 9d1b72b commit 20acf34
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/uplink/components/instance/provision.ex
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ defmodule Uplink.Components.Instance.Provision do
|> String.split("-")
|> List.first()

[_, db_engine] = String.split(module, "/")
[_, component_type] = String.split(module, "/")

name = "#{db_engine}-#{id}"
name = "#{component_type}-#{id}"

with {:ok, credential} <-
Drivers.perform(module, %{"credential" => credential_params}),
Expand Down
16 changes: 16 additions & 0 deletions lib/uplink/drivers/bucket.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
defmodule Uplink.Drivers.Bucket do
defmodule Aws do
def perform(%{"credential" => credential_params}, options \\ []) do
credential_params = Map.put(credential_params, "type", "component")

with {:ok, master_credential} <-
Formation.S3.Credential.create(credential_params),
{:ok, generated_credential} <-
Formation.Aws.Bucket.create_credential_and_bucket(
master_credential, options
) do
{:ok, generated_credential}
end
end
end
end
4 changes: 2 additions & 2 deletions lib/uplink/drivers/database.ex
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
defmodule Uplink.Drivers.Database do
defmodule Postgresql do
def perform(%{"credential" => credential_params}) do
def perform(%{"credential" => credential_params}, options \\ []) do
with {:ok, master_credential} <-
Formation.Postgresql.Credential.create(credential_params),
{:ok, generated_credential} <-
Formation.Postgresql.create_user_and_database(master_credential) do
Formation.Postgresql.create_user_and_database(master_credential, options) do
{:ok, generated_credential}
end
end
Expand Down

0 comments on commit 20acf34

Please sign in to comment.