{-# 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.EC2.Types.ConnectionLogOptions
-- 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.EC2.Types.ConnectionLogOptions where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EC2.Internal
import qualified Amazonka.Prelude as Prelude

-- | Describes the client connection logging options for the Client VPN
-- endpoint.
--
-- /See:/ 'newConnectionLogOptions' smart constructor.
data ConnectionLogOptions = ConnectionLogOptions'
  { -- | The name of the CloudWatch Logs log group. Required if connection
    -- logging is enabled.
    ConnectionLogOptions -> Maybe Text
cloudwatchLogGroup :: Prelude.Maybe Prelude.Text,
    -- | The name of the CloudWatch Logs log stream to which the connection data
    -- is published.
    ConnectionLogOptions -> Maybe Text
cloudwatchLogStream :: Prelude.Maybe Prelude.Text,
    -- | Indicates whether connection logging is enabled.
    ConnectionLogOptions -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool
  }
  deriving (ConnectionLogOptions -> ConnectionLogOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConnectionLogOptions -> ConnectionLogOptions -> Bool
$c/= :: ConnectionLogOptions -> ConnectionLogOptions -> Bool
== :: ConnectionLogOptions -> ConnectionLogOptions -> Bool
$c== :: ConnectionLogOptions -> ConnectionLogOptions -> Bool
Prelude.Eq, ReadPrec [ConnectionLogOptions]
ReadPrec ConnectionLogOptions
Int -> ReadS ConnectionLogOptions
ReadS [ConnectionLogOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConnectionLogOptions]
$creadListPrec :: ReadPrec [ConnectionLogOptions]
readPrec :: ReadPrec ConnectionLogOptions
$creadPrec :: ReadPrec ConnectionLogOptions
readList :: ReadS [ConnectionLogOptions]
$creadList :: ReadS [ConnectionLogOptions]
readsPrec :: Int -> ReadS ConnectionLogOptions
$creadsPrec :: Int -> ReadS ConnectionLogOptions
Prelude.Read, Int -> ConnectionLogOptions -> ShowS
[ConnectionLogOptions] -> ShowS
ConnectionLogOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConnectionLogOptions] -> ShowS
$cshowList :: [ConnectionLogOptions] -> ShowS
show :: ConnectionLogOptions -> String
$cshow :: ConnectionLogOptions -> String
showsPrec :: Int -> ConnectionLogOptions -> ShowS
$cshowsPrec :: Int -> ConnectionLogOptions -> ShowS
Prelude.Show, forall x. Rep ConnectionLogOptions x -> ConnectionLogOptions
forall x. ConnectionLogOptions -> Rep ConnectionLogOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConnectionLogOptions x -> ConnectionLogOptions
$cfrom :: forall x. ConnectionLogOptions -> Rep ConnectionLogOptions x
Prelude.Generic)

-- |
-- Create a value of 'ConnectionLogOptions' 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:
--
-- 'cloudwatchLogGroup', 'connectionLogOptions_cloudwatchLogGroup' - The name of the CloudWatch Logs log group. Required if connection
-- logging is enabled.
--
-- 'cloudwatchLogStream', 'connectionLogOptions_cloudwatchLogStream' - The name of the CloudWatch Logs log stream to which the connection data
-- is published.
--
-- 'enabled', 'connectionLogOptions_enabled' - Indicates whether connection logging is enabled.
newConnectionLogOptions ::
  ConnectionLogOptions
newConnectionLogOptions :: ConnectionLogOptions
newConnectionLogOptions =
  ConnectionLogOptions'
    { $sel:cloudwatchLogGroup:ConnectionLogOptions' :: Maybe Text
cloudwatchLogGroup =
        forall a. Maybe a
Prelude.Nothing,
      $sel:cloudwatchLogStream:ConnectionLogOptions' :: Maybe Text
cloudwatchLogStream = forall a. Maybe a
Prelude.Nothing,
      $sel:enabled:ConnectionLogOptions' :: Maybe Bool
enabled = forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the CloudWatch Logs log group. Required if connection
-- logging is enabled.
connectionLogOptions_cloudwatchLogGroup :: Lens.Lens' ConnectionLogOptions (Prelude.Maybe Prelude.Text)
connectionLogOptions_cloudwatchLogGroup :: Lens' ConnectionLogOptions (Maybe Text)
connectionLogOptions_cloudwatchLogGroup = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectionLogOptions' {Maybe Text
cloudwatchLogGroup :: Maybe Text
$sel:cloudwatchLogGroup:ConnectionLogOptions' :: ConnectionLogOptions -> Maybe Text
cloudwatchLogGroup} -> Maybe Text
cloudwatchLogGroup) (\s :: ConnectionLogOptions
s@ConnectionLogOptions' {} Maybe Text
a -> ConnectionLogOptions
s {$sel:cloudwatchLogGroup:ConnectionLogOptions' :: Maybe Text
cloudwatchLogGroup = Maybe Text
a} :: ConnectionLogOptions)

-- | The name of the CloudWatch Logs log stream to which the connection data
-- is published.
connectionLogOptions_cloudwatchLogStream :: Lens.Lens' ConnectionLogOptions (Prelude.Maybe Prelude.Text)
connectionLogOptions_cloudwatchLogStream :: Lens' ConnectionLogOptions (Maybe Text)
connectionLogOptions_cloudwatchLogStream = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectionLogOptions' {Maybe Text
cloudwatchLogStream :: Maybe Text
$sel:cloudwatchLogStream:ConnectionLogOptions' :: ConnectionLogOptions -> Maybe Text
cloudwatchLogStream} -> Maybe Text
cloudwatchLogStream) (\s :: ConnectionLogOptions
s@ConnectionLogOptions' {} Maybe Text
a -> ConnectionLogOptions
s {$sel:cloudwatchLogStream:ConnectionLogOptions' :: Maybe Text
cloudwatchLogStream = Maybe Text
a} :: ConnectionLogOptions)

-- | Indicates whether connection logging is enabled.
connectionLogOptions_enabled :: Lens.Lens' ConnectionLogOptions (Prelude.Maybe Prelude.Bool)
connectionLogOptions_enabled :: Lens' ConnectionLogOptions (Maybe Bool)
connectionLogOptions_enabled = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectionLogOptions' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:ConnectionLogOptions' :: ConnectionLogOptions -> Maybe Bool
enabled} -> Maybe Bool
enabled) (\s :: ConnectionLogOptions
s@ConnectionLogOptions' {} Maybe Bool
a -> ConnectionLogOptions
s {$sel:enabled:ConnectionLogOptions' :: Maybe Bool
enabled = Maybe Bool
a} :: ConnectionLogOptions)

instance Prelude.Hashable ConnectionLogOptions where
  hashWithSalt :: Int -> ConnectionLogOptions -> Int
hashWithSalt Int
_salt ConnectionLogOptions' {Maybe Bool
Maybe Text
enabled :: Maybe Bool
cloudwatchLogStream :: Maybe Text
cloudwatchLogGroup :: Maybe Text
$sel:enabled:ConnectionLogOptions' :: ConnectionLogOptions -> Maybe Bool
$sel:cloudwatchLogStream:ConnectionLogOptions' :: ConnectionLogOptions -> Maybe Text
$sel:cloudwatchLogGroup:ConnectionLogOptions' :: ConnectionLogOptions -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
cloudwatchLogGroup
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
cloudwatchLogStream
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
enabled

instance Prelude.NFData ConnectionLogOptions where
  rnf :: ConnectionLogOptions -> ()
rnf ConnectionLogOptions' {Maybe Bool
Maybe Text
enabled :: Maybe Bool
cloudwatchLogStream :: Maybe Text
cloudwatchLogGroup :: Maybe Text
$sel:enabled:ConnectionLogOptions' :: ConnectionLogOptions -> Maybe Bool
$sel:cloudwatchLogStream:ConnectionLogOptions' :: ConnectionLogOptions -> Maybe Text
$sel:cloudwatchLogGroup:ConnectionLogOptions' :: ConnectionLogOptions -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
cloudwatchLogGroup
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
cloudwatchLogStream
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
enabled

instance Data.ToQuery ConnectionLogOptions where
  toQuery :: ConnectionLogOptions -> QueryString
toQuery ConnectionLogOptions' {Maybe Bool
Maybe Text
enabled :: Maybe Bool
cloudwatchLogStream :: Maybe Text
cloudwatchLogGroup :: Maybe Text
$sel:enabled:ConnectionLogOptions' :: ConnectionLogOptions -> Maybe Bool
$sel:cloudwatchLogStream:ConnectionLogOptions' :: ConnectionLogOptions -> Maybe Text
$sel:cloudwatchLogGroup:ConnectionLogOptions' :: ConnectionLogOptions -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"CloudwatchLogGroup" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
cloudwatchLogGroup,
        ByteString
"CloudwatchLogStream" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
cloudwatchLogStream,
        ByteString
"Enabled" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
enabled
      ]