{-# 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.EKS.Types.Logging
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.EKS.Types.Logging where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EKS.Types.LogSetup
import qualified Amazonka.Prelude as Prelude

-- | An object representing the logging configuration for resources in your
-- cluster.
--
-- /See:/ 'newLogging' smart constructor.
data Logging = Logging'
  { -- | The cluster control plane logging configuration for your cluster.
    Logging -> Maybe [LogSetup]
clusterLogging :: Prelude.Maybe [LogSetup]
  }
  deriving (Logging -> Logging -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Logging -> Logging -> Bool
$c/= :: Logging -> Logging -> Bool
== :: Logging -> Logging -> Bool
$c== :: Logging -> Logging -> Bool
Prelude.Eq, ReadPrec [Logging]
ReadPrec Logging
Int -> ReadS Logging
ReadS [Logging]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Logging]
$creadListPrec :: ReadPrec [Logging]
readPrec :: ReadPrec Logging
$creadPrec :: ReadPrec Logging
readList :: ReadS [Logging]
$creadList :: ReadS [Logging]
readsPrec :: Int -> ReadS Logging
$creadsPrec :: Int -> ReadS Logging
Prelude.Read, Int -> Logging -> ShowS
[Logging] -> ShowS
Logging -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Logging] -> ShowS
$cshowList :: [Logging] -> ShowS
show :: Logging -> String
$cshow :: Logging -> String
showsPrec :: Int -> Logging -> ShowS
$cshowsPrec :: Int -> Logging -> ShowS
Prelude.Show, forall x. Rep Logging x -> Logging
forall x. Logging -> Rep Logging x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Logging x -> Logging
$cfrom :: forall x. Logging -> Rep Logging x
Prelude.Generic)

-- |
-- Create a value of 'Logging' 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:
--
-- 'clusterLogging', 'logging_clusterLogging' - The cluster control plane logging configuration for your cluster.
newLogging ::
  Logging
newLogging :: Logging
newLogging =
  Logging' {$sel:clusterLogging:Logging' :: Maybe [LogSetup]
clusterLogging = forall a. Maybe a
Prelude.Nothing}

-- | The cluster control plane logging configuration for your cluster.
logging_clusterLogging :: Lens.Lens' Logging (Prelude.Maybe [LogSetup])
logging_clusterLogging :: Lens' Logging (Maybe [LogSetup])
logging_clusterLogging = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Logging' {Maybe [LogSetup]
clusterLogging :: Maybe [LogSetup]
$sel:clusterLogging:Logging' :: Logging -> Maybe [LogSetup]
clusterLogging} -> Maybe [LogSetup]
clusterLogging) (\s :: Logging
s@Logging' {} Maybe [LogSetup]
a -> Logging
s {$sel:clusterLogging:Logging' :: Maybe [LogSetup]
clusterLogging = Maybe [LogSetup]
a} :: Logging) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON Logging where
  parseJSON :: Value -> Parser Logging
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Logging"
      ( \Object
x ->
          Maybe [LogSetup] -> Logging
Logging'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"clusterLogging"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable Logging where
  hashWithSalt :: Int -> Logging -> Int
hashWithSalt Int
_salt Logging' {Maybe [LogSetup]
clusterLogging :: Maybe [LogSetup]
$sel:clusterLogging:Logging' :: Logging -> Maybe [LogSetup]
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [LogSetup]
clusterLogging

instance Prelude.NFData Logging where
  rnf :: Logging -> ()
rnf Logging' {Maybe [LogSetup]
clusterLogging :: Maybe [LogSetup]
$sel:clusterLogging:Logging' :: Logging -> Maybe [LogSetup]
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe [LogSetup]
clusterLogging

instance Data.ToJSON Logging where
  toJSON :: Logging -> Value
toJSON Logging' {Maybe [LogSetup]
clusterLogging :: Maybe [LogSetup]
$sel:clusterLogging:Logging' :: Logging -> Maybe [LogSetup]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"clusterLogging" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [LogSetup]
clusterLogging
          ]
      )