packages feed

hetzner 0.7.3.0 → 0.8.0.0

raw patch · 3 files changed

+7/−74 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- Hetzner.Cloud: Datacenter :: DatacenterID -> Text -> Text -> Location -> DatacenterServers -> Datacenter
- Hetzner.Cloud: DatacenterID :: Int -> DatacenterID
- Hetzner.Cloud: DatacenterServers :: [ServerTypeID] -> [ServerTypeID] -> [ServerTypeID] -> DatacenterServers
- Hetzner.Cloud: DatacentersWithRecommendation :: [Datacenter] -> DatacenterID -> DatacentersWithRecommendation
- Hetzner.Cloud: [availableServers] :: DatacenterServers -> [ServerTypeID]
- Hetzner.Cloud: [datacenterDescription] :: Datacenter -> Text
- Hetzner.Cloud: [datacenterID] :: Datacenter -> DatacenterID
- Hetzner.Cloud: [datacenterLocation] :: Datacenter -> Location
- Hetzner.Cloud: [datacenterName] :: Datacenter -> Text
- Hetzner.Cloud: [datacenterRecommendation] :: DatacentersWithRecommendation -> DatacenterID
- Hetzner.Cloud: [datacenterServers] :: Datacenter -> DatacenterServers
- Hetzner.Cloud: [datacenters] :: DatacentersWithRecommendation -> [Datacenter]
- Hetzner.Cloud: [migrationAvailableServers] :: DatacenterServers -> [ServerTypeID]
- Hetzner.Cloud: [primaryIPDatacenter] :: PrimaryIP -> Datacenter
- Hetzner.Cloud: [serverDatacenter] :: Server -> Datacenter
- Hetzner.Cloud: [supportedServers] :: DatacenterServers -> [ServerTypeID]
- Hetzner.Cloud: data Datacenter
- Hetzner.Cloud: data DatacenterServers
- Hetzner.Cloud: data DatacentersWithRecommendation
- Hetzner.Cloud: getDatacenter :: Token -> DatacenterID -> IO Datacenter
- Hetzner.Cloud: getDatacenters :: Token -> IO DatacentersWithRecommendation
- Hetzner.Cloud: instance Data.Aeson.Types.FromJSON.FromJSON Hetzner.Cloud.Datacenter
- Hetzner.Cloud: instance Data.Aeson.Types.FromJSON.FromJSON Hetzner.Cloud.DatacenterID
- Hetzner.Cloud: instance Data.Aeson.Types.FromJSON.FromJSON Hetzner.Cloud.DatacenterServers
- Hetzner.Cloud: instance Data.Aeson.Types.FromJSON.FromJSON Hetzner.Cloud.DatacentersWithRecommendation
- Hetzner.Cloud: instance Data.Aeson.Types.ToJSON.ToJSON Hetzner.Cloud.DatacenterID
- Hetzner.Cloud: instance GHC.Classes.Eq Hetzner.Cloud.DatacenterID
- Hetzner.Cloud: instance GHC.Classes.Ord Hetzner.Cloud.DatacenterID
- Hetzner.Cloud: instance GHC.Show.Show Hetzner.Cloud.Datacenter
- Hetzner.Cloud: instance GHC.Show.Show Hetzner.Cloud.DatacenterID
- Hetzner.Cloud: instance GHC.Show.Show Hetzner.Cloud.DatacenterServers
- Hetzner.Cloud: instance GHC.Show.Show Hetzner.Cloud.DatacentersWithRecommendation
- Hetzner.Cloud: newtype DatacenterID
- Hetzner.Cloud: NewServer :: Bool -> Maybe (Either DatacenterID LocationID) -> [FirewallID] -> ImageID -> [Label] -> Text -> [NetworkID] -> Bool -> Bool -> ServerTypeID -> [SSHKeyID] -> Bool -> [VolumeID] -> NewServer
+ Hetzner.Cloud: NewServer :: Bool -> Maybe LocationID -> [FirewallID] -> ImageID -> [Label] -> Text -> [NetworkID] -> Bool -> Bool -> ServerTypeID -> [SSHKeyID] -> Bool -> [VolumeID] -> NewServer
- Hetzner.Cloud: PrimaryIP :: ResourceID -> Bool -> Bool -> ZonedTime -> Datacenter -> PrimaryIPID -> Either (PublicIPInfo Text IPv4) (PublicIPInfo [PublicIPInfo Text IPv6] IPv6Range) -> LabelMap -> Text -> PrimaryIP
+ Hetzner.Cloud: PrimaryIP :: ResourceID -> Bool -> Bool -> ZonedTime -> PrimaryIPID -> Either (PublicIPInfo Text IPv4) (PublicIPInfo [PublicIPInfo Text IPv6] IPv6Range) -> LabelMap -> Text -> PrimaryIP
- Hetzner.Cloud: Server :: ZonedTime -> Datacenter -> ServerID -> Image -> LabelMap -> Bool -> Text -> PublicNetwork -> ServerType -> ServerStatus -> Server
+ Hetzner.Cloud: Server :: ZonedTime -> ServerID -> Image -> LabelMap -> Bool -> Text -> PublicNetwork -> ServerType -> ServerStatus -> Server
- Hetzner.Cloud: [newServerLocation] :: NewServer -> Maybe (Either DatacenterID LocationID)
+ Hetzner.Cloud: [newServerLocation] :: NewServer -> Maybe LocationID

Files

