DOH 0.1.0.0 → 0.1.1.0
raw patch · 4 files changed
+59/−10 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- DOH.cabal +7/−5
- README.md +50/−1
- src/Network/DigitalOcean.hs +2/−1
- test/Spec.hs +0/−3
DOH.cabal view
@@ -2,9 +2,9 @@ -- see http://haskell.org/cabal/users-guide/ name: DOH-version: 0.1.0.0-synopsis: A complete API wrapper for DigitalOcean API V2-description: A complete API wrapper for DigitalOcean API V2+version: 0.1.1.0+synopsis: Complete API bindings for DigitalOcean API V2+description: Complete API bindings for DigitalOcean API V2 . To get started, see @Network.DigitalOcean@ module below. license: MIT@@ -18,7 +18,7 @@ cabal-version: >=1.10 source-repository head type: git- location: https://github.com/inzva/DigitalOcean.hs+ location: https://github.com/inzva/DOH library exposed-modules: Network.DigitalOcean Network.DigitalOcean.Http,@@ -80,5 +80,7 @@ QuickCheck, quickcheck-instances, interpolatedstring-perl6,- filepath+ filepath,+ containers,+ unordered-containers hs-source-dirs: src, test
README.md view
@@ -1,2 +1,51 @@ # DigitalOcean.hs-Haskell bindings for DigitalOcean API v2+Complete API bindings for DigitalOcean API V2++# Getting Started+Here is an example usage of the API:+```haskell+{-# LANGUAGE OverloadedStrings #-}++module Main where++-----------------------------------------------------------------+import Network.DigitalOcean+import Network.DigitalOcean.Types+import Network.DigitalOcean.Services+-----------------------------------------------------------------+import Control.Monad.Except+import Control.Monad.Reader+-----------------------------------------------------------------++client :: Client+client = Client "your api key"++main :: IO ()+main = do+ result <- runExceptT $ (runReaderT $ runDO createViaSshKeys) client+ case result of+ Left err -> print err+ Right _ -> return ()++createViaSshKeys :: DO ()+createViaSshKeys = do+ -- Read a public key from a key pair and create ssh keys on DigitalOcean with it+ pubKey <- liftIO $ readFile "/Users/yigitozkavci/.ssh/do_api_rsa.pub"+ sshKey <- createSSHKey (SSHKeyPayload "my api key" pubKey) + + -- Create 2 droplets with our newly uploaded ssh keys+ let dropletPayload = IDropletPayload "nyc3" "512mb" "ubuntu-14-04-x64" (Just [sshkeyFingerprint sshKey]) Nothing Nothing Nothing Nothing Nothing Nothing Nothing+ droplets <- map dropletId <$> createDroplets ["droplet-1", "droplet-2"] dropletPayload++ -- Take snapshot of our newly created droplets+ forM_ droplets $ \dropletId -> performDropletAction dropletId (TakeSnapshot (Just "bulk snapshot"))+```++For full documentation and reference, see: http://hackage.haskell.org/package/DOH-0.1.1.0/docs/Network-DigitalOcean.html++# Contributing+What can you do?+- You can [open an issue](https://github.com/inzva/DigitalOcean.hs/issues/new) for unexpected / needed behaviors+- Better, you can send a Pull Request++Any kind of contributions are welcome, even if it's updating docs / improving commenting / improving tests.
src/Network/DigitalOcean.hs view
@@ -1,6 +1,7 @@ {-| Module : DigitalOcean-Description : This module is where user shall interract with the whole API+Description : Complete API bindings for DigitalOcean API V2+ Copyright : (c) Yiğit Özkavcı, 2017 License : MIT Maintainer : yigitozkavci8@gmail.com
test/Spec.hs view
@@ -132,9 +132,6 @@ <*> arbitrary <*> arbitrary -instance ToJSON Region where- toJSON = genericToJSON $ aesonPrefix snakeCase- prop_Region :: Region -> Property prop_Region = prop_Response (Proxy :: Proxy Region) . encode