-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add Extension for limiting data retention periods * allow message to be nil * remove placeholder text * make credo happy * update changelog * centralize data retention options
- Loading branch information
1 parent
0f1fd67
commit 5ef1aca
Showing
24 changed files
with
263 additions
and
60 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
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
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 was deleted.
Oops, something went wrong.
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,50 @@ | ||
defmodule Lightning.Projects.ProjectLimiter do | ||
@moduledoc false | ||
|
||
alias Lightning.Extensions.UsageLimiting | ||
alias Lightning.Extensions.UsageLimiting.Action | ||
alias Lightning.Extensions.UsageLimiting.Context | ||
alias Lightning.Services.UsageLimiter | ||
|
||
@spec limit_failure_alert(project_id :: Ecto.UUID.t()) :: | ||
:ok | UsageLimiting.error() | ||
def limit_failure_alert(project_id) do | ||
UsageLimiter.limit_action(%Action{type: :alert_failure}, %Context{ | ||
project_id: project_id | ||
}) | ||
end | ||
|
||
@spec request_new_user( | ||
project_id :: Ecto.UUID.t(), | ||
user_count :: non_neg_integer() | ||
) :: :ok | UsageLimiting.error() | ||
def request_new_user(project_id, user_count) do | ||
UsageLimiter.limit_action( | ||
%Action{ | ||
type: :new_user, | ||
amount: user_count | ||
}, | ||
%Context{ | ||
project_id: project_id | ||
} | ||
) | ||
end | ||
|
||
@spec get_data_retention_periods(project_id :: Ecto.UUID.t()) :: [ | ||
pos_integer(), | ||
... | ||
] | ||
def get_data_retention_periods(project_id) do | ||
UsageLimiter.get_data_retention_periods(%Context{ | ||
project_id: project_id | ||
}) | ||
end | ||
|
||
@spec get_data_retention_message(project_id :: Ecto.UUID.t()) :: | ||
Lightning.Extensions.Message.t() | ||
def get_data_retention_message(project_id) do | ||
UsageLimiter.get_data_retention_message(%Context{ | ||
project_id: project_id | ||
}) | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
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
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
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
Oops, something went wrong.