hetzner 0.7.1.1 → 0.7.2.0
raw patch · 3 files changed
+14/−1 lines, 3 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Hetzner.Cloud: MissingToken :: CloudException
+ Hetzner.Cloud: getTokenFromEnvThrow :: IO Token
- Hetzner.Cloud: streamPages :: forall key f a i m. (Foldable f, MonadIO m) => (Maybe Int -> IO (WithMeta key (f a))) -> ConduitT i a m ()
+ Hetzner.Cloud: streamPages :: forall (key :: Symbol) f a i (m :: Type -> Type). (Foldable f, MonadIO m) => (Maybe Int -> IO (WithMeta key (f a))) -> ConduitT i a m ()
- Hetzner.Cloud.Fingerprint: data () => Fingerprint
+ Hetzner.Cloud.Fingerprint: data Fingerprint
- Hetzner.DNS: streamPages :: forall key f a i m. (Foldable f, MonadIO m) => (Maybe Int -> IO (WithMeta key (f a))) -> ConduitT i a m ()
+ Hetzner.DNS: streamPages :: forall (key :: Symbol) f a i (m :: Type -> Type). (Foldable f, MonadIO m) => (Maybe Int -> IO (WithMeta key (f a))) -> ConduitT i a m ()
Files
- changelog.md +4/−0
- hetzner.cabal +1/−1
- src/Hetzner/Cloud.hs +9/−0
changelog.md view
@@ -1,3 +1,7 @@+## 0.7.2.0+* Add `getTokenFromEnvThrow`.+* Add the `MissingToken` constructor to the `CloudException` type.+ ## 0.7.1.1 * Metadata update. * Remove server type and image list webpages.
hetzner.cabal view
@@ -2,7 +2,7 @@ category: Cloud synopsis: Hetzner Cloud and DNS library. description: Hetzner Cloud and DNS library. Check the readme and documentation for more details.-version: 0.7.1.1+version: 0.7.2.0 cabal-version: 1.18 build-type: Simple author: Daniel Casanueva (coding `at` danielcasanueva.eu)
src/Hetzner/Cloud.hs view
@@ -38,6 +38,7 @@ ( -- * Tokens Token (..) , getTokenFromEnv+ , getTokenFromEnvThrow -- * Server metadata , Metadata (..) , getMetadata@@ -275,6 +276,13 @@ getTokenFromEnv :: IO (Maybe Token) getTokenFromEnv = fmap fromString <$> System.lookupEnv "HETZNER_API_TOKEN" +-- | Calls 'getTokenFromEnv' and throws a 'MissingToken' exception if+-- the token is missing.+getTokenFromEnvThrow :: IO Token+getTokenFromEnvThrow = do+ mtoken <- getTokenFromEnv+ maybe (throwIO MissingToken) pure mtoken+ -- | An error returned by Hetzner. data Error = Error { -- | Error code.@@ -545,6 +553,7 @@ data CloudException = CloudError Error | JSONError (HTTP.Response ByteString) String+ | MissingToken deriving Show instance Exception CloudException