{-# 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.AwsEksClusterLoggingClusterLoggingDetails
-- 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.AwsEksClusterLoggingClusterLoggingDetails where

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

-- | Details for a cluster logging configuration.
--
-- /See:/ 'newAwsEksClusterLoggingClusterLoggingDetails' smart constructor.
data AwsEksClusterLoggingClusterLoggingDetails = AwsEksClusterLoggingClusterLoggingDetails'
  { -- | Whether the logging types that are listed in @Types@ are enabled.
    AwsEksClusterLoggingClusterLoggingDetails -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool,
    -- | A list of logging types.
    AwsEksClusterLoggingClusterLoggingDetails -> Maybe [Text]
types :: Prelude.Maybe [Prelude.Text]
  }
  deriving (AwsEksClusterLoggingClusterLoggingDetails
-> AwsEksClusterLoggingClusterLoggingDetails -> Bool
(AwsEksClusterLoggingClusterLoggingDetails
 -> AwsEksClusterLoggingClusterLoggingDetails -> Bool)
-> (AwsEksClusterLoggingClusterLoggingDetails
    -> AwsEksClusterLoggingClusterLoggingDetails -> Bool)
-> Eq AwsEksClusterLoggingClusterLoggingDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsEksClusterLoggingClusterLoggingDetails
-> AwsEksClusterLoggingClusterLoggingDetails -> Bool
$c/= :: AwsEksClusterLoggingClusterLoggingDetails
-> AwsEksClusterLoggingClusterLoggingDetails -> Bool
== :: AwsEksClusterLoggingClusterLoggingDetails
-> AwsEksClusterLoggingClusterLoggingDetails -> Bool
$c== :: AwsEksClusterLoggingClusterLoggingDetails
-> AwsEksClusterLoggingClusterLoggingDetails -> Bool
Prelude.Eq, ReadPrec [AwsEksClusterLoggingClusterLoggingDetails]
ReadPrec AwsEksClusterLoggingClusterLoggingDetails
Int -> ReadS AwsEksClusterLoggingClusterLoggingDetails
ReadS [AwsEksClusterLoggingClusterLoggingDetails]
(Int -> ReadS AwsEksClusterLoggingClusterLoggingDetails)
-> ReadS [AwsEksClusterLoggingClusterLoggingDetails]
-> ReadPrec AwsEksClusterLoggingClusterLoggingDetails
-> ReadPrec [AwsEksClusterLoggingClusterLoggingDetails]
-> Read AwsEksClusterLoggingClusterLoggingDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsEksClusterLoggingClusterLoggingDetails]
$creadListPrec :: ReadPrec [AwsEksClusterLoggingClusterLoggingDetails]
readPrec :: ReadPrec AwsEksClusterLoggingClusterLoggingDetails
$creadPrec :: ReadPrec AwsEksClusterLoggingClusterLoggingDetails
readList :: ReadS [AwsEksClusterLoggingClusterLoggingDetails]
$creadList :: ReadS [AwsEksClusterLoggingClusterLoggingDetails]
readsPrec :: Int -> ReadS AwsEksClusterLoggingClusterLoggingDetails
$creadsPrec :: Int -> ReadS AwsEksClusterLoggingClusterLoggingDetails
Prelude.Read, Int -> AwsEksClusterLoggingClusterLoggingDetails -> ShowS
[AwsEksClusterLoggingClusterLoggingDetails] -> ShowS
AwsEksClusterLoggingClusterLoggingDetails -> String
(Int -> AwsEksClusterLoggingClusterLoggingDetails -> ShowS)
-> (AwsEksClusterLoggingClusterLoggingDetails -> String)
-> ([AwsEksClusterLoggingClusterLoggingDetails] -> ShowS)
-> Show AwsEksClusterLoggingClusterLoggingDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsEksClusterLoggingClusterLoggingDetails] -> ShowS
$cshowList :: [AwsEksClusterLoggingClusterLoggingDetails] -> ShowS
show :: AwsEksClusterLoggingClusterLoggingDetails -> String
$cshow :: AwsEksClusterLoggingClusterLoggingDetails -> String
showsPrec :: Int -> AwsEksClusterLoggingClusterLoggingDetails -> ShowS
$cshowsPrec :: Int -> AwsEksClusterLoggingClusterLoggingDetails -> ShowS
Prelude.Show, (forall x.
 AwsEksClusterLoggingClusterLoggingDetails
 -> Rep AwsEksClusterLoggingClusterLoggingDetails x)
