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

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

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

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

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

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

instance Prelude.NFData IngressAccessLogs

instance Core.ToJSON IngressAccessLogs where
  toJSON :: IngressAccessLogs -> Value
toJSON IngressAccessLogs' {Maybe Text
logGroupName :: Maybe Text
$sel:logGroupName:IngressAccessLogs' :: IngressAccessLogs -> 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]
      )