{-# 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.AppMesh.Types.VirtualGatewayLogging
-- 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.AppMesh.Types.VirtualGatewayLogging where

import Amazonka.AppMesh.Types.VirtualGatewayAccessLog
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | An object that represents logging information.
--
-- /See:/ 'newVirtualGatewayLogging' smart constructor.
data VirtualGatewayLogging = VirtualGatewayLogging'
  { -- | The access log configuration.
    VirtualGatewayLogging -> Maybe VirtualGatewayAccessLog
accessLog :: Prelude.Maybe VirtualGatewayAccessLog
  }
  deriving (VirtualGatewayLogging -> VirtualGatewayLogging -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VirtualGatewayLogging -> VirtualGatewayLogging -> Bool
$c/= :: VirtualGatewayLogging -> VirtualGatewayLogging -> Bool
== :: VirtualGatewayLogging -> VirtualGatewayLogging -> Bool
$c== :: VirtualGatewayLogging -> VirtualGatewayLogging -> Bool
Prelude.Eq, ReadPrec [VirtualGatewayLogging]
ReadPrec VirtualGatewayLogging
Int -> ReadS VirtualGatewayLogging
ReadS [VirtualGatewayLogging]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VirtualGatewayLogging]
$creadListPrec :: ReadPrec [VirtualGatewayLogging]
readPrec :: ReadPrec VirtualGatewayLogging
$creadPrec :: ReadPrec VirtualGatewayLogging
readList :: ReadS [VirtualGatewayLogging]
$creadList :: ReadS [VirtualGatewayLogging]
readsPrec :: Int -> ReadS VirtualGatewayLogging
$creadsPrec :: Int -> ReadS VirtualGatewayLogging
Prelude.Read, Int -> VirtualGatewayLogging -> ShowS
[VirtualGatewayLogging] -> ShowS
VirtualGatewayLogging -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VirtualGatewayLogging] -> ShowS
$cshowList :: [VirtualGatewayLogging] -> ShowS
show :: VirtualGatewayLogging -> String
$cshow :: VirtualGatewayLogging -> String
showsPrec :: Int -> VirtualGatewayLogging -> ShowS
$cshowsPrec :: Int -> VirtualGatewayLogging -> ShowS
Prelude.Show, forall x. Rep VirtualGatewayLogging x -> VirtualGatewayLogging
forall x. VirtualGatewayLogging -> Rep VirtualGatewayLogging x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VirtualGatewayLogging x -> VirtualGatewayLogging
$cfrom :: forall x. VirtualGatewayLogging -> Rep VirtualGatewayLogging x
Prelude.Generic)

-- |
-- Create a value of 'VirtualGatewayLogging' 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:
--
-- 'accessLog', 'virtualGatewayLogging_accessLog' - The access log configuration.
newVirtualGatewayLogging ::
  VirtualGatewayLogging
newVirtualGatewayLogging :: VirtualGatewayLogging
newVirtualGatewayLogging =
  VirtualGatewayLogging' {$sel:accessLog:VirtualGatewayLogging' :: Maybe VirtualGatewayAccessLog
accessLog = forall a. Maybe a
Prelude.Nothing}

-- | The access log configuration.
virtualGatewayLogging_accessLog :: Lens.Lens' VirtualGatewayLogging (Prelude.Maybe VirtualGatewayAccessLog)
virtualGatewayLogging_accessLog :: Lens' VirtualGatewayLogging (Maybe VirtualGatewayAccessLog)
virtualGatewayLogging_accessLog = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualGatewayLogging' {Maybe VirtualGatewayAccessLog
accessLog :: Maybe VirtualGatewayAccessLog
$sel:accessLog:VirtualGatewayLogging' :: VirtualGatewayLogging -> Maybe VirtualGatewayAccessLog
accessLog} -> Maybe VirtualGatewayAccessLog
accessLog) (\s :: VirtualGatewayLogging
s@VirtualGatewayLogging' {} Maybe VirtualGatewayAccessLog
a -> VirtualGatewayLogging
s {$sel:accessLog:VirtualGatewayLogging' :: Maybe VirtualGatewayAccessLog
accessLog = Maybe VirtualGatewayAccessLog
a} :: VirtualGatewayLogging)

instance Data.FromJSON VirtualGatewayLogging where
  parseJSON :: Value -> Parser VirtualGatewayLogging
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"VirtualGatewayLogging"
      ( \Object
x ->
          Maybe VirtualGatewayAccessLog -> VirtualGatewayLogging
VirtualGatewayLogging'
            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
"accessLog")
      )

instance Prelude.Hashable VirtualGatewayLogging where
  hashWithSalt :: Int -> VirtualGatewayLogging -> Int
hashWithSalt Int
_salt VirtualGatewayLogging' {Maybe VirtualGatewayAccessLog
accessLog :: Maybe VirtualGatewayAccessLog
$sel:accessLog:VirtualGatewayLogging' :: VirtualGatewayLogging -> Maybe VirtualGatewayAccessLog
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VirtualGatewayAccessLog
accessLog

instance Prelude.NFData VirtualGatewayLogging where
  rnf :: VirtualGatewayLogging -> ()
rnf VirtualGatewayLogging' {Maybe VirtualGatewayAccessLog
accessLog :: Maybe VirtualGatewayAccessLog
$sel:accessLog:VirtualGatewayLogging' :: VirtualGatewayLogging -> Maybe VirtualGatewayAccessLog
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe VirtualGatewayAccessLog
accessLog

instance Data.ToJSON VirtualGatewayLogging where
  toJSON :: VirtualGatewayLogging -> Value
toJSON VirtualGatewayLogging' {Maybe VirtualGatewayAccessLog
accessLog :: Maybe VirtualGatewayAccessLog
$sel:accessLog:VirtualGatewayLogging' :: VirtualGatewayLogging -> Maybe VirtualGatewayAccessLog
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"accessLog" 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 VirtualGatewayAccessLog
accessLog]
      )