{-# 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.MediaPackage.Types.EgressAccessLogs
-- 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.MediaPackage.Types.EgressAccessLogs where

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

-- | Configure egress access logging.
--
-- /See:/ 'newEgressAccessLogs' smart constructor.
data EgressAccessLogs = EgressAccessLogs'
  { -- | Customize the log group name.
    EgressAccessLogs -> Maybe Text
logGroupName :: Prelude.Maybe Prelude.Text
  }
  deriving (EgressAccessLogs -> EgressAccessLogs -> Bool
(EgressAccessLogs -> EgressAccessLogs -> Bool)
-> (EgressAccessLogs -> EgressAccessLogs -> Bool)
-> Eq EgressAccessLogs
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EgressAccessLogs -> EgressAccessLogs -> Bool
$c/= :: EgressAccessLogs -> EgressAccessLogs -> Bool
== :: EgressAccessLogs -> EgressAccessLogs -> Bool
$c== :: EgressAccessLogs -> EgressAccessLogs -> Bool
Prelude.Eq, ReadPrec [EgressAccessLogs]
ReadPrec EgressAccessLogs
Int -> ReadS EgressAccessLogs
ReadS [EgressAccessLogs]
(Int -> ReadS EgressAccessLogs)
-> ReadS [EgressAccessLogs]
-> ReadPrec EgressAccessLogs
-> ReadPrec [EgressAccessLogs]
-> Read EgressAccessLogs
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EgressAccessLogs]
$creadListPrec :: ReadPrec [EgressAccessLogs]
readPrec :: ReadPrec EgressAccessLogs
$creadPrec :: ReadPrec EgressAccessLogs
readList :: ReadS [EgressAccessLogs]
$creadList :: ReadS [EgressAccessLogs]
readsPrec :: Int -> ReadS EgressAccessLogs
$creadsPrec :: Int -> ReadS EgressAccessLogs
Prelude.Read, Int -> EgressAccessLogs -> ShowS
[EgressAccessLogs] -> ShowS
EgressAccessLogs -> String
(Int -> EgressAccessLogs -> ShowS)
-> (EgressAccessLogs -> String)
-> ([EgressAccessLogs] -> ShowS)
-> Show EgressAccessLogs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EgressAccessLogs] -> ShowS
$cshowList :: [EgressAccessLogs] -> ShowS
show :: EgressAccessLogs -> String
$cshow :: EgressAccessLogs -> String
showsPrec :: Int -> EgressAccessLogs -> ShowS
$cshowsPrec :: Int -> EgressAccessLogs -> ShowS
Prelude.Show, (forall x. EgressAccessLogs -> Rep EgressAccessLogs x)
-> (forall x. Rep EgressAccessLogs x -> EgressAccessLogs)
-> Generic EgressAccessLogs
forall x. Rep EgressAccessLogs x -> EgressAccessLogs
forall x. EgressAccessLogs -> Rep EgressAccessLogs x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EgressAccessLogs x -> EgressAccessLogs
$cfrom :: forall x. EgressAccessLogs -> Rep EgressAccessLogs x
Prelude.Generic)

-- |
-- Create a value of 'EgressAccessLogs' 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:
--
-- 'logGroupName', 'egressAccessLogs_logGroupName' - Customize the log group name.
newEgressAccessLogs ::
  EgressAccessLogs
newEgressAccessLogs :: EgressAccessLogs
newEgressAccessLogs =
  EgressAccessLogs' :: Maybe Text -> EgressAccessLogs
EgressAccessLogs' {$sel:logGroupName:EgressAccessLogs' :: Maybe Text
logGroupName = Maybe Text
forall a. Maybe a
Prelude.Nothing}

-- | Customize the log group name.
egressAccessLogs_logGroupName :: Lens.Lens' EgressAccessLogs (Prelude.Maybe Prelude.Text)
egressAccessLogs_logGroupName :: (Maybe Text -> f (Maybe Text))
-> EgressAccessLogs -> f EgressAccessLogs
egressAccessLogs_logGroupName = (EgressAccessLogs -> Maybe Text)
-> (EgressAccessLogs -> Maybe Text -> EgressAccessLogs)
-> Lens EgressAccessLogs EgressAccessLogs (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EgressAccessLogs' {Maybe Text
logGroupName :: Maybe Text
$sel:logGroupName:EgressAccessLogs' :: EgressAccessLogs -> Maybe Text
logGroupName} -> Maybe Text
logGroupName) (\s :: EgressAccessLogs
s@EgressAccessLogs' {} Maybe Text
a -> EgressAccessLogs
s {$sel:logGroupName:EgressAccessLogs' :: Maybe Text
logGroupName = Maybe Text
a} :: EgressAccessLogs)

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

instance Prelude.Hashable EgressAccessLogs

instance Prelude.NFData EgressAccessLogs

instance Core.ToJSON EgressAccessLogs where
  toJSON :: EgressAccessLogs -> Value
toJSON EgressAccessLogs' {Maybe Text
logGroupName :: Maybe Text
$sel:logGroupName:EgressAccessLogs' :: EgressAccessLogs -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"logGroupName" 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
logGroupName]
      )