-> (forall x.
    Rep AwsEksClusterLoggingClusterLoggingDetails x
    -> AwsEksClusterLoggingClusterLoggingDetails)
-> Generic AwsEksClusterLoggingClusterLoggingDetails
forall x.
Rep AwsEksClusterLoggingClusterLoggingDetails x
-> AwsEksClusterLoggingClusterLoggingDetails
forall x.
AwsEksClusterLoggingClusterLoggingDetails
-> Rep AwsEksClusterLoggingClusterLoggingDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsEksClusterLoggingClusterLoggingDetails x
-> AwsEksClusterLoggingClusterLoggingDetails
$cfrom :: forall x.
AwsEksClusterLoggingClusterLoggingDetails
-> Rep AwsEksClusterLoggingClusterLoggingDetails x
Prelude.Generic)

-- |
-- Create a value of 'AwsEksClusterLoggingClusterLoggingDetails' 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:
--
-- 'enabled', 'awsEksClusterLoggingClusterLoggingDetails_enabled' - Whether the logging types that are listed in @Types@ are enabled.
--
-- 'types', 'awsEksClusterLoggingClusterLoggingDetails_types' - A list of logging types.
newAwsEksClusterLoggingClusterLoggingDetails ::
  AwsEksClusterLoggingClusterLoggingDetails
newAwsEksClusterLoggingClusterLoggingDetails :: AwsEksClusterLoggingClusterLoggingDetails
newAwsEksClusterLoggingClusterLoggingDetails =
  AwsEksClusterLoggingClusterLoggingDetails' :: Maybe Bool
-> Maybe [Text] -> AwsEksClusterLoggingClusterLoggingDetails
AwsEksClusterLoggingClusterLoggingDetails'
    { $sel:enabled:AwsEksClusterLoggingClusterLoggingDetails' :: Maybe Bool
enabled =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:types:AwsEksClusterLoggingClusterLoggingDetails' :: Maybe [Text]
types = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
    }

-- | Whether the logging types that are listed in @Types@ are enabled.
awsEksClusterLoggingClusterLoggingDetails_enabled :: Lens.Lens' AwsEksClusterLoggingClusterLoggingDetails (Prelude.Maybe Prelude.Bool)
awsEksClusterLoggingClusterLoggingDetails_enabled :: (Maybe Bool -> f (Maybe Bool))
-> AwsEksClusterLoggingClusterLoggingDetails
-> f AwsEksClusterLoggingClusterLoggingDetails
awsEksClusterLoggingClusterLoggingDetails_enabled = (AwsEksClusterLoggingClusterLoggingDetails -> Maybe Bool)
-> (AwsEksClusterLoggingClusterLoggingDetails
    -> Maybe Bool -> AwsEksClusterLoggingClusterLoggingDetails)
-> Lens
     AwsEksClusterLoggingClusterLoggingDetails
     AwsEksClusterLoggingClusterLoggingDetails
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEksClusterLoggingClusterLoggingDetails' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:AwsEksClusterLoggingClusterLoggingDetails' :: AwsEksClusterLoggingClusterLoggingDetails -> Maybe Bool
enabled} -> Maybe Bool
enabled) (\s :: AwsEksClusterLoggingClusterLoggingDetails
s@AwsEksClusterLoggingClusterLoggingDetails' {} Maybe Bool
a -> AwsEksClusterLoggingClusterLoggingDetails
s {$sel:enabled:AwsEksClusterLoggingClusterLoggingDetails' :: Maybe Bool
enabled = Maybe Bool
a} :: AwsEksClusterLoggingClusterLoggingDetails)