changelog.md view
@@ -1,3 +1,6 @@+## 0.8.0.0+* Remove data centers. These have been deprecated by Hetzner.+ ## 0.7.3.0 * `Eq` instance for `OSFlavor`. * New function: `isSystemImage`.
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.3.0+version: 0.8.0.0 cabal-version: 1.18 build-type: Simple author: Daniel Casanueva (coding `at` danielcasanueva.eu)@@ -31,7 +31,7 @@     , TypeApplications     , CPP   build-depends:-      base >= 4.16 && < 4.21+      base >= 4.16 && < 4.23     , text, aeson, containers, conduit     , http-conduit, bytestring, yaml, time     , country, ip, megaparsec, scientific
src/Hetzner/Cloud.hs view
@@ -56,13 +56,6 @@   , waitForAction   , HasActions (..)   , waitForActions-    -- ** Datacenters-  , DatacenterID (..)-  , DatacenterServers (..)-  , Datacenter (..)-  , DatacentersWithRecommendation (..)-  , getDatacenters-  , getDatacenter     -- ** Firewalls   , FirewallID (..)   , TrafficDirection (..)@@ -900,65 +893,6 @@   actionsOf = foldMap actionsOf  ------------------------------------------------------------------------------------------------------- Datacenters--------------------------------------------------------------------------------------------------------- | Datacenter identifier.-newtype DatacenterID = DatacenterID Int deriving (Eq, Ord, Show, FromJSON, ToJSON)---- | Server types available in a datacenter.-data DatacenterServers = DatacenterServers-  { availableServers :: [ServerTypeID]-  , migrationAvailableServers :: [ServerTypeID]-  , supportedServers :: [ServerTypeID]-    } deriving Show--instance FromJSON DatacenterServers where-  parseJSON = JSON.withObject "DatacenterServers" $ \o -> DatacenterServers-    <$> o .: "available"-    <*> o .: "available_for_migration"-    <*> o .: "supported"---- | A datacenter within a location.-data Datacenter = Datacenter-  { datacenterID :: DatacenterID-  , datacenterName :: Text-  , datacenterDescription :: Text-  , datacenterLocation :: Location-  , datacenterServers :: DatacenterServers-    } deriving Show--instance FromJSON Datacenter where-  parseJSON = JSON.withObject "Datacenter" $ \o -> Datacenter-    <$> o .: "id"-    <*> o .: "name"-    <*> o .: "description"-    <*> o .: "location"-    <*> o .: "server_types"---- | Datacenter list with a datacenter recommendation for new servers.-data DatacentersWithRecommendation = DatacentersWithRecommendation-  { datacenters :: [Datacenter]-    -- | The datacenter which is recommended to be used to create-    --   new servers.-  , datacenterRecommendation :: DatacenterID-    } deriving Show--instance FromJSON DatacentersWithRecommendation where-  parseJSON = JSON.withObject "DatacentersWithRecommendation" $ \o -> DatacentersWithRecommendation-    <$> o .: "datacenters"-    <*> o .: "recommendation"---- | Get all datacenters.-getDatacenters :: Token -> IO DatacentersWithRecommendation-getDatacenters token = cloudQuery "GET" "/datacenters" noBody token Nothing---- | Get a single datacenter.-getDatacenter :: Token -> DatacenterID -> IO Datacenter-getDatacenter token (DatacenterID i) = withoutKey @"datacenter" <$>-  cloudQuery "GET" ("/datacenters/" <> fromString (show i)) noBody token Nothing------------------------------------------------------------------------------------------------------ -- Firewalls ---------------------------------------------------------------------------------------------------- @@ -1461,7 +1395,6 @@   , primaryIPIsBlocked :: Bool     -- | Point in time where the primary IP was created.   , primaryIPCreated :: ZonedTime-  , primaryIPDatacenter :: Datacenter   , primaryIPID :: PrimaryIPID     -- | Primary IP together with reverse DNS information.   , primaryIP :: Either (PublicIPInfo Text IPv4) (PublicIPInfo [PublicIPInfo Text IPv6] IPv6Range)@@ -1479,7 +1412,6 @@       <*> o .: "auto_delete"       <*> o .: "blocked"       <*> o .: "created"-      <*> o .: "datacenter"       <*> o .: "id"       <*> (case iptype :: Text of              "ipv4" -> Left <$> (o .: "dns_ptr" >>= JSON.parseJSON . head)@@ -1762,7 +1694,6 @@ -- | A server. data Server = Server   { serverCreated :: ZonedTime-  , serverDatacenter :: Datacenter   , serverID :: ServerID   , serverImage :: Image   , serverLabels :: LabelMap@@ -1776,7 +1707,6 @@ instance FromJSON Server where   parseJSON = JSON.withObject "Server" $ \o -> Server     <$> o .: "created"-    <*> o .: "datacenter"     <*> o .: "id"     <*> o .: "image"     <*> o .: "labels"@@ -1790,7 +1720,7 @@ data NewServer = NewServer   { -- | Automount attached volumes.     newServerAutomount :: Bool-  , newServerLocation :: Maybe (Either DatacenterID LocationID)+  , newServerLocation :: Maybe LocationID   , newServerFirewalls :: [FirewallID]   , newServerImage :: ImageID   , newServerLabels :: [Label]@@ -1812,7 +1742,7 @@ instance ToJSON NewServer where   toJSON nserver = JSON.object $ mconcat     [ pure $ "automount" .= (newServerAutomount nserver && not (null $ newServerVolumes nserver))-    , maybe mempty (pure . either ("datacenter".=) ("location".=)) $ newServerLocation nserver+    , maybe mempty (pure . ("location".=)) $ newServerLocation nserver     , pure $ "firewalls" .=         fmap (\fwid -> JSON.object [ "firewall" .= fwid ]) (newServerFirewalls nserver)     , pure $ "image" .= newServerImage nserver