The DOH package

[ Tags: library, mit, network ] [ Propose Tags ]

Complete API bindings for DigitalOcean API V2

To get started, see Network.DigitalOcean module below.


[Skip to Readme]

Properties

Versions 0.1.0.0, 0.1.1.0, 0.1.1.1, 0.1.2.0
Dependencies aeson, aeson-casing, base (==4.9.*), bytestring, containers, filepath, http-client, http-client-tls, http-types, lens, mtl, text, time, unordered-containers, uri [details]
License MIT
Author Yiğit Özkavcı
Maintainer yigitozkavci8@gmail.com
Category Network
Source repository head: git clone https://github.com/inzva/DOH
Uploaded Wed Aug 2 06:16:07 UTC 2017 by yigitozkavci
Distributions NixOS:0.1.2.0
Downloads 165 total (13 in the last 30 days)
Rating 2.0 (1 ratings) [clear rating]
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2017-08-02 [all 1 reports]
Hackage Matrix CI

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for DOH-0.1.2.0

[back to package description]

DOH

Complete API bindings for DigitalOcean API V2

Getting Started

Here is an example usage of the API:

{-# 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" Ubuntu1404x64 (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.2.0

Contributing

What can you do?

  • You can open an issue 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.