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

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

-- | An object that represents an access log file.
--
-- /See:/ 'newVirtualGatewayFileAccessLog' smart constructor.
data VirtualGatewayFileAccessLog = VirtualGatewayFileAccessLog'
  { -- | The file path to write access logs to. You can use @\/dev\/stdout@ to
    -- send access logs to standard out and configure your Envoy container to
    -- use a log driver, such as @awslogs@, to export the access logs to a log
    -- storage service such as Amazon CloudWatch Logs. You can also specify a
    -- path in the Envoy container\'s file system to write the files to disk.
    VirtualGatewayFileAccessLog -> Text
path :: Prelude.Text
  }
  deriving (VirtualGatewayFileAccessLog -> VirtualGatewayFileAccessLog -> Bool
(VirtualGatewayFileAccessLog
 -> VirtualGatewayFileAccessLog -> Bool)
-> (VirtualGatewayFileAccessLog
    -> VirtualGatewayFileAccessLog -> Bool)
-> Eq VirtualGatewayFileAccessLog
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VirtualGatewayFileAccessLog -> VirtualGatewayFileAccessLog -> Bool
$c/= :: VirtualGatewayFileAccessLog -> VirtualGatewayFileAccessLog -> Bool
== :: VirtualGatewayFileAccessLog -> VirtualGatewayFileAccessLog -> Bool
$c== :: VirtualGatewayFileAccessLog -> VirtualGatewayFileAccessLog -> Bool
Prelude.Eq, ReadPrec [VirtualGatewayFileAccessLog]
ReadPrec VirtualGatewayFileAccessLog
Int -> ReadS VirtualGatewayFileAccessLog
ReadS [VirtualGatewayFileAccessLog]
(Int -> ReadS VirtualGatewayFileAccessLog)
-> ReadS [VirtualGatewayFileAccessLog]
-> ReadPrec VirtualGatewayFileAccessLog
-> ReadPrec [VirtualGatewayFileAccessLog]
-> Read VirtualGatewayFileAccessLog
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VirtualGatewayFileAccessLog]
$creadListPrec :: ReadPrec [VirtualGatewayFileAccessLog]
readPrec :: ReadPrec VirtualGatewayFileAccessLog
$creadPrec :: ReadPrec VirtualGatewayFileAccessLog
readList :: ReadS [VirtualGatewayFileAccessLog]
$creadList :: ReadS [VirtualGatewayFileAccessLog]
readsPrec :: Int -> ReadS VirtualGatewayFileAccessLog
$creadsPrec :: Int -> ReadS VirtualGatewayFileAccessLog
Prelude.Read, Int -> VirtualGatewayFileAccessLog -> ShowS
[VirtualGatewayFileAccessLog] -> ShowS
VirtualGatewayFileAccessLog -> String
(Int -> VirtualGatewayFileAccessLog -> ShowS)
-> (VirtualGatewayFileAccessLog -> String)
-> ([VirtualGatewayFileAccessLog] -> ShowS)
-> Show VirtualGatewayFileAccessLog
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VirtualGatewayFileAccessLog] -> ShowS
$cshowList :: [VirtualGatewayFileAccessLog] -> ShowS
show :: VirtualGatewayFileAccessLog -> String
$cshow :: VirtualGatewayFileAccessLog -> String
showsPrec :: Int -> VirtualGatewayFileAccessLog -> ShowS
$cshowsPrec :: Int -> VirtualGatewayFileAccessLog -> ShowS
Prelude.Show, (forall x.
 VirtualGatewayFileAccessLog -> Rep VirtualGatewayFileAccessLog x)
-> (forall x.
    Rep VirtualGatewayFileAccessLog x -> VirtualGatewayFileAccessLog)
-> Generic VirtualGatewayFileAccessLog
forall x.
Rep VirtualGatewayFileAccessLog x -> VirtualGatewayFileAccessLog
forall x.
VirtualGatewayFileAccessLog -> Rep VirtualGatewayFileAccessLog x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep VirtualGatewayFileAccessLog x -> VirtualGatewayFileAccessLog
$cfrom :: forall x.
VirtualGatewayFileAccessLog -> Rep VirtualGatewayFileAccessLog x
Prelude.Generic)

-- |
-- Create a value of 'VirtualGatewayFileAccessLog' 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:
--
-- 'path', 'virtualGatewayFileAccessLog_path' - The file path to write access logs to. You can use @\/dev\/stdout@ to
-- send access logs to standard out and configure your Envoy container to
-- use a log driver, such as @awslogs@, to export the access logs to a log
-- storage service such as Amazon CloudWatch Logs. You can also specify a
-- path in the Envoy container\'s file system to write the files to disk.
newVirtualGatewayFileAccessLog ::
  -- | 'path'
  Prelude.Text ->
  VirtualGatewayFileAccessLog
newVirtualGatewayFileAccessLog :: Text -> VirtualGatewayFileAccessLog
newVirtualGatewayFileAccessLog Text
pPath_ =
  VirtualGatewayFileAccessLog' :: Text -> VirtualGatewayFileAccessLog
VirtualGatewayFileAccessLog' {$sel:path:VirtualGatewayFileAccessLog' :: Text
path = Text
pPath_}

-- | The file path to write access logs to. You can use @\/dev\/stdout@ to
-- send access logs to standard out and configure your Envoy container to
-- use a log driver, such as @awslogs@, to export the access logs to a log
-- storage service such as Amazon CloudWatch Logs. You can also specify a
-- path in the Envoy container\'s file system to write the files to disk.
virtualGatewayFileAccessLog_path :: Lens.Lens' VirtualGatewayFileAccessLog Prelude.Text
virtualGatewayFileAccessLog_path :: (Text -> f Text)
-> VirtualGatewayFileAccessLog -> f VirtualGatewayFileAccessLog
virtualGatewayFileAccessLog_path = (VirtualGatewayFileAccessLog -> Text)
-> (VirtualGatewayFileAccessLog
    -> Text -> VirtualGatewayFileAccessLog)
-> Lens
     VirtualGatewayFileAccessLog VirtualGatewayFileAccessLog Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualGatewayFileAccessLog' {Text
path :: Text
$sel:path:VirtualGatewayFileAccessLog' :: VirtualGatewayFileAccessLog -> Text
path} -> Text
path) (\s :: VirtualGatewayFileAccessLog
s@VirtualGatewayFileAccessLog' {} Text
a -> VirtualGatewayFileAccessLog
s {$sel:path:VirtualGatewayFileAccessLog' :: Text
path = Text
a} :: VirtualGatewayFileAccessLog)

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

instance Prelude.Hashable VirtualGatewayFileAccessLog

instance Prelude.NFData VirtualGatewayFileAccessLog

instance Core.ToJSON VirtualGatewayFileAccessLog where
  toJSON :: VirtualGatewayFileAccessLog -> Value
toJSON VirtualGatewayFileAccessLog' {Text
path :: Text
$sel:path:VirtualGatewayFileAccessLog' :: VirtualGatewayFileAccessLog -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"path" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
path)]
      )