-- | A list of logging types.
awsEksClusterLoggingClusterLoggingDetails_types :: Lens.Lens' AwsEksClusterLoggingClusterLoggingDetails (Prelude.Maybe [Prelude.Text])
awsEksClusterLoggingClusterLoggingDetails_types :: (Maybe [Text] -> f (Maybe [Text]))
-> AwsEksClusterLoggingClusterLoggingDetails
-> f AwsEksClusterLoggingClusterLoggingDetails
awsEksClusterLoggingClusterLoggingDetails_types = (AwsEksClusterLoggingClusterLoggingDetails -> Maybe [Text])
-> (AwsEksClusterLoggingClusterLoggingDetails
    -> Maybe [Text] -> AwsEksClusterLoggingClusterLoggingDetails)
-> Lens
     AwsEksClusterLoggingClusterLoggingDetails
     AwsEksClusterLoggingClusterLoggingDetails
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEksClusterLoggingClusterLoggingDetails' {Maybe [Text]
types :: Maybe [Text]
$sel:types:AwsEksClusterLoggingClusterLoggingDetails' :: AwsEksClusterLoggingClusterLoggingDetails -> Maybe [Text]
types} -> Maybe [Text]
types) (\s :: AwsEksClusterLoggingClusterLoggingDetails
s@AwsEksClusterLoggingClusterLoggingDetails' {} Maybe [Text]
a -> AwsEksClusterLoggingClusterLoggingDetails
s {$sel:types:AwsEksClusterLoggingClusterLoggingDetails' :: Maybe [Text]
types = Maybe [Text]
a} :: AwsEksClusterLoggingClusterLoggingDetails) ((Maybe [Text] -> f (Maybe [Text]))
 -> AwsEksClusterLoggingClusterLoggingDetails
 -> f AwsEksClusterLoggingClusterLoggingDetails)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> AwsEksClusterLoggingClusterLoggingDetails
-> f AwsEksClusterLoggingClusterLoggingDetails
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Core.FromJSON
    AwsEksClusterLoggingClusterLoggingDetails
  where
  parseJSON :: Value -> Parser AwsEksClusterLoggingClusterLoggingDetails
parseJSON =
    String
-> (Object -> Parser AwsEksClusterLoggingClusterLoggingDetails)
-> Value
-> Parser AwsEksClusterLoggingClusterLoggingDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsEksClusterLoggingClusterLoggingDetails"
      ( \Object
x ->
          Maybe Bool
-> Maybe [Text] -> AwsEksClusterLoggingClusterLoggingDetails
AwsEksClusterLoggingClusterLoggingDetails'
            (Maybe Bool
 -> Maybe [Text] -> AwsEksClusterLoggingClusterLoggingDetails)
-> Parser (Maybe Bool)
-> Parser
     (Maybe [Text] -> AwsEksClusterLoggingClusterLoggingDetails)
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
"Enabled")
              Parser (Maybe [Text] -> AwsEksClusterLoggingClusterLoggingDetails)
-> Parser (Maybe [Text])
-> Parser AwsEksClusterLoggingClusterLoggingDetails
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Types" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
      )

instance
  Prelude.Hashable
    AwsEksClusterLoggingClusterLoggingDetails

instance
  Prelude.NFData
    AwsEksClusterLoggingClusterLoggingDetails

instance
  Core.ToJSON
    AwsEksClusterLoggingClusterLoggingDetails
  where
  toJSON :: AwsEksClusterLoggingClusterLoggingDetails -> Value
toJSON AwsEksClusterLoggingClusterLoggingDetails' {Maybe Bool
Maybe [Text]
types :: Maybe [Text]
enabled :: Maybe Bool
$sel:types:AwsEksClusterLoggingClusterLoggingDetails' :: AwsEksClusterLoggingClusterLoggingDetails -> Maybe [Text]
$sel:enabled:AwsEksClusterLoggingClusterLoggingDetails' :: AwsEksClusterLoggingClusterLoggingDetails -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Enabled" 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
enabled,
            (Text
"Types" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
types
          ]
      )