mirror of
https://github.com/algora-io/tv.git
synced 2024-11-26 01:00:20 +02:00
add function to update object in storage
This commit is contained in:
parent
0ab70fc530
commit
3c01987dc5
@ -123,6 +123,17 @@ defmodule Algora.Storage do
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def update_object!(bucket, object, opts) do
|
||||||
|
bucket = Algora.config([:buckets, bucket])
|
||||||
|
|
||||||
|
with {:ok, %{body: body}} <- ExAws.S3.get_object(bucket, object) |> ExAws.request(),
|
||||||
|
{:ok, res} <- ExAws.S3.put_object(bucket, object, body, opts) |> ExAws.request() do
|
||||||
|
res
|
||||||
|
else
|
||||||
|
err -> err
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
defp broadcast!(topic, msg) do
|
defp broadcast!(topic, msg) do
|
||||||
Phoenix.PubSub.broadcast!(@pubsub, topic, {__MODULE__, msg})
|
Phoenix.PubSub.broadcast!(@pubsub, topic, {__MODULE__, msg})
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user