From d6849d2c9c3a45f7bf119a026dd397a3a08b4806 Mon Sep 17 00:00:00 2001 From: Scott Sedgwick Date: Tue, 23 Jul 2019 14:47:31 +1000 Subject: [PATCH 01/11] Update to GHC 8.6.5 --- aws-ec2.cabal | 39 ++++++++++--------- cmd/put-metric.hs | 6 ++- cmd/run-inst.hs | 6 ++- .../DescribeLoadBalancerPolicyTypes.hs | 4 +- src/Aws/Elb/TH.hs | 12 +++--- src/Aws/Query.hs | 3 ++ src/Aws/Query/TH.hs | 4 +- 7 files changed, 43 insertions(+), 31 deletions(-) diff --git a/aws-ec2.cabal b/aws-ec2.cabal index 0559427..753ab3f 100644 --- a/aws-ec2.cabal +++ b/aws-ec2.cabal @@ -89,7 +89,7 @@ library Aws.Elb.Commands.ConfigureHealthCheck build-depends: base >=4.7 && <5, - template-haskell >=2.9.0.0 && <2.12, + template-haskell >=2.14 && <2.15, containers >=0.5.5.1 && <0.6, mtl >=2.1.3.1 && <2.3, text >=1.2.0.6 && <1.3, @@ -98,32 +98,33 @@ library base64-bytestring >=1.0.0.1 && <1.1, blaze-builder >=0.4.0.1 && <0.5, time >=1.4.2 && <1.7, - aeson >=0.8.0.2 && <0.12, + aeson >=0.8.0.2 && <1.5, unordered-containers >=0.2.5.1 && <0.3, - vector >=0.10.12.3 && <0.12, + vector >=0.10.12.3 && <0.13, scientific >=0.3.3.8 && <0.4, - exceptions >=0.8.0.2 && <0.9, - resourcet >=1.1.6 && <1.2, + exceptions >=0.8.0.2 && <0.11, + resourcet >=1.1.6 && <1.3, byteable >=0.1.1 && <0.2, cryptohash >=0.11.6 && <0.12, http-types >=0.8.6 && <0.10, - http-conduit >=2.1.7.2 && <2.2, - conduit-extra >=1.1.9.1 && <1.2, - blaze-markup >=0.7.0.2 && <0.8, - xml-conduit >=1.2.6 && <1.4, + http-conduit >=2.1.7.2 && <2.4, + conduit-extra >=1.1.9.1 && <1.4, + blaze-markup >=0.7.0.2 && <0.9, + xml-conduit >=1.2.6 && <1.9, iproute >=1.3.2 && <1.8, - aws >=0.9.4 && <0.15 + aws >=0.9.4 && <0.22, + swagger2 >=2.0.0 && <2.5 default-language: Haskell2010 hs-source-dirs: src executable put-metric main-is: put-metric.hs build-depends: - base >=4.7.0.2 && <4.10, + base >=4.7.0.2 && <5, bytestring >=0.10.4.0 && <0.11, text >=1.2.0.6 && <1.3, - optparse-applicative >=0.11.0.2 && <0.13, - aws >=0.9.4 && <0.15, + optparse-applicative >=0.15.0.0 && <0.16, + aws >=0.9.4 && <0.22, aws-ec2 >=0.3.4 && <0.4 default-language: Haskell2010 hs-source-dirs: cmd @@ -132,17 +133,17 @@ executable put-metric executable run-inst main-is: run-inst.hs build-depends: - base >=4.7.0.2 && <4.10, + base >=4.7.0.2 && <5, bytestring >=0.10.4.0 && <0.11, text >=1.2.0.6 && <1.3, - optparse-applicative >=0.11.0.2 && <0.13, - aws >=0.9.4 && <0.15, + optparse-applicative >=0.11.0.2 && <0.16, + aws >=0.9.4 && <0.22, aws-ec2 >=0.3.4 && <0.4, - yaml >=0.8.12 && <0.9, - vector >=0.10.12.3 && <0.12, + yaml >=0.8.12 && <0.12, + vector >=0.10.12.3 && <0.13, containers >=0.5.5.1 && <0.6, unordered-containers >=0.2.5.1 && <0.3, - aeson >=0.8.0.2 && <0.12 + aeson >=0.8.0.2 && <1.5 default-language: Haskell2010 hs-source-dirs: cmd ghc-options: -static diff --git a/cmd/put-metric.hs b/cmd/put-metric.hs index 161a759..09a612d 100644 --- a/cmd/put-metric.hs +++ b/cmd/put-metric.hs @@ -5,6 +5,7 @@ module Main where import Control.Monad import Data.Monoid import Options.Applicative +import Options.Applicative.Types (Backtracking(..)) import qualified Data.ByteString.Char8 as B import qualified Data.Text as T @@ -21,6 +22,7 @@ configuration useMetadata = do Just cr' -> return Configuration { timeInfo = Timestamp , credentials = cr' , logger = defaultLog Warning + , proxy = Nothing } where load = if useMetadata then loadCredentialsFromInstanceMetadata @@ -57,8 +59,10 @@ main = join $ customExecParser prefs opts prefs = ParserPrefs { prefMultiSuffix = "" , prefDisambiguate = True , prefShowHelpOnError = True - , prefBacktrack = True + , prefShowHelpOnEmpty = True + , prefBacktrack = Backtrack , prefColumns = 80 + , prefHelpLongEquals = True } opts = parser `info` header "AWS CloudWatch PutMetricData client" diff --git a/cmd/run-inst.hs b/cmd/run-inst.hs index 0704d1d..51a3d50 100644 --- a/cmd/run-inst.hs +++ b/cmd/run-inst.hs @@ -6,6 +6,7 @@ module Main where import Control.Monad import Data.Monoid import Options.Applicative +import Options.Applicative.Types (Backtracking(..)) import qualified Data.ByteString.Char8 as B import qualified Data.Text as T @@ -27,6 +28,7 @@ configuration useMetadata = do Just cr' -> return Configuration { timeInfo = Timestamp , credentials = cr' , logger = defaultLog Warning + , proxy = Nothing } where load = if useMetadata then loadCredentialsFromInstanceMetadata @@ -107,8 +109,10 @@ main = join $ customExecParser prefs opts prefs = ParserPrefs { prefMultiSuffix = "" , prefDisambiguate = True , prefShowHelpOnError = True - , prefBacktrack = True + , prefShowHelpOnEmpty = True + , prefBacktrack = Backtrack , prefColumns = 80 + , prefHelpLongEquals = True } opts = parser `info` header "AWS Ec2 client" diff --git a/src/Aws/Elb/Commands/DescribeLoadBalancerPolicyTypes.hs b/src/Aws/Elb/Commands/DescribeLoadBalancerPolicyTypes.hs index 03be1fe..5691013 100644 --- a/src/Aws/Elb/Commands/DescribeLoadBalancerPolicyTypes.hs +++ b/src/Aws/Elb/Commands/DescribeLoadBalancerPolicyTypes.hs @@ -28,9 +28,9 @@ instance SignQuery DescribeLoadBalancerPolicyTypes where instance ResponseConsumer DescribeLoadBalancerPolicyTypes Value where type ResponseMetadata Value = QueryMetadata - responseConsumer ListLoadBalancerPolicyTypes = queryResponseConsumer $ \cu -> do + responseConsumer _ ListLoadBalancerPolicyTypes = queryResponseConsumer $ \cu -> do let cu' = cu $.// Cu.laxElement "PolicyTypeName" &| (toValue (XMLValueOptions "item") . Cu.node) return $ Array $ V.fromList cu' - responseConsumer (DescribeLoadBalancerPolicyTypes _) = queryResponseConsumer $ valueConsumerOpt (XMLValueOptions "member") "DescribeLoadBalancerPolicyTypesResult" fromJSONConsumer + responseConsumer _ (DescribeLoadBalancerPolicyTypes _) = queryResponseConsumer $ valueConsumerOpt (XMLValueOptions "member") "DescribeLoadBalancerPolicyTypesResult" fromJSONConsumer instance Transaction DescribeLoadBalancerPolicyTypes Value diff --git a/src/Aws/Elb/TH.hs b/src/Aws/Elb/TH.hs index 02c7ce1..c968734 100644 --- a/src/Aws/Elb/TH.hs +++ b/src/Aws/Elb/TH.hs @@ -15,12 +15,11 @@ module Aws.Elb.TH ( , elbValueTransactionDef ) where -import Language.Haskell.TH -import Language.Haskell.TH.Lib -import Language.Haskell.TH.Syntax +import Language.Haskell.TH.Lib (DecsQ, conT, stringE) +import Language.Haskell.TH.Syntax (Name) -import Data.Text (Text) -import Data.Aeson.Types (FromJSON(..)) +import Data.Text (Text) +import Data.Aeson.Types (FromJSON(..)) import Aws.Core import Aws.Query @@ -31,9 +30,10 @@ elbValueTransaction :: Name -> String -> DecsQ elbValueTransaction ty tag = [d| instance ResponseConsumer $(conT ty) Value where type ResponseMetadata Value = QueryMetadata - responseConsumer _ = queryResponseConsumer $ valueConsumerOpt (XMLValueOptions "member") $(stringE tag) fromJSONConsumer + responseConsumer _ _ = queryResponseConsumer $ valueConsumerOpt (XMLValueOptions "member") $(stringE tag) fromJSONConsumer instance Transaction $(conT ty) Value |] +elbValueTransactionDef :: Name -> Name -> String -> String -> DecsQ elbValueTransactionDef ty cons tag filterKey = queryValueTransactionDef ty cons tag 'elbSignQuery 'defVersion "member" filterKey diff --git a/src/Aws/Query.hs b/src/Aws/Query.hs index ad2ef91..838fbd0 100644 --- a/src/Aws/Query.hs +++ b/src/Aws/Query.hs @@ -93,6 +93,9 @@ data QueryMetadata = QueryMetadata instance Loggable QueryMetadata where toLogText (QueryMetadata r) = "Query: requestId=" <> fromMaybe "" r +instance Semigroup QueryMetadata where + (QueryMetadata r1) <> (QueryMetadata r2) = QueryMetadata (r1 `mplus` r2) + instance Monoid QueryMetadata where mempty = QueryMetadata Nothing (QueryMetadata r1) `mappend` (QueryMetadata r2) = QueryMetadata (r1 `mplus` r2) diff --git a/src/Aws/Query/TH.hs b/src/Aws/Query/TH.hs index 3349a5d..a8edeba 100644 --- a/src/Aws/Query/TH.hs +++ b/src/Aws/Query/TH.hs @@ -41,7 +41,7 @@ queryValueTransactionDef ty cons tag signF version item filterKey = do instance ResponseConsumer $(conT ty) Value where type ResponseMetadata Value = QueryMetadata - responseConsumer _ = queryResponseConsumer $ valueConsumerOpt (XMLValueOptions $(stringE item)) $(stringE tag) fromJSONConsumer + responseConsumer _ _ = queryResponseConsumer $ valueConsumerOpt (XMLValueOptions $(stringE item)) $(stringE tag) fromJSONConsumer instance Transaction $(conT ty) Value |] @@ -50,7 +50,7 @@ queryValueTransaction :: Name -> String -> DecsQ queryValueTransaction ty tag = [d| instance ResponseConsumer $(conT ty) Value where type ResponseMetadata Value = QueryMetadata - responseConsumer _ = queryResponseConsumer $ valueConsumer $(stringE tag) fromJSONConsumer + responseConsumer _ _ = queryResponseConsumer $ valueConsumer $(stringE tag) fromJSONConsumer instance Transaction $(conT ty) Value |] From b511c4b237208654923c50edbc8987b0123282c3 Mon Sep 17 00:00:00 2001 From: Scott Sedgwick Date: Tue, 23 Jul 2019 15:33:40 +1000 Subject: [PATCH 02/11] Fixed the stack build. Rolled back optparse-applicative one version. --- .travis.yml | 9 ++++++++- aws-ec2.cabal | 4 ++-- cmd/put-metric.hs | 4 +--- cmd/run-inst.hs | 4 +--- stack.yaml | 5 +++-- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index c699352..3cf6231 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,6 +46,9 @@ matrix: - env: BUILD=cabal GHCVER=8.0.1 CABALVER=1.24 HAPPYVER=1.19.5 ALEXVER=3.1.7 compiler: ": #GHC 8.0.1" addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}} + - env: BUILD=cabal GHCVER=8.6.5 CABALVER=2.4.1 HAPPYVER=1.19.5 ALEXVER=3.1.7 + compiler: ": #GHC 8.6.5" + addons: {apt: {packages: [cabal-install-2.41,ghc-8.6.5,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}} # Build with the newest GHC and cabal-install. This is an accepted failure, # see below. @@ -57,7 +60,7 @@ matrix: # variable, such as using --stack-yaml to point to a different file. - env: BUILD=stack ARGS="" compiler: ": #stack default" - addons: {apt: {packages: [ghc-7.10.3], sources: [hvr-ghc]}} + addons: {apt: {packages: [ghc-8.6.5], sources: [hvr-ghc]}} - env: BUILD=stack ARGS="--resolver lts-2" compiler: ": #stack 7.8.4" @@ -71,6 +74,10 @@ matrix: compiler: ": #stack 7.10.3" addons: {apt: {packages: [ghc-7.10.3], sources: [hvr-ghc]}} + - env: BUILD=stack ARGS="--resolver lts-13.29" + compiler: ": #stack 8.6.5" + addons: {apt: {packages: [ghc-8.6.5], sources: [hvr-ghc]}} + # Nightly builds are allowed to fail - env: BUILD=stack ARGS="--resolver nightly" compiler: ": #stack nightly" diff --git a/aws-ec2.cabal b/aws-ec2.cabal index 753ab3f..836b2d9 100644 --- a/aws-ec2.cabal +++ b/aws-ec2.cabal @@ -123,7 +123,7 @@ executable put-metric base >=4.7.0.2 && <5, bytestring >=0.10.4.0 && <0.11, text >=1.2.0.6 && <1.3, - optparse-applicative >=0.15.0.0 && <0.16, + optparse-applicative >=0.11.0.2 && <0.15, aws >=0.9.4 && <0.22, aws-ec2 >=0.3.4 && <0.4 default-language: Haskell2010 @@ -136,7 +136,7 @@ executable run-inst base >=4.7.0.2 && <5, bytestring >=0.10.4.0 && <0.11, text >=1.2.0.6 && <1.3, - optparse-applicative >=0.11.0.2 && <0.16, + optparse-applicative >=0.11.0.2 && <0.15, aws >=0.9.4 && <0.22, aws-ec2 >=0.3.4 && <0.4, yaml >=0.8.12 && <0.12, diff --git a/cmd/put-metric.hs b/cmd/put-metric.hs index 09a612d..f759b44 100644 --- a/cmd/put-metric.hs +++ b/cmd/put-metric.hs @@ -5,7 +5,6 @@ module Main where import Control.Monad import Data.Monoid import Options.Applicative -import Options.Applicative.Types (Backtracking(..)) import qualified Data.ByteString.Char8 as B import qualified Data.Text as T @@ -60,9 +59,8 @@ main = join $ customExecParser prefs opts , prefDisambiguate = True , prefShowHelpOnError = True , prefShowHelpOnEmpty = True - , prefBacktrack = Backtrack + , prefBacktrack = True , prefColumns = 80 - , prefHelpLongEquals = True } opts = parser `info` header "AWS CloudWatch PutMetricData client" diff --git a/cmd/run-inst.hs b/cmd/run-inst.hs index 51a3d50..2bec23f 100644 --- a/cmd/run-inst.hs +++ b/cmd/run-inst.hs @@ -6,7 +6,6 @@ module Main where import Control.Monad import Data.Monoid import Options.Applicative -import Options.Applicative.Types (Backtracking(..)) import qualified Data.ByteString.Char8 as B import qualified Data.Text as T @@ -110,9 +109,8 @@ main = join $ customExecParser prefs opts , prefDisambiguate = True , prefShowHelpOnError = True , prefShowHelpOnEmpty = True - , prefBacktrack = Backtrack + , prefBacktrack = True , prefColumns = 80 - , prefHelpLongEquals = True } opts = parser `info` header "AWS Ec2 client" diff --git a/stack.yaml b/stack.yaml index 47d1321..fed5122 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,6 +1,7 @@ -resolver: lts-6.0 +resolver: lts-13.29 flags: {} extra-package-dbs: [] packages: - location: '.' -extra-deps: [] +extra-deps: +- aws-0.21.1@sha256:5290b819bd425f28c736b93a84955ced145bdb631a26d784d1b952e2e0ddc6b8 From 36ae23700abf214a9c4b82f879fc00e4e1f07a1b Mon Sep 17 00:00:00 2001 From: Scott Sedgwick Date: Tue, 23 Jul 2019 16:34:56 +1000 Subject: [PATCH 03/11] Extended and fixed travis configuration to try and get the later versioed builds to not fail. --- .travis.yml | 20 ++++++++++++++++---- aws-ec2.cabal | 5 ++--- src/Aws/Query.hs | 5 ++++- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3cf6231..84f7718 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,9 +46,9 @@ matrix: - env: BUILD=cabal GHCVER=8.0.1 CABALVER=1.24 HAPPYVER=1.19.5 ALEXVER=3.1.7 compiler: ": #GHC 8.0.1" addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}} - - env: BUILD=cabal GHCVER=8.6.5 CABALVER=2.4.1 HAPPYVER=1.19.5 ALEXVER=3.1.7 - compiler: ": #GHC 8.6.5" - addons: {apt: {packages: [cabal-install-2.41,ghc-8.6.5,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}} + - env: BUILD=cabal GHCVER=8.4.4 CABALVER=2.4.1 HAPPYVER=1.19.5 ALEXVER=3.1.7 + compiler: ": #GHC 8.4.4" + addons: {apt: {packages: [cabal-install-2.2,ghc-8.4.4,happy-1.19.9,alex-3.2.4], sources: [hvr-ghc]}} # Build with the newest GHC and cabal-install. This is an accepted failure, # see below. @@ -74,7 +74,19 @@ matrix: compiler: ": #stack 7.10.3" addons: {apt: {packages: [ghc-7.10.3], sources: [hvr-ghc]}} - - env: BUILD=stack ARGS="--resolver lts-13.29" + - env: BUILD=stack ARGS="--resolver lts-7" + compiler: ": #stack 8.0.1" + addons: {apt: {packages: [ghc-8.0.1], sources: [hvr-ghc]}} + + - env: BUILD=stack ARGS="--resolver lts-11" + compiler: ": #stack 8.2.2" + addons: {apt: {packages: [ghc-8.2.2], sources: [hvr-ghc]}} + + - env: BUILD=stack ARGS="--resolver lts-12" + compiler: ": #stack 8.4.4" + addons: {apt: {packages: [ghc-8.4.4], sources: [hvr-ghc]}} + + - env: BUILD=stack ARGS="--resolver lts-13" compiler: ": #stack 8.6.5" addons: {apt: {packages: [ghc-8.6.5], sources: [hvr-ghc]}} diff --git a/aws-ec2.cabal b/aws-ec2.cabal index 836b2d9..edc3de9 100644 --- a/aws-ec2.cabal +++ b/aws-ec2.cabal @@ -89,7 +89,7 @@ library Aws.Elb.Commands.ConfigureHealthCheck build-depends: base >=4.7 && <5, - template-haskell >=2.14 && <2.15, + template-haskell >=2.11 && <2.15, containers >=0.5.5.1 && <0.6, mtl >=2.1.3.1 && <2.3, text >=1.2.0.6 && <1.3, @@ -112,8 +112,7 @@ library blaze-markup >=0.7.0.2 && <0.9, xml-conduit >=1.2.6 && <1.9, iproute >=1.3.2 && <1.8, - aws >=0.9.4 && <0.22, - swagger2 >=2.0.0 && <2.5 + aws >=0.9.4 && <0.22 default-language: Haskell2010 hs-source-dirs: src diff --git a/src/Aws/Query.hs b/src/Aws/Query.hs index 838fbd0..b48bee1 100644 --- a/src/Aws/Query.hs +++ b/src/Aws/Query.hs @@ -6,6 +6,7 @@ , DeriveDataTypeable , MultiParamTypeClasses , FlexibleInstances + , CPP #-} module Aws.Query ( @@ -92,9 +93,11 @@ data QueryMetadata = QueryMetadata instance Loggable QueryMetadata where toLogText (QueryMetadata r) = "Query: requestId=" <> fromMaybe "" r - + +#if __GLASGOW_HASKELL__ >= 804 instance Semigroup QueryMetadata where (QueryMetadata r1) <> (QueryMetadata r2) = QueryMetadata (r1 `mplus` r2) +#endif instance Monoid QueryMetadata where mempty = QueryMetadata Nothing From 4af655622bfd5eb7917879b61f7c23c3d13871eb Mon Sep 17 00:00:00 2001 From: Scott Sedgwick Date: Tue, 23 Jul 2019 16:37:52 +1000 Subject: [PATCH 04/11] Fixed an error in travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 84f7718..a20bbdb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -48,7 +48,7 @@ matrix: addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}} - env: BUILD=cabal GHCVER=8.4.4 CABALVER=2.4.1 HAPPYVER=1.19.5 ALEXVER=3.1.7 compiler: ": #GHC 8.4.4" - addons: {apt: {packages: [cabal-install-2.2,ghc-8.4.4,happy-1.19.9,alex-3.2.4], sources: [hvr-ghc]}} + addons: {apt: {packages: [cabal-install-2.2,ghc-8.4.4,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}} # Build with the newest GHC and cabal-install. This is an accepted failure, # see below. From 2c6732d0545d9dd6cff26cf95b7f1f0d9447aa69 Mon Sep 17 00:00:00 2001 From: Scott Sedgwick Date: Tue, 23 Jul 2019 16:55:54 +1000 Subject: [PATCH 05/11] Reverted to Cabal 1.24 for GHC 8.2.2 and 8.4.4 builds --- .travis.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index a20bbdb..a34b4b5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,9 +46,12 @@ matrix: - env: BUILD=cabal GHCVER=8.0.1 CABALVER=1.24 HAPPYVER=1.19.5 ALEXVER=3.1.7 compiler: ": #GHC 8.0.1" addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}} - - env: BUILD=cabal GHCVER=8.4.4 CABALVER=2.4.1 HAPPYVER=1.19.5 ALEXVER=3.1.7 + - env: BUILD=cabal GHCVER=8.2.2 CABALVER=1.24 HAPPYVER=1.19.5 ALEXVER=3.1.7 + compiler: ": #GHC 8.2.2" + addons: {apt: {packages: [cabal-install-1.24,ghc-8.2.2,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}} + - env: BUILD=cabal GHCVER=8.4.4 CABALVER=1.24 HAPPYVER=1.19.5 ALEXVER=3.1.7 compiler: ": #GHC 8.4.4" - addons: {apt: {packages: [cabal-install-2.2,ghc-8.4.4,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}} + addons: {apt: {packages: [cabal-install-1.24,ghc-8.4.4,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}} # Build with the newest GHC and cabal-install. This is an accepted failure, # see below. From 9f629404728226ad0c3e98c0fbe726bc0ca78140 Mon Sep 17 00:00:00 2001 From: Scott Sedgwick Date: Tue, 23 Jul 2019 18:51:25 +1000 Subject: [PATCH 06/11] Fixed an error in stack.yaml --- stack.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stack.yaml b/stack.yaml index fed5122..2b3a615 100644 --- a/stack.yaml +++ b/stack.yaml @@ -2,6 +2,6 @@ resolver: lts-13.29 flags: {} extra-package-dbs: [] packages: -- location: '.' +- '.' extra-deps: - aws-0.21.1@sha256:5290b819bd425f28c736b93a84955ced145bdb631a26d784d1b952e2e0ddc6b8 From 314a8dc8c4f5b6444433a858a5931ddf2cc35b5e Mon Sep 17 00:00:00 2001 From: Scott Sedgwick Date: Tue, 23 Jul 2019 19:34:13 +1000 Subject: [PATCH 07/11] Relaxed some version constraints in cabal file to try and get the stack builds to pass. --- aws-ec2.cabal | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/aws-ec2.cabal b/aws-ec2.cabal index edc3de9..7a99aa1 100644 --- a/aws-ec2.cabal +++ b/aws-ec2.cabal @@ -90,14 +90,14 @@ library build-depends: base >=4.7 && <5, template-haskell >=2.11 && <2.15, - containers >=0.5.5.1 && <0.6, + containers >=0.5.5.1 && <0.7, mtl >=2.1.3.1 && <2.3, text >=1.2.0.6 && <1.3, bytestring >=0.10.4.0 && <0.11, base16-bytestring >=0.1.1.6 && <0.2, base64-bytestring >=1.0.0.1 && <1.1, blaze-builder >=0.4.0.1 && <0.5, - time >=1.4.2 && <1.7, + time >=1.4.2 && <1.9, aeson >=0.8.0.2 && <1.5, unordered-containers >=0.2.5.1 && <0.3, vector >=0.10.12.3 && <0.13, @@ -106,7 +106,7 @@ library resourcet >=1.1.6 && <1.3, byteable >=0.1.1 && <0.2, cryptohash >=0.11.6 && <0.12, - http-types >=0.8.6 && <0.10, + http-types >=0.8.6 && <0.13, http-conduit >=2.1.7.2 && <2.4, conduit-extra >=1.1.9.1 && <1.4, blaze-markup >=0.7.0.2 && <0.9, From 87cffd8e4d925d40e8e6a9fd6be4a3bd3ca2d9dd Mon Sep 17 00:00:00 2001 From: Scott Sedgwick Date: Tue, 23 Jul 2019 19:56:11 +1000 Subject: [PATCH 08/11] Relaxed some version constraints in cabal file to try and get the stack builds to pass. --- aws-ec2.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws-ec2.cabal b/aws-ec2.cabal index 7a99aa1..3db4e50 100644 --- a/aws-ec2.cabal +++ b/aws-ec2.cabal @@ -140,7 +140,7 @@ executable run-inst aws-ec2 >=0.3.4 && <0.4, yaml >=0.8.12 && <0.12, vector >=0.10.12.3 && <0.13, - containers >=0.5.5.1 && <0.6, + containers >=0.5.5.1 && <0.7, unordered-containers >=0.2.5.1 && <0.3, aeson >=0.8.0.2 && <1.5 default-language: Haskell2010 From 691883c9f5f4304d82896580e54aa6ce0f4d4d2f Mon Sep 17 00:00:00 2001 From: Scott Sedgwick Date: Tue, 23 Jul 2019 21:01:41 +1000 Subject: [PATCH 09/11] Commented out the ghc 7.x builds as they will never pass (upstream dependency yaml requires generic deriving, which was introduced in 8.0). Also commented out stack 8.0.1 build - it fails too, but I'm not sure why, when the ghc 8.0.1 build passes. --- .travis.yml | 69 ++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 47 insertions(+), 22 deletions(-) diff --git a/.travis.yml b/.travis.yml index a34b4b5..01908cf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,30 +25,39 @@ matrix: include: # We grab the appropriate GHC and cabal-install versions from hvr's PPA. See: # https://github.com/hvr/multi-ghc-travis + #- env: BUILD=cabal GHCVER=7.0.4 CABALVER=1.16 HAPPYVER=1.19.5 ALEXVER=3.1.7 # compiler: ": #GHC 7.0.4" # addons: {apt: {packages: [cabal-install-1.16,ghc-7.0.4,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}} + #- env: BUILD=cabal GHCVER=7.2.2 CABALVER=1.16 HAPPYVER=1.19.5 ALEXVER=3.1.7 # compiler: ": #GHC 7.2.2" # addons: {apt: {packages: [cabal-install-1.16,ghc-7.2.2,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}} + #- env: BUILD=cabal GHCVER=7.4.2 CABALVER=1.16 HAPPYVER=1.19.5 ALEXVER=3.1.7 # compiler: ": #GHC 7.4.2" # addons: {apt: {packages: [cabal-install-1.16,ghc-7.4.2,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}} + # - env: BUILD=cabal GHCVER=7.6.3 CABALVER=1.16 HAPPYVER=1.19.5 ALEXVER=3.1.7 # compiler: ": #GHC 7.6.3" # addons: {apt: {packages: [cabal-install-1.16,ghc-7.6.3,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}} - - env: BUILD=cabal GHCVER=7.8.4 CABALVER=1.18 HAPPYVER=1.19.5 ALEXVER=3.1.7 - compiler: ": #GHC 7.8.4" - addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}} - - env: BUILD=cabal GHCVER=7.10.3 CABALVER=1.22 HAPPYVER=1.19.5 ALEXVER=3.1.7 - compiler: ": #GHC 7.10.3" - addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}} + + # - env: BUILD=cabal GHCVER=7.8.4 CABALVER=1.18 HAPPYVER=1.19.5 ALEXVER=3.1.7 + # compiler: ": #GHC 7.8.4" + # addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}} + + # - env: BUILD=cabal GHCVER=7.10.3 CABALVER=1.22 HAPPYVER=1.19.5 ALEXVER=3.1.7 + # compiler: ": #GHC 7.10.3" + # addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}} + - env: BUILD=cabal GHCVER=8.0.1 CABALVER=1.24 HAPPYVER=1.19.5 ALEXVER=3.1.7 compiler: ": #GHC 8.0.1" addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}} + - env: BUILD=cabal GHCVER=8.2.2 CABALVER=1.24 HAPPYVER=1.19.5 ALEXVER=3.1.7 compiler: ": #GHC 8.2.2" addons: {apt: {packages: [cabal-install-1.24,ghc-8.2.2,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}} + - env: BUILD=cabal GHCVER=8.4.4 CABALVER=1.24 HAPPYVER=1.19.5 ALEXVER=3.1.7 compiler: ": #GHC 8.4.4" addons: {apt: {packages: [cabal-install-1.24,ghc-8.4.4,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}} @@ -65,21 +74,21 @@ matrix: compiler: ": #stack default" addons: {apt: {packages: [ghc-8.6.5], sources: [hvr-ghc]}} - - env: BUILD=stack ARGS="--resolver lts-2" - compiler: ": #stack 7.8.4" - addons: {apt: {packages: [ghc-7.8.4], sources: [hvr-ghc]}} + # - env: BUILD=stack ARGS="--resolver lts-2" + # compiler: ": #stack 7.8.4" + # addons: {apt: {packages: [ghc-7.8.4], sources: [hvr-ghc]}} - - env: BUILD=stack ARGS="--resolver lts-3" - compiler: ": #stack 7.10.2" - addons: {apt: {packages: [ghc-7.10.2], sources: [hvr-ghc]}} + # - env: BUILD=stack ARGS="--resolver lts-3" + # compiler: ": #stack 7.10.2" + # addons: {apt: {packages: [ghc-7.10.2], sources: [hvr-ghc]}} - - env: BUILD=stack ARGS="--resolver lts-6" - compiler: ": #stack 7.10.3" - addons: {apt: {packages: [ghc-7.10.3], sources: [hvr-ghc]}} + # - env: BUILD=stack ARGS="--resolver lts-6" + # compiler: ": #stack 7.10.3" + # addons: {apt: {packages: [ghc-7.10.3], sources: [hvr-ghc]}} - - env: BUILD=stack ARGS="--resolver lts-7" - compiler: ": #stack 8.0.1" - addons: {apt: {packages: [ghc-8.0.1], sources: [hvr-ghc]}} + # - env: BUILD=stack ARGS="--resolver lts-7" + # compiler: ": #stack 8.0.1" + # addons: {apt: {packages: [ghc-8.0.1], sources: [hvr-ghc]}} - env: BUILD=stack ARGS="--resolver lts-11" compiler: ": #stack 8.2.2" @@ -108,12 +117,28 @@ matrix: # compiler: ": #stack 7.8.4 osx" # os: osx - - env: BUILD=stack ARGS="--resolver lts-3" - compiler: ": #stack 7.10.2 osx" + # - env: BUILD=stack ARGS="--resolver lts-3" + # compiler: ": #stack 7.10.2 osx" + # os: osx + + # - env: BUILD=stack ARGS="--resolver lts-6" + # compiler: ": #stack 7.10.3 osx" + # os: osx + + - env: BUILD=stack ARGS="--resolver lts-7" + compiler: ": #stack 8.0.1 osx" + os: osx + + - env: BUILD=stack ARGS="--resolver lts-11" + compiler: ": #stack 8.2.2 osx" os: osx - - env: BUILD=stack ARGS="--resolver lts-6" - compiler: ": #stack 7.10.3 osx" + - env: BUILD=stack ARGS="--resolver lts-12" + compiler: ": #stack 8.4.4 osx" + os: osx + + - env: BUILD=stack ARGS="--resolver lts-13" + compiler: ": #stack 8.6.5 osx" os: osx - env: BUILD=stack ARGS="--resolver nightly" From 04ad7c9040434b27db19800895ad173ba62d66d8 Mon Sep 17 00:00:00 2001 From: Scott Sedgwick Date: Tue, 23 Jul 2019 22:02:58 +1000 Subject: [PATCH 10/11] Commented out the stack 8.0.1 build for osx too - it has the same dependency problem --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 01908cf..43bacf4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,7 @@ matrix: include: # We grab the appropriate GHC and cabal-install versions from hvr's PPA. See: # https://github.com/hvr/multi-ghc-travis - + #- env: BUILD=cabal GHCVER=7.0.4 CABALVER=1.16 HAPPYVER=1.19.5 ALEXVER=3.1.7 # compiler: ": #GHC 7.0.4" # addons: {apt: {packages: [cabal-install-1.16,ghc-7.0.4,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}} @@ -125,9 +125,9 @@ matrix: # compiler: ": #stack 7.10.3 osx" # os: osx - - env: BUILD=stack ARGS="--resolver lts-7" - compiler: ": #stack 8.0.1 osx" - os: osx + # - env: BUILD=stack ARGS="--resolver lts-7" + # compiler: ": #stack 8.0.1 osx" + # os: osx - env: BUILD=stack ARGS="--resolver lts-11" compiler: ": #stack 8.2.2 osx" From b5c98debb35c078b437d1bad645469095b9b6470 Mon Sep 17 00:00:00 2001 From: Scott Sedgwick Date: Wed, 31 Jul 2019 15:25:28 +1000 Subject: [PATCH 11/11] Brought library up to date with 8.6 compiler. Turned on all warnings and fixed them. --- aws-ec2.cabal | 149 ++++++++++++------ src/Aws/Canonical.hs | 1 + src/Aws/CloudWatch/Commands/PutMetricData.hs | 1 - src/Aws/CloudWatch/Types.hs | 1 + src/Aws/Ec2/Commands/AttachInternetGateway.hs | 2 +- src/Aws/Ec2/Commands/AttachVolume.hs | 1 - .../Commands/AuthorizeSecurityGroupIngress.hs | 1 - src/Aws/Ec2/Commands/CreateTags.hs | 2 +- src/Aws/Ec2/Commands/CreateVolume.hs | 1 - src/Aws/Ec2/Commands/DescribeInstances.hs | 2 +- .../Ec2/Commands/DescribeSecurityGroups.hs | 3 +- src/Aws/Ec2/Commands/GetConsoleOutput.hs | 2 + .../Commands/RevokeSecurityGroupIngress.hs | 1 - src/Aws/Ec2/Commands/RunInstances.hs | 4 +- src/Aws/Ec2/Commands/StartInstances.hs | 1 - src/Aws/Ec2/Commands/StopInstances.hs | 1 - src/Aws/Ec2/Commands/TerminateInstances.hs | 1 - src/Aws/Ec2/Core.hs | 5 +- src/Aws/Ec2/TH.hs | 5 + src/Aws/Ec2/Types.hs | 7 +- .../DeregisterInstancesFromLoadBalancer.hs | 1 - .../Commands/ModifyLoadBalancerAttributes.hs | 9 +- .../RegisterInstancesWithLoadBalancer.hs | 1 - src/Aws/Elb/Core.hs | 8 +- src/Aws/Elb/Types.hs | 4 - src/Aws/Query.hs | 7 +- src/Aws/Query/TH.hs | 2 - src/Aws/Query/Types.hs | 17 +- src/Aws/TH.hs | 4 +- 29 files changed, 150 insertions(+), 94 deletions(-) diff --git a/aws-ec2.cabal b/aws-ec2.cabal index 3db4e50..9b74885 100644 --- a/aws-ec2.cabal +++ b/aws-ec2.cabal @@ -1,5 +1,5 @@ name: aws-ec2 -version: 0.3.7 +version: 0.3.8 cabal-version: >=1.10 build-type: Simple license: BSD3 @@ -13,14 +13,14 @@ description: category: Network, Web, AWS, Cloud, Distributed Computing author: Vladimir Kirillov; MemCachier, Inc -source-repository this - type: git - location: https://github.com/memcachier/aws-ec2.git - tag: 0.3.7 +-- source-repository this +-- type: git +-- location: https://github.com/memcachier/aws-ec2.git +-- tag: 0.3.8 -source-repository head - type: git - location: https://github.com/memcachier/aws-ec2.git +-- source-repository head +-- type: git +-- location: https://github.com/memcachier/aws-ec2.git library exposed-modules: @@ -88,43 +88,79 @@ library Aws.Elb.Commands.SetLoadBalancerPoliciesOfListener Aws.Elb.Commands.ConfigureHealthCheck build-depends: - base >=4.7 && <5, - template-haskell >=2.11 && <2.15, - containers >=0.5.5.1 && <0.7, - mtl >=2.1.3.1 && <2.3, - text >=1.2.0.6 && <1.3, - bytestring >=0.10.4.0 && <0.11, - base16-bytestring >=0.1.1.6 && <0.2, - base64-bytestring >=1.0.0.1 && <1.1, - blaze-builder >=0.4.0.1 && <0.5, - time >=1.4.2 && <1.9, - aeson >=0.8.0.2 && <1.5, - unordered-containers >=0.2.5.1 && <0.3, - vector >=0.10.12.3 && <0.13, - scientific >=0.3.3.8 && <0.4, - exceptions >=0.8.0.2 && <0.11, - resourcet >=1.1.6 && <1.3, - byteable >=0.1.1 && <0.2, - cryptohash >=0.11.6 && <0.12, - http-types >=0.8.6 && <0.13, - http-conduit >=2.1.7.2 && <2.4, - conduit-extra >=1.1.9.1 && <1.4, - blaze-markup >=0.7.0.2 && <0.9, - xml-conduit >=1.2.6 && <1.9, - iproute >=1.3.2 && <1.8, - aws >=0.9.4 && <0.22 + aeson + , aws + , base + , base16-bytestring + , base64-bytestring + , blaze-builder + , blaze-markup + , byteable + , bytestring + , conduit-extra + , containers + , cryptohash + , exceptions + , http-conduit + , http-types + , iproute + , mtl + , resourcet + , scientific + , template-haskell + , text + , time + , unordered-containers + , vector + , xml-conduit + + -- aeson >=0.8.0.2 && <1.5, + -- aws >=0.9.4 && <0.22, + -- base >=4.7 && <5, + -- base16-bytestring >=0.1.1.6 && <0.2, + -- base64-bytestring >=1.0.0.1 && <1.1, + -- blaze-builder >=0.4.0.1 && <0.5, + -- blaze-markup >=0.7.0.2 && <0.9, + -- byteable >=0.1.1 && <0.2, + -- bytestring >=0.10.4.0 && <0.11, + -- conduit-extra >=1.1.9.1 && <1.4, + -- containers >=0.5.5.1 && <0.7, + -- cryptohash >=0.11.6 && <0.12, + -- exceptions >=0.8.0.2 && <0.11, + -- http-conduit >=2.1.7.2 && <2.4, + -- http-types >=0.8.6 && <0.13, + -- iproute >=1.3.2 && <1.8, + -- mtl >=2.1.3.1 && <2.3, + -- resourcet >=1.1.6 && <1.3, + -- scientific >=0.3.3.8 && <0.4, + -- template-haskell >=2.11 && <2.15, + -- text >=1.2.0.6 && <1.3, + -- time >=1.4.2 && <1.9, + -- unordered-containers >=0.2.5.1 && <0.3, + -- vector >=0.10.12.3 && <0.13, + -- xml-conduit >=1.2.6 && <1.9 + default-language: Haskell2010 hs-source-dirs: src + ghc-options: -Wall -fno-warn-orphans executable put-metric main-is: put-metric.hs build-depends: - base >=4.7.0.2 && <5, - bytestring >=0.10.4.0 && <0.11, - text >=1.2.0.6 && <1.3, - optparse-applicative >=0.11.0.2 && <0.15, - aws >=0.9.4 && <0.22, - aws-ec2 >=0.3.4 && <0.4 + aws + , aws-ec2 + , base + , bytestring + , optparse-applicative < 0.15 + , text + + -- aws >=0.9.4 && <0.22, + -- aws-ec2 >=0.3.8 && <0.4, + -- base >=4.7 && <5, + -- bytestring >=0.10.4.0 && <0.11, + -- optparse-applicative >=0.11.0.2 && <0.15, + -- text >=1.2.0.6 && <1.3 + default-language: Haskell2010 hs-source-dirs: cmd ghc-options: -static @@ -132,17 +168,30 @@ executable put-metric executable run-inst main-is: run-inst.hs build-depends: - base >=4.7.0.2 && <5, - bytestring >=0.10.4.0 && <0.11, - text >=1.2.0.6 && <1.3, - optparse-applicative >=0.11.0.2 && <0.15, - aws >=0.9.4 && <0.22, - aws-ec2 >=0.3.4 && <0.4, - yaml >=0.8.12 && <0.12, - vector >=0.10.12.3 && <0.13, - containers >=0.5.5.1 && <0.7, - unordered-containers >=0.2.5.1 && <0.3, - aeson >=0.8.0.2 && <1.5 + aeson + , aws + , aws-ec2 + , base + , bytestring + , containers + , optparse-applicative < 0.15 + , text + , unordered-containers + , vector + , yaml + + -- aeson >=0.8.0.2 && <1.5, + -- aws >=0.9.4 && <0.22, + -- aws-ec2 >=0.3.8 && <0.4, + -- base >=4.7 && <5, + -- bytestring >=0.10.4.0 && <0.11, + -- containers >=0.5.5.1 && <0.7, + -- optparse-applicative >=0.11.0.2 && <0.15, + -- text >=1.2.0.6 && <1.3, + -- unordered-containers >=0.2.5.1 && <0.3, + -- vector >=0.10.12.3 && <0.13, + -- yaml >=0.8.12 && <0.12 + default-language: Haskell2010 hs-source-dirs: cmd ghc-options: -static diff --git a/src/Aws/Canonical.hs b/src/Aws/Canonical.hs index 2e86a4f..1ece743 100644 --- a/src/Aws/Canonical.hs +++ b/src/Aws/Canonical.hs @@ -13,4 +13,5 @@ canonicalSigData = do , signatureCredentials = Credentials "" "" emptyRef Nothing } +baseTime :: UTCTime baseTime = UTCTime (toEnum 0) $ secondsToDiffTime 0 diff --git a/src/Aws/CloudWatch/Commands/PutMetricData.hs b/src/Aws/CloudWatch/Commands/PutMetricData.hs index 3433cb8..95788cb 100644 --- a/src/Aws/CloudWatch/Commands/PutMetricData.hs +++ b/src/Aws/CloudWatch/Commands/PutMetricData.hs @@ -10,7 +10,6 @@ module Aws.CloudWatch.Commands.PutMetricData where import Data.Text (Text) -import Data.Monoid import Data.Time.Clock (UTCTime) import Aws.CloudWatch.Core import Aws.CloudWatch.Types diff --git a/src/Aws/CloudWatch/Types.hs b/src/Aws/CloudWatch/Types.hs index 112415f..64b88de 100644 --- a/src/Aws/CloudWatch/Types.hs +++ b/src/Aws/CloudWatch/Types.hs @@ -1,3 +1,4 @@ +{-# OPTIONS -Wno-name-shadowing #-} {-# LANGUAGE TemplateHaskell #-} module Aws.CloudWatch.Types where diff --git a/src/Aws/Ec2/Commands/AttachInternetGateway.hs b/src/Aws/Ec2/Commands/AttachInternetGateway.hs index 00a7614..2e0bf48 100644 --- a/src/Aws/Ec2/Commands/AttachInternetGateway.hs +++ b/src/Aws/Ec2/Commands/AttachInternetGateway.hs @@ -8,7 +8,7 @@ module Aws.Ec2.Commands.AttachInternetGateway where -import Data.Text (Text, pack, toLower) +import Data.Text (Text) import Aws.Ec2.TH data AttachInternetGateway = AttachInternetGateway diff --git a/src/Aws/Ec2/Commands/AttachVolume.hs b/src/Aws/Ec2/Commands/AttachVolume.hs index 52c3881..dd0155e 100644 --- a/src/Aws/Ec2/Commands/AttachVolume.hs +++ b/src/Aws/Ec2/Commands/AttachVolume.hs @@ -9,7 +9,6 @@ module Aws.Ec2.Commands.AttachVolume where import Data.Text (Text) -import Data.Monoid import Aws.Ec2.TH data AttachVolume = AttachVolume diff --git a/src/Aws/Ec2/Commands/AuthorizeSecurityGroupIngress.hs b/src/Aws/Ec2/Commands/AuthorizeSecurityGroupIngress.hs index 1744ea5..26e68e1 100644 --- a/src/Aws/Ec2/Commands/AuthorizeSecurityGroupIngress.hs +++ b/src/Aws/Ec2/Commands/AuthorizeSecurityGroupIngress.hs @@ -10,7 +10,6 @@ module Aws.Ec2.Commands.AuthorizeSecurityGroupIngress where import Data.Text (Text) import Aws.Ec2.TH -import Aws.Ec2.Types data AuthorizeSecurityGroupIngress = AuthorizeSecurityGroupIngress { asi_groupId :: Text diff --git a/src/Aws/Ec2/Commands/CreateTags.hs b/src/Aws/Ec2/Commands/CreateTags.hs index ab82a60..72955e1 100644 --- a/src/Aws/Ec2/Commands/CreateTags.hs +++ b/src/Aws/Ec2/Commands/CreateTags.hs @@ -8,7 +8,7 @@ module Aws.Ec2.Commands.CreateTags where -import Data.Aeson (Value (..), FromJSON, parseJSON) +import Data.Aeson (FromJSON, parseJSON) import Aws.Ec2.TH import qualified Network.HTTP.Types as HTTP diff --git a/src/Aws/Ec2/Commands/CreateVolume.hs b/src/Aws/Ec2/Commands/CreateVolume.hs index 90fd154..8a12604 100644 --- a/src/Aws/Ec2/Commands/CreateVolume.hs +++ b/src/Aws/Ec2/Commands/CreateVolume.hs @@ -9,7 +9,6 @@ module Aws.Ec2.Commands.CreateVolume where import Data.Text (Text) -import Data.Monoid import Aws.Ec2.TH data CreateVolume = CreateVolume diff --git a/src/Aws/Ec2/Commands/DescribeInstances.hs b/src/Aws/Ec2/Commands/DescribeInstances.hs index 658f970..467c20f 100644 --- a/src/Aws/Ec2/Commands/DescribeInstances.hs +++ b/src/Aws/Ec2/Commands/DescribeInstances.hs @@ -8,7 +8,7 @@ module Aws.Ec2.Commands.DescribeInstances where -import Data.Aeson (Value (..), FromJSON, parseJSON) +import Data.Aeson (FromJSON, parseJSON) import Aws.Ec2.TH diff --git a/src/Aws/Ec2/Commands/DescribeSecurityGroups.hs b/src/Aws/Ec2/Commands/DescribeSecurityGroups.hs index b05c09d..30e27af 100644 --- a/src/Aws/Ec2/Commands/DescribeSecurityGroups.hs +++ b/src/Aws/Ec2/Commands/DescribeSecurityGroups.hs @@ -7,8 +7,7 @@ module Aws.Ec2.Commands.DescribeSecurityGroups where -import Data.Aeson (Value (..), FromJSON, (.:), parseJSON) -import Data.Aeson.Types (typeMismatch) +import Data.Aeson (FromJSON, parseJSON) import Aws.Ec2.TH diff --git a/src/Aws/Ec2/Commands/GetConsoleOutput.hs b/src/Aws/Ec2/Commands/GetConsoleOutput.hs index 8ffa3a9..5e2b8f6 100644 --- a/src/Aws/Ec2/Commands/GetConsoleOutput.hs +++ b/src/Aws/Ec2/Commands/GetConsoleOutput.hs @@ -9,6 +9,7 @@ module Aws.Ec2.Commands.GetConsoleOutput where import Data.Aeson (Value(..), FromJSON, (.:), parseJSON) +import Data.Aeson.Types (prependFailure, typeMismatch) import Aws.Ec2.TH import GHC.Generics @@ -29,6 +30,7 @@ instance FromJSON ConsoleOutput where v .: "instanceId" <*> v .: "timestamp" <*> v .: "output" + parseJSON invalid = prependFailure "parsing Coord failed, " (typeMismatch "Object" invalid) instance SignQuery GetConsoleOutput where type ServiceConfiguration GetConsoleOutput = EC2Configuration diff --git a/src/Aws/Ec2/Commands/RevokeSecurityGroupIngress.hs b/src/Aws/Ec2/Commands/RevokeSecurityGroupIngress.hs index 37d89f5..21f6042 100644 --- a/src/Aws/Ec2/Commands/RevokeSecurityGroupIngress.hs +++ b/src/Aws/Ec2/Commands/RevokeSecurityGroupIngress.hs @@ -10,7 +10,6 @@ module Aws.Ec2.Commands.RevokeSecurityGroupIngress where import Data.Text (Text) import Aws.Ec2.TH -import Aws.Ec2.Types data RevokeSecurityGroupIngress = RevokeSecurityGroupIngress { rsi_groupId :: Text diff --git a/src/Aws/Ec2/Commands/RunInstances.hs b/src/Aws/Ec2/Commands/RunInstances.hs index 588e346..0d50e2e 100644 --- a/src/Aws/Ec2/Commands/RunInstances.hs +++ b/src/Aws/Ec2/Commands/RunInstances.hs @@ -12,10 +12,8 @@ module Aws.Ec2.Commands.RunInstances where import Control.Applicative ((<$>)) import Data.Text (Text) import Data.Text.Encoding (encodeUtf8, decodeUtf8) -import Data.ByteString.Char8 (pack, ByteString) import qualified Data.ByteString.Base64 as Base64 import qualified Network.HTTP.Types as HTTP -import Data.Monoid import Aws.Ec2.TH -- http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-RunInstances.html @@ -311,7 +309,7 @@ instance SignQuery RunInstances where +++ optional "InstanceInitiatedShutdownBehavior" run_instanceInitiatedShutdownBehavior qShow +++ case run_subnetId of Nothing -> enumerate "SecurityGroupId" run_securityGroupIds qArg - Just subnetId -> [ ("NetworkInterface.0.DeviceIndex", qShow 0) + Just subnetId -> [ ("NetworkInterface.0.DeviceIndex", qShow (0 :: Integer)) , ("NetworkInterface.0.SubnetId", qArg subnetId) , ("NetworkInterface.0.AssociatePublicIpAddress", qShow run_associatePublicIpAddress) ] +++ enumerate "NetworkInterface.0.SecurityGroupId" run_securityGroupIds qArg diff --git a/src/Aws/Ec2/Commands/StartInstances.hs b/src/Aws/Ec2/Commands/StartInstances.hs index e2dfebe..060fc58 100644 --- a/src/Aws/Ec2/Commands/StartInstances.hs +++ b/src/Aws/Ec2/Commands/StartInstances.hs @@ -12,7 +12,6 @@ module Aws.Ec2.Commands.StartInstances where import Data.Text () import Data.ByteString.Char8 (pack) import qualified Network.HTTP.Types as HTTP -import Data.Monoid import Aws.Ec2.TH -- http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-StartInstances.html diff --git a/src/Aws/Ec2/Commands/StopInstances.hs b/src/Aws/Ec2/Commands/StopInstances.hs index 315e527..1b27fc5 100644 --- a/src/Aws/Ec2/Commands/StopInstances.hs +++ b/src/Aws/Ec2/Commands/StopInstances.hs @@ -12,7 +12,6 @@ module Aws.Ec2.Commands.StopInstances where import Data.Text () import Data.ByteString.Char8 (pack) import qualified Network.HTTP.Types as HTTP -import Data.Monoid import Aws.Ec2.TH -- http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-StopInstances.html diff --git a/src/Aws/Ec2/Commands/TerminateInstances.hs b/src/Aws/Ec2/Commands/TerminateInstances.hs index 5a7e7cc..5f2556c 100644 --- a/src/Aws/Ec2/Commands/TerminateInstances.hs +++ b/src/Aws/Ec2/Commands/TerminateInstances.hs @@ -14,7 +14,6 @@ import Data.Aeson.Types (typeMismatch) import Data.Text (Text) import Data.ByteString.Char8 (pack) import qualified Network.HTTP.Types as HTTP -import Data.Monoid import Aws.Ec2.TH -- http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-TerminateInstances.html diff --git a/src/Aws/Ec2/Core.hs b/src/Aws/Ec2/Core.hs index 8c5a053..deb79da 100644 --- a/src/Aws/Ec2/Core.hs +++ b/src/Aws/Ec2/Core.hs @@ -15,12 +15,14 @@ module Aws.Ec2.Core ( import qualified Data.ByteString as B -import qualified Network.HTTP.Conduit as HTTP import qualified Network.HTTP.Types as HTTP import Aws.Core import Aws.Query +import GHC.IORef (IORef) +import Text.XML.Cursor (Cursor) + type EC2Metadata = QueryMetadata type EC2Configuration = QueryAPIConfiguration @@ -35,4 +37,5 @@ ec2SignQuery query QueryAPIConfiguration{..} sd = querySignQuery query qd sd , qdService = "ec2" } +ec2ResponseConsumer :: (Cursor -> Response QueryMetadata a) -> IORef QueryMetadata -> HTTPResponseConsumer a ec2ResponseConsumer = queryResponseConsumer diff --git a/src/Aws/Ec2/TH.hs b/src/Aws/Ec2/TH.hs index 65fce79..30e9f69 100644 --- a/src/Aws/Ec2/TH.hs +++ b/src/Aws/Ec2/TH.hs @@ -29,6 +29,11 @@ import Aws.Ec2.Types import Aws.Query import Aws.Query.TH +import Language.Haskell.TH.Lib (DecsQ) +import Language.Haskell.TH.Syntax (Name) + +ec2ValueTransactionDef :: Name -> Name -> String -> String -> DecsQ ec2ValueTransactionDef ty cons tag filterKey = queryValueTransactionDef ty cons tag 'ec2SignQuery 'defVersion "item" filterKey +ec2ValueTransaction :: Name -> String -> DecsQ ec2ValueTransaction = queryValueTransaction diff --git a/src/Aws/Ec2/Types.hs b/src/Aws/Ec2/Types.hs index bb11d97..0221814 100644 --- a/src/Aws/Ec2/Types.hs +++ b/src/Aws/Ec2/Types.hs @@ -22,22 +22,18 @@ -- response type and use that. module Aws.Ec2.Types where -import Control.Applicative import Data.Aeson (Value (..), FromJSON, (.:), (.:?), (.!=), parseJSON) import Data.Aeson.Types (typeMismatch) +import Data.ByteString (ByteString) import Data.Char (toUpper, toLower) import Data.IP (IPv4) -import Data.Maybe (fromMaybe) import Data.Text (Text) import qualified Data.Text as T import Data.Time.Clock (UTCTime) -import Data.Monoid hiding (All) -import Data.ByteString.Char8 (ByteString, pack) import Network.HTTP.Types as HTTP import Aws.Query -import Aws.Ec2.Core -- EC2 Data Types @@ -59,6 +55,7 @@ data EbsBlockDevice = EbsBlockDevice , ebd_encrypted :: Bool } deriving (Show) +queryEbsBlockDevice :: EbsBlockDevice -> [(ByteString, Maybe ByteString)] queryEbsBlockDevice EbsBlockDevice{..} = [ ("VolumeType", qShow ebd_volumeType) -- , ("VolumeSize", qShow ebd_volumeSize) , ("Size", qShow ebd_volumeSize) -- RunInstances: VolumeSize diff --git a/src/Aws/Elb/Commands/DeregisterInstancesFromLoadBalancer.hs b/src/Aws/Elb/Commands/DeregisterInstancesFromLoadBalancer.hs index 3376fd1..e3f6427 100644 --- a/src/Aws/Elb/Commands/DeregisterInstancesFromLoadBalancer.hs +++ b/src/Aws/Elb/Commands/DeregisterInstancesFromLoadBalancer.hs @@ -8,7 +8,6 @@ module Aws.Elb.Commands.DeregisterInstancesFromLoadBalancer where -import qualified Network.HTTP.Types as HTTP import Aws.Elb.TH import Aws.Elb.Types diff --git a/src/Aws/Elb/Commands/ModifyLoadBalancerAttributes.hs b/src/Aws/Elb/Commands/ModifyLoadBalancerAttributes.hs index 6c48f0a..d5493ae 100644 --- a/src/Aws/Elb/Commands/ModifyLoadBalancerAttributes.hs +++ b/src/Aws/Elb/Commands/ModifyLoadBalancerAttributes.hs @@ -9,6 +9,8 @@ module Aws.Elb.Commands.ModifyLoadBalancerAttributes where import Aws.Elb.TH +import Data.String (IsString) +import Data.ByteString (ByteString) type S3BucketName = Text type S3BucketPrefix = Text @@ -24,6 +26,7 @@ data ModifyLoadBalancerAttributes = ModifyLoadBalancerAttributes , mlba_attributes :: [LoadBalancerAttribute] } deriving (Show) +attributeQuery :: IsString a => LoadBalancerAttribute -> [(a, Maybe ByteString)] attributeQuery (AccessLog False _ _ _) = [ ("LoadBalancerAttributes.AccessLog.Enabled", qBool False) ] @@ -32,9 +35,9 @@ attributeQuery (AccessLog enabled interval bucket prefix) , ("LoadBalancerAttributes.AccessLog.EmitInterval", int interval) , ("LoadBalancerAttributes.AccessLog.S3BucketName", qArg bucket) , ("LoadBalancerAttributes.AccessLog.S3BucketPrefix", qArg prefix) - ] where int Min5 = qShow 5 - int Min60 = qShow 60 -attributeQuery (ConnectionDraining False timeout) + ] where int Min5 = qShow (5 :: Integer) + int Min60 = qShow (60 :: Integer) +attributeQuery (ConnectionDraining False _) = [ ("LoadBalancerAttributes.ConnectionDraining.Enabled", qBool False) ] attributeQuery (ConnectionDraining enabled timeout) diff --git a/src/Aws/Elb/Commands/RegisterInstancesWithLoadBalancer.hs b/src/Aws/Elb/Commands/RegisterInstancesWithLoadBalancer.hs index c772263..c138e1f 100644 --- a/src/Aws/Elb/Commands/RegisterInstancesWithLoadBalancer.hs +++ b/src/Aws/Elb/Commands/RegisterInstancesWithLoadBalancer.hs @@ -8,7 +8,6 @@ module Aws.Elb.Commands.RegisterInstancesWithLoadBalancer where -import qualified Network.HTTP.Types as HTTP import Aws.Elb.TH import Aws.Elb.Types diff --git a/src/Aws/Elb/Core.hs b/src/Aws/Elb/Core.hs index 682c6a5..8a75c85 100644 --- a/src/Aws/Elb/Core.hs +++ b/src/Aws/Elb/Core.hs @@ -13,10 +13,9 @@ module Aws.Elb.Core ( ) where import qualified Data.ByteString as B - -import qualified Network.HTTP.Conduit as HTTP import qualified Network.HTTP.Types as HTTP - +import qualified Text.XML.Cursor as Cu +import qualified GHC.IORef as IOR import Aws.Core import Aws.Query @@ -33,4 +32,7 @@ elbSignQuery query QueryAPIConfiguration{..} sd = querySignQuery query qd sd type ELBMetadata = QueryMetadata +elbResponseConsumer :: (Cu.Cursor -> Response QueryMetadata a) + -> IOR.IORef QueryMetadata + -> HTTPResponseConsumer a elbResponseConsumer = queryResponseConsumer diff --git a/src/Aws/Elb/Types.hs b/src/Aws/Elb/Types.hs index b02f1de..5942fee 100644 --- a/src/Aws/Elb/Types.hs +++ b/src/Aws/Elb/Types.hs @@ -8,14 +8,10 @@ module Aws.Elb.Types where import Data.Text (Text) -import Data.Time.Clock (UTCTime) -import Data.Monoid -import Data.ByteString.Char8 (ByteString, pack) import Network.HTTP.Types as HTTP import Aws.Query -import Aws.Elb.Core enumerateInstanceIds :: [Text] -> HTTP.Query enumerateInstanceIds = enumerateLists "Instances.member." . fmap unroll diff --git a/src/Aws/Query.hs b/src/Aws/Query.hs index b48bee1..0bcf9b2 100644 --- a/src/Aws/Query.hs +++ b/src/Aws/Query.hs @@ -42,13 +42,11 @@ import Data.ByteString.Char8 (ByteString) import qualified Data.ByteString as B import qualified Data.ByteString.Char8 as B8 import qualified Data.ByteString.Base16 as Base16 -import qualified Data.Text as T import Data.Text (Text) import Data.Text.Encoding (encodeUtf8) import Data.Aeson (FromJSON, Result (..), fromJSON) import Data.List -import Data.Monoid import Data.Maybe import Data.IORef import Data.Typeable (Typeable) @@ -256,8 +254,9 @@ queryResponseConsumer inner md resp = xmlCursorConsumer parse md resp optional :: ByteString -> Maybe a -> (a -> Maybe ByteString) -> HTTP.Query optional k (Just x) f = [(k, f x)] -optional k Nothing f = [] +optional _ Nothing _ = [] +optionalA :: ByteString -> Maybe Text -> HTTP.Query optionalA k v = optional k v qArg enumerate :: String -> [a] -> (a -> Maybe ByteString) -> HTTP.Query @@ -266,4 +265,4 @@ enumerate k xs f = [(B8.pack $ mconcat [k, ".", show n], f x) | (n, x) <- zip ([ enumerateLists :: ByteString -> [HTTP.Query] -> HTTP.Query enumerateLists key xs = mconcat [prefix pairs $ mconcat [key, B8.pack $ show n, "."] | (n, pairs) <- zip ([1..] :: [Int]) xs] where - prefix xs p = [(mconcat [p, k], v) | (k, v) <- xs] + prefix xs' p = [(mconcat [p, k], v) | (k, v) <- xs'] diff --git a/src/Aws/Query/TH.hs b/src/Aws/Query/TH.hs index a8edeba..1540642 100644 --- a/src/Aws/Query/TH.hs +++ b/src/Aws/Query/TH.hs @@ -19,8 +19,6 @@ module Aws.Query.TH ( ) where import Language.Haskell.TH -import Language.Haskell.TH.Lib -import Language.Haskell.TH.Syntax import Data.Text (Text) import Data.Aeson.Types (FromJSON(..)) diff --git a/src/Aws/Query/Types.hs b/src/Aws/Query/Types.hs index 7ccf837..68b9b51 100644 --- a/src/Aws/Query/Types.hs +++ b/src/Aws/Query/Types.hs @@ -38,6 +38,7 @@ instance AsMemoryResponse Value where -- import Text.Show.Pretty (ppShow) -- -- traceArg a = ppShow a `trace` a +traceArg :: a -> a traceArg = id castValue :: FromJSON a => Value -> Maybe a @@ -47,10 +48,11 @@ toValue :: XMLValueOptions -> Node -> Value toValue = value value :: XMLValueOptions -> Node -> Value -value options (NodeElement e@Element{..}) = values options elementNodes -value options (NodeContent c) = String c -value options _ = Null +value options (NodeElement e) = values options (elementNodes e) +value _ (NodeContent c) = String c +value _ _ = Null +values :: XMLValueOptions -> [Node] -> Value values options elementNodes = uncurry (elementValues options) $ traceArg $ (elementKind options elementNodes, elementNodes) data ElementKind = ObjectLike @@ -58,6 +60,7 @@ data ElementKind = ObjectLike | Other deriving (Show) +elementKind :: XMLValueOptions -> [Node] -> ElementKind elementKind XMLValueOptions{..} nodes | isXMLArray = ArrayLike | isObject = ObjectLike @@ -81,8 +84,16 @@ elementValues options Other ns = arrayOrValue $ fmap (value options) ns arrayOrValue [] = Null arrayOrValue a = array a +forceElementName :: Node -> Text forceElementName = nameLocalName . elementName . unElement + +unElement :: Node -> Element unElement (NodeElement e) = e +unElement (NodeInstruction _) = error "unElement required NodeElement but received NodeInstruction" +unElement (NodeContent _) = error "unElement required NodeElement but received NodeContent" +unElement (NodeComment _) = error "unElement required NodeElement but received NodeComment" + +array :: [Value] -> Value array = Array . V.fromList onlyElements :: [Node] -> [Node] diff --git a/src/Aws/TH.hs b/src/Aws/TH.hs index ae0b647..687a759 100644 --- a/src/Aws/TH.hs +++ b/src/Aws/TH.hs @@ -1,3 +1,4 @@ +{-# OPTIONS -Wno-name-shadowing #-} {-# LANGUAGE TemplateHaskell , CPP #-} @@ -41,9 +42,10 @@ derivePatchedShowRead name patch = do ]) []] ] +patchPer :: [Char] -> [Char] patchPer s = go s False where - go [] started = [] + go [] _ = [] go ('P':'e':'r':xs) started@False = 'P' : 'e' : 'r' : go xs started go ('P':'e':'r':xs) started@True = '/' : go xs started go (x:xs) _ = x : go xs True