mismi-kernel (empty) → 0.0.1
raw patch · 7 files changed
+267/−0 lines, 7 filesdep +basedep +hedgehogdep +mismi-kernel
Dependencies added: base, hedgehog, mismi-kernel, mismi-p, text
Files
- CHANGELOG.md +5/−0
- LICENSE +30/−0
- mismi-kernel.cabal +68/−0
- src/Mismi/Kernel/Data.hs +112/−0
- test/Test/Mismi/Kernel/Data.hs +24/−0
- test/Test/Mismi/Kernel/Gen.hs +11/−0
- test/test.hs +17/−0
+ CHANGELOG.md view
@@ -0,0 +1,5 @@+## Version 0.0.1 (2018-12-16)++- Replace `p` submodule with `mismi-p`+- Upgrade tests from QuickCheck to hedgehog+- Remove `amazonka`, `x`, `disorder` and `twine` submodules
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright 2017, Nick Hibberd <nhibberd@gmail.com>, All Rights Reserved.++Copyright 2017, Ambiata, All Rights Reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are+met:++ 1. Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ 2. Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.++ 3. Neither the name of the copyright holder nor the names of+ its contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ mismi-kernel.cabal view
@@ -0,0 +1,68 @@+version: 0.0.1++name:+ mismi-kernel+author:+ Nick Hibberd+maintainer:+ Nick Hibberd <nhibberd@gmail.com>+homepage:+ https://github.com/nhibberd/mismi+bug-reports:+ https://github.com/nhibberd/mismi/issues+synopsis:+ AWS Library+description:+ mismi-kernel is a simple dependency-free encoding of amazon regions.+category:+ AWS+license:+ BSD3+license-file:+ LICENSE+cabal-version:+ >= 1.8+build-type:+ Simple+tested-with:+ GHC == 8.2.2+ , GHC == 8.4.3+extra-source-files:+ CHANGELOG.md++library+ build-depends:+ base >= 3 && < 5+ , mismi-p+ , text >= 1.1 && < 1.3++ ghc-options:+ -Wall++ hs-source-dirs:+ src++ exposed-modules:+ Mismi.Kernel.Data++test-suite test+ type:+ exitcode-stdio-1.0++ main-is:+ test.hs+ ghc-options:+ -Wall -threaded -O2+ hs-source-dirs:+ test++ other-modules:+ Test.Mismi.Kernel.Data+ Test.Mismi.Kernel.Gen++ build-depends:+ base >= 3 && < 5+ , mismi-kernel+ , mismi-p+ , hedgehog+ , text >= 1.1 && < 1.3
+ src/Mismi/Kernel/Data.hs view
@@ -0,0 +1,112 @@+{-# LANGUAGE NoImplicitPrelude #-}+{-# LANGUAGE OverloadedStrings #-}+module Mismi.Kernel.Data (+ MismiRegion (..)+ , renderMismiRegion+ , parseMismiRegion+ ) where++import P+++-- | Mismi's view of available AWS regions.+data MismiRegion =+ IrelandRegion -- ^ Europe / eu-west-1+ | FrankfurtRegion -- ^ Europe / eu-central-1+ | TokyoRegion -- ^ Asia Pacific / ap-northeast-1+ | SeoulRegion -- ^ Asia Pacific / ap-northeast-2+ | SingaporeRegion -- ^ Asia Pacific / ap-southeast-1+ | SydneyRegion -- ^ Asia Pacific / ap-southeast-2+ | MumbaiRegion -- ^ Asia Pacific / ap-south-1+ | MontrealRegion+ | LondonRegion++ | BeijingRegion -- ^ China / cn-north-1+ | NorthVirginiaRegion -- ^ US / us-east-1+ | OhioRegion -- ^ US / us-east-2+ | NorthCaliforniaRegion -- ^ US / us-west-1+ | OregonRegion -- ^ US / us-west-2+ | GovCloudRegion -- ^ AWS GovCloud / us-gov-west-1+ | GovCloudFIPSRegion -- ^ AWS GovCloud (FIPS 140-2) S3 Only / fips-us-gov-west-1+ | SaoPauloRegion -- ^ South America / sa-east-1+ deriving (Eq, Ord, Read, Show, Enum, Bounded)++++renderMismiRegion :: MismiRegion -> Text+renderMismiRegion r =+ case r of+ IrelandRegion ->+ "eu-west-1"+ FrankfurtRegion ->+ "eu-central-1"+ TokyoRegion ->+ "ap-northeast-1"+ SeoulRegion ->+ "ap-northeast-2"+ SingaporeRegion ->+ "ap-southeast-1"+ SydneyRegion ->+ "ap-southeast-2"+ MumbaiRegion ->+ "ap-south-1"+ BeijingRegion ->+ "cn-north-1"+ NorthVirginiaRegion ->+ "us-east-1"+ OhioRegion ->+ "us-east-2"+ NorthCaliforniaRegion ->+ "us-west-1"+ OregonRegion ->+ "us-west-2"+ GovCloudRegion ->+ "us-gov-west-1"+ GovCloudFIPSRegion ->+ "fips-us-gov-west-1"+ SaoPauloRegion ->+ "sa-east-1"+ MontrealRegion ->+ "ca-central-1"+ LondonRegion ->+ "eu-west-2"++parseMismiRegion :: Text -> Maybe MismiRegion+parseMismiRegion t =+ case t of+ "eu-west-1" ->+ Just IrelandRegion+ "eu-central-1" ->+ Just FrankfurtRegion+ "ap-northeast-1" ->+ Just TokyoRegion+ "ap-northeast-2" ->+ Just SeoulRegion+ "ap-southeast-1" ->+ Just SingaporeRegion+ "ap-southeast-2" ->+ Just SydneyRegion+ "ap-south-1" ->+ Just MumbaiRegion+ "cn-north-1" ->+ Just BeijingRegion+ "us-east-1" ->+ Just NorthVirginiaRegion+ "us-east-2" ->+ Just OhioRegion+ "us-west-2" ->+ Just OregonRegion+ "us-west-1" ->+ Just NorthCaliforniaRegion+ "us-gov-west-1" ->+ Just GovCloudRegion+ "fips-us-gov-west-1" ->+ Just GovCloudFIPSRegion+ "sa-east-1" ->+ Just SaoPauloRegion+ "eu-west-2" ->+ Just LondonRegion+ "ca-central-1" ->+ Just MontrealRegion+ _ ->+ Nothing
+ test/Test/Mismi/Kernel/Data.hs view
@@ -0,0 +1,24 @@+{-# LANGUAGE NoImplicitPrelude #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE TemplateHaskell #-}+module Test.Mismi.Kernel.Data (tests) where++import Hedgehog++import Mismi.Kernel.Data++import P++import qualified Test.Mismi.Kernel.Gen as Gen++prop_region :: Property+prop_region =+ property $ do+ region <- forAll Gen.genMismiRegion+ let+ result = parseMismiRegion $ renderMismiRegion region+ result === Just region++tests :: IO Bool+tests =+ checkSequential $$(discover)
+ test/Test/Mismi/Kernel/Gen.hs view
@@ -0,0 +1,11 @@+{-# LANGUAGE NoImplicitPrelude #-}+module Test.Mismi.Kernel.Gen where++import Mismi.Kernel.Data++import Hedgehog+import qualified Hedgehog.Gen as Gen++genMismiRegion :: Gen MismiRegion+genMismiRegion =+ Gen.enumBounded
+ test/test.hs view
@@ -0,0 +1,17 @@+import Control.Monad (unless)++import System.Exit (exitFailure)+import System.IO (BufferMode(..), hSetBuffering, stdout, stderr)++import qualified Test.Mismi.Kernel.Data as Data++main :: IO ()+main = do+ hSetBuffering stdout LineBuffering+ hSetBuffering stderr LineBuffering++ results <- sequence [+ Data.tests+ ]++ unless (and results) exitFailure