{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.SecurityHub.Types.AwsEcrRepositoryImageScanningConfigurationDetails
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SecurityHub.Types.AwsEcrRepositoryImageScanningConfigurationDetails where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The image scanning configuration for a repository.
--
-- /See:/ 'newAwsEcrRepositoryImageScanningConfigurationDetails' smart constructor.
data AwsEcrRepositoryImageScanningConfigurationDetails = AwsEcrRepositoryImageScanningConfigurationDetails'
  { -- | Whether to scan images after they are pushed to a repository.
    AwsEcrRepositoryImageScanningConfigurationDetails -> Maybe Bool
scanOnPush :: Prelude.Maybe Prelude.Bool
  }
  deriving (AwsEcrRepositoryImageScanningConfigurationDetails
-> AwsEcrRepositoryImageScanningConfigurationDetails -> Bool
(AwsEcrRepositoryImageScanningConfigurationDetails
 -> AwsEcrRepositoryImageScanningConfigurationDetails -> Bool)
-> (AwsEcrRepositoryImageScanningConfigurationDetails
    -> AwsEcrRepositoryImageScanningConfigurationDetails -> Bool)
-> Eq AwsEcrRepositoryImageScanningConfigurationDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsEcrRepositoryImageScanningConfigurationDetails
-> AwsEcrRepositoryImageScanningConfigurationDetails -> Bool
$c/= :: AwsEcrRepositoryImageScanningConfigurationDetails
-> AwsEcrRepositoryImageScanningConfigurationDetails -> Bool
== :: AwsEcrRepositoryImageScanningConfigurationDetails
-> AwsEcrRepositoryImageScanningConfigurationDetails -> Bool
$c== :: AwsEcrRepositoryImageScanningConfigurationDetails
-> AwsEcrRepositoryImageScanningConfigurationDetails -> Bool
Prelude.Eq, ReadPrec [AwsEcrRepositoryImageScanningConfigurationDetails]
ReadPrec AwsEcrRepositoryImageScanningConfigurationDetails
Int -> ReadS AwsEcrRepositoryImageScanningConfigurationDetails
ReadS [AwsEcrRepositoryImageScanningConfigurationDetails]
(Int -> ReadS AwsEcrRepositoryImageScanningConfigurationDetails)
-> ReadS [AwsEcrRepositoryImageScanningConfigurationDetails]
-> ReadPrec AwsEcrRepositoryImageScanningConfigurationDetails
-> ReadPrec [AwsEcrRepositoryImageScanningConfigurationDetails]
-> Read AwsEcrRepositoryImageScanningConfigurationDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsEcrRepositoryImageScanningConfigurationDetails]
$creadListPrec :: ReadPrec [AwsEcrRepositoryImageScanningConfigurationDetails]
readPrec :: ReadPrec AwsEcrRepositoryImageScanningConfigurationDetails
$creadPrec :: ReadPrec AwsEcrRepositoryImageScanningConfigurationDetails
readList :: ReadS [AwsEcrRepositoryImageScanningConfigurationDetails]
$creadList :: ReadS [AwsEcrRepositoryImageScanningConfigurationDetails]
readsPrec :: Int -> ReadS AwsEcrRepositoryImageScanningConfigurationDetails
$creadsPrec :: Int -> ReadS AwsEcrRepositoryImageScanningConfigurationDetails
Prelude.Read, Int -> AwsEcrRepositoryImageScanningConfigurationDetails -> ShowS
[AwsEcrRepositoryImageScanningConfigurationDetails] -> ShowS
AwsEcrRepositoryImageScanningConfigurationDetails -> String
(Int -> AwsEcrRepositoryImageScanningConfigurationDetails -> ShowS)
-> (AwsEcrRepositoryImageScanningConfigurationDetails -> String)
-> ([AwsEcrRepositoryImageScanningConfigurationDetails] -> ShowS)
-> Show AwsEcrRepositoryImageScanningConfigurationDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsEcrRepositoryImageScanningConfigurationDetails] -> ShowS
$cshowList :: [AwsEcrRepositoryImageScanningConfigurationDetails] -> ShowS
show :: AwsEcrRepositoryImageScanningConfigurationDetails -> String
$cshow :: AwsEcrRepositoryImageScanningConfigurationDetails -> String
showsPrec :: Int -> AwsEcrRepositoryImageScanningConfigurationDetails -> ShowS
$cshowsPrec :: Int -> AwsEcrRepositoryImageScanningConfigurationDetails -> ShowS
Prelude.Show, (forall x.
 AwsEcrRepositoryImageScanningConfigurationDetails
 -> Rep AwsEcrRepositoryImageScanningConfigurationDetails x)
-> (forall x.
    Rep AwsEcrRepositoryImageScanningConfigurationDetails x
    -> AwsEcrRepositoryImageScanningConfigurationDetails)
-> Generic AwsEcrRepositoryImageScanningConfigurationDetails
forall x.
Rep AwsEcrRepositoryImageScanningConfigurationDetails x
-> AwsEcrRepositoryImageScanningConfigurationDetails
forall x.
AwsEcrRepositoryImageScanningConfigurationDetails
-> Rep AwsEcrRepositoryImageScanningConfigurationDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsEcrRepositoryImageScanningConfigurationDetails x
-> AwsEcrRepositoryImageScanningConfigurationDetails
$cfrom :: forall x.
AwsEcrRepositoryImageScanningConfigurationDetails
-> Rep AwsEcrRepositoryImageScanningConfigurationDetails x
Prelude.Generic)

-- |
-- Create a value of 'AwsEcrRepositoryImageScanningConfigurationDetails' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'scanOnPush', 'awsEcrRepositoryImageScanningConfigurationDetails_scanOnPush' - Whether to scan images after they are pushed to a repository.
newAwsEcrRepositoryImageScanningConfigurationDetails ::
  AwsEcrRepositoryImageScanningConfigurationDetails
newAwsEcrRepositoryImageScanningConfigurationDetails :: AwsEcrRepositoryImageScanningConfigurationDetails
newAwsEcrRepositoryImageScanningConfigurationDetails =
  AwsEcrRepositoryImageScanningConfigurationDetails' :: Maybe Bool -> AwsEcrRepositoryImageScanningConfigurationDetails
AwsEcrRepositoryImageScanningConfigurationDetails'
    { $sel:scanOnPush:AwsEcrRepositoryImageScanningConfigurationDetails' :: Maybe Bool
scanOnPush =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing
    }

-- | Whether to scan images after they are pushed to a repository.
awsEcrRepositoryImageScanningConfigurationDetails_scanOnPush :: Lens.Lens' AwsEcrRepositoryImageScanningConfigurationDetails (Prelude.Maybe Prelude.Bool)
awsEcrRepositoryImageScanningConfigurationDetails_scanOnPush :: (Maybe Bool -> f (Maybe Bool))
-> AwsEcrRepositoryImageScanningConfigurationDetails
-> f AwsEcrRepositoryImageScanningConfigurationDetails
awsEcrRepositoryImageScanningConfigurationDetails_scanOnPush = (AwsEcrRepositoryImageScanningConfigurationDetails -> Maybe Bool)
-> (AwsEcrRepositoryImageScanningConfigurationDetails
    -> Maybe Bool -> AwsEcrRepositoryImageScanningConfigurationDetails)
-> Lens
     AwsEcrRepositoryImageScanningConfigurationDetails
     AwsEcrRepositoryImageScanningConfigurationDetails
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEcrRepositoryImageScanningConfigurationDetails' {Maybe Bool
scanOnPush :: Maybe Bool
$sel:scanOnPush:AwsEcrRepositoryImageScanningConfigurationDetails' :: AwsEcrRepositoryImageScanningConfigurationDetails -> Maybe Bool
scanOnPush} -> Maybe Bool
scanOnPush) (\s :: AwsEcrRepositoryImageScanningConfigurationDetails
s@AwsEcrRepositoryImageScanningConfigurationDetails' {} Maybe Bool
a -> AwsEcrRepositoryImageScanningConfigurationDetails
s {$sel:scanOnPush:AwsEcrRepositoryImageScanningConfigurationDetails' :: Maybe Bool
scanOnPush = Maybe Bool
a} :: AwsEcrRepositoryImageScanningConfigurationDetails)

instance
  Core.FromJSON
    AwsEcrRepositoryImageScanningConfigurationDetails
  where
  parseJSON :: Value -> Parser AwsEcrRepositoryImageScanningConfigurationDetails
parseJSON =
    String
-> (Object
    -> Parser AwsEcrRepositoryImageScanningConfigurationDetails)
-> Value
-> Parser AwsEcrRepositoryImageScanningConfigurationDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsEcrRepositoryImageScanningConfigurationDetails"
      ( \Object
x ->
          Maybe Bool -> AwsEcrRepositoryImageScanningConfigurationDetails
AwsEcrRepositoryImageScanningConfigurationDetails'
            (Maybe Bool -> AwsEcrRepositoryImageScanningConfigurationDetails)
-> Parser (Maybe Bool)
-> Parser AwsEcrRepositoryImageScanningConfigurationDetails
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ScanOnPush")
      )

instance
  Prelude.Hashable
    AwsEcrRepositoryImageScanningConfigurationDetails

instance
  Prelude.NFData
    AwsEcrRepositoryImageScanningConfigurationDetails

instance
  Core.ToJSON
    AwsEcrRepositoryImageScanningConfigurationDetails
  where
  toJSON :: AwsEcrRepositoryImageScanningConfigurationDetails -> Value
toJSON
    AwsEcrRepositoryImageScanningConfigurationDetails' {Maybe Bool
scanOnPush :: Maybe Bool
$sel:scanOnPush:AwsEcrRepositoryImageScanningConfigurationDetails' :: AwsEcrRepositoryImageScanningConfigurationDetails -> Maybe Bool
..} =
      [Pair] -> Value
Core.object
        ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
            [(Text
"ScanOnPush" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
scanOnPush]
        )