-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fission-cli up * fission-cli watch
- Loading branch information
Showing
14 changed files
with
175 additions
and
57 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
-- | Update DNS via the CLI | ||
module Fission.CLI.DNS (update) where | ||
|
||
import RIO | ||
|
||
import Data.Has | ||
|
||
import Servant | ||
import Servant.Client | ||
|
||
import qualified Fission.Config as Config | ||
import Fission.Internal.Constraint | ||
|
||
import Fission.IPFS.CID.Types | ||
|
||
import qualified Fission.Web.Client as Client | ||
import qualified Fission.Web.DNS.Client as DNS.Client | ||
|
||
import Fission.CLI.Display.Error as CLI.Error | ||
import qualified Fission.CLI.Display.Loader as CLI | ||
import Fission.CLI.Display.Success as CLI.Success | ||
|
||
import qualified Fission.AWS.Types as AWS | ||
|
||
update :: MonadRIO cfg m | ||
=> HasLogFunc cfg | ||
=> Has Client.Runner cfg | ||
=> CID | ||
-> BasicAuthData | ||
-> m (Either ClientError AWS.DomainName) | ||
update cid@(CID hash) auth = do | ||
logDebug $ "Updating DNS to " <> display hash | ||
|
||
Client.Runner runner <- Config.get | ||
update' runner auth cid >>= \case | ||
Right domain -> do | ||
CLI.Success.dnsUpdated $ AWS.getDomainName domain | ||
return $ Right domain | ||
|
||
Left err -> do | ||
CLI.Error.put' err | ||
return $ Left err | ||
|
||
update' :: MonadIO m | ||
=> (ClientM AWS.DomainName -> IO a) | ||
-> BasicAuthData | ||
-> CID | ||
-> m a | ||
update' runner auth cid = | ||
liftIO . CLI.withLoader 50000 | ||
. runner | ||
$ DNS.Client.update auth cid |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module Fission.Web.DNS.Client (update) where | ||
|
||
import RIO | ||
|
||
import Servant | ||
import Servant.Client | ||
|
||
import qualified Fission.AWS.DomainName.Types as AWS | ||
import Fission.IPFS.CID.Types | ||
import qualified Fission.Web.Routes as Routes | ||
|
||
update :: BasicAuthData -> CID -> ClientM AWS.DomainName | ||
update = client (Proxy :: Proxy Routes.DNSRoute) |
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 |
---|---|---|
|
@@ -6,6 +6,7 @@ module Fission.Web.Routes | |
, IPFSPrefix | ||
, IPFSRoute | ||
, PingRoute | ||
, DNSRoute | ||
) where | ||
|
||
import Servant | ||
|
Oops, something went wrong.