Last active
March 19, 2023 20:54
-
-
Save sorentwo/54d99fb2ac05cb63ea1e30aa1935b6fc to your computer and use it in GitHub Desktop.
Revisions
-
sorentwo revised this gist
Mar 19, 2023 . 1 changed file with 1 addition and 4 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -3,8 +3,6 @@ defmodule Oban.Pro.Clouds.Heroku do @behaviour Oban.Pro.Cloud @enforce_keys [:app, :auth_token, :dyno] defstruct @enforce_keys @@ -16,14 +14,13 @@ defmodule Oban.Pro.Clouds.Heroku do @impl Oban.Pro.Cloud def scale(quantity, %{app: app, auth_token: auth_token, dyno: dyno}) do url = "https://api.heroku.com/apps/#{app}/formation/#{dyno}" headers = [ {"Content-Type", "application/json"}, {"Accept", "application/vnd.heroku+json; version=3"}, {"Authorization", "Bearer #{auth_token}"} ] Req.patch!(url, json: %{quantity: quantity}, headers: headers) end end -
sorentwo created this gist
Mar 17, 2023 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ defmodule Oban.Pro.Clouds.Heroku do @moduledoc false @behaviour Oban.Pro.Cloud alias Oban.Pro.Cloud @enforce_keys [:app, :auth_token, :dyno] defstruct @enforce_keys @impl Oban.Pro.Cloud def init(opts) do struct!(__MODULE__, opts) end @impl Oban.Pro.Cloud def scale(quantity, %{app: app, auth_token: auth_token, dyno: dyno}) do url = "https://api.heroku.com/apps/#{app}/formation/#{dyno}" body = Jason.encode!(%{quantity: quantity}) headers = [ {"Content-Type", "application/json"}, {"Accept", "application/vnd.heroku+json; version=3"}, {"Authorization", "Bearer #{auth_token}"} ] Cloud.request(:patch, url, body, headers) end end