stackctl 1.4.3.0 → 1.4.4.0
raw patch · 4 files changed
+19/−6 lines, 4 files
Files
- CHANGELOG.md +5/−1
- src/Stackctl/AWS/CloudFormation.hs +4/−2
- src/Stackctl/AWS/Core.hs +9/−2
- stackctl.cabal +1/−1
CHANGELOG.md view
@@ -1,4 +1,8 @@-## [_Unreleased_](https://github.com/freckle/stackctl/compare/v1.4.3.0...main)+## [_Unreleased_](https://github.com/freckle/stackctl/compare/v1.4.4.0...main)++## [v1.4.4.0](https://github.com/freckle/stackctl/compare/v1.4.3.0...v1.4.4.0)++- Add `awsSilently` ## [v1.4.3.0](https://github.com/freckle/stackctl/compare/v1.4.2.2...v1.4.3.0)
src/Stackctl/AWS/CloudFormation.hs view
@@ -185,8 +185,10 @@ awsCloudFormationDescribeStackMaybe stackName = -- AWS gives us a 400 if the stackName doesn't exist, rather than simply -- returning an empty list, so we need to do this through exceptions- handling_ _ValidationError (pure Nothing) $ do- Just <$> awsCloudFormationDescribeStack stackName+ handling_ _ValidationError (pure Nothing)+ $ awsSilently -- don't log said 400+ $ Just+ <$> awsCloudFormationDescribeStack stackName awsCloudFormationDescribeStackOutputs :: (MonadResource m, MonadReader env m, HasAwsEnv env)
src/Stackctl/AWS/Core.hs view
@@ -12,6 +12,7 @@ -- * Modifiers on 'AwsEnv' , awsWithin , awsTimeout+ , awsSilently -- * 'Amazonka' extensions , AccountId (..)@@ -39,6 +40,7 @@ import Control.Monad.Logger (defaultLoc, toLogStr) import Control.Monad.Trans.Resource (MonadResource) import Stackctl.AWS.Orphans ()+import UnliftIO.Exception.Lens (handling) newtype AwsEnv = AwsEnv { unAwsEnv :: Env@@ -172,8 +174,13 @@ awsWithin r = local $ awsEnvL . unL . env_region .~ r awsTimeout :: (MonadReader env m, HasAwsEnv env) => Seconds -> m a -> m a-awsTimeout t = local $ over (awsEnvL . unL) (globalTimeout t)+awsTimeout t = local $ awsEnvL . unL %~ globalTimeout t +awsSilently :: (MonadReader env m, HasAwsEnv env) => m a -> m a+awsSilently = local $ awsEnvL . unL . env_logger .~ noop+ where+ noop _level _msg = pure ()+ newtype AccountId = AccountId { unAccountId :: Text }@@ -185,7 +192,7 @@ -- makes things more readable and easier to debug. handlingServiceError :: (MonadUnliftIO m, MonadLogger m) => m a -> m a handlingServiceError =- handleJust @_ @SomeException (^? _ServiceError) $ \e -> do+ handling _ServiceError $ \e -> do logError $ "Exiting due to AWS Service error" :# [ "code" .= toText (e ^. serviceError_code)
stackctl.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.18 name: stackctl-version: 1.4.3.0+version: 1.4.4.0 license: MIT license-file: LICENSE copyright: 2022 Renaissance Learning Inc