{-# 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.CloudWatchLogOptionsSpecification
-- 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.CloudWatchLogOptionsSpecification 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

-- | Options for sending VPN tunnel logs to CloudWatch.
--
-- /See:/ 'newCloudWatchLogOptionsSpecification' smart constructor.
data CloudWatchLogOptionsSpecification = CloudWatchLogOptionsSpecification'
  { -- | Enable or disable VPN tunnel logging feature. Default value is @False@.
    --
    -- Valid values: @True@ | @False@
    CloudWatchLogOptionsSpecification -> Maybe Bool
logEnabled :: Prelude.Maybe Prelude.Bool,
    -- | The Amazon Resource Name (ARN) of the CloudWatch log group to send logs
    -- to.
    CloudWatchLogOptionsSpecification -> Maybe Text
logGroupArn :: Prelude.Maybe Prelude.Text,
    -- | Set log format. Default format is @json@.
    --
    -- Valid values: @json@ | @text@
    CloudWatchLogOptionsSpecification -> Maybe Text
logOutputFormat :: Prelude.Maybe Prelude.Text
  }
  deriving (CloudWatchLogOptionsSpecification
-> CloudWatchLogOptionsSpecification -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CloudWatchLogOptionsSpecification
-> CloudWatchLogOptionsSpecification -> Bool
$c/= :: CloudWatchLogOptionsSpecification
-> CloudWatchLogOptionsSpecification -> Bool
== :: CloudWatchLogOptionsSpecification
-> CloudWatchLogOptionsSpecification -> Bool
$c== :: CloudWatchLogOptionsSpecification
-> CloudWatchLogOptionsSpecification -> Bool
Prelude.Eq, ReadPrec [CloudWatchLogOptionsSpecification]
ReadPrec CloudWatchLogOptionsSpecification
Int -> ReadS CloudWatchLogOptionsSpecification
ReadS [CloudWatchLogOptionsSpecification]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CloudWatchLogOptionsSpecification]
$creadListPrec :: ReadPrec [CloudWatchLogOptionsSpecification]
readPrec :: ReadPrec CloudWatchLogOptionsSpecification
$creadPrec :: ReadPrec CloudWatchLogOptionsSpecification
readList :: ReadS [CloudWatchLogOptionsSpecification]
$creadList :: ReadS [CloudWatchLogOptionsSpecification]
readsPrec :: Int -> ReadS CloudWatchLogOptionsSpecification
$creadsPrec :: Int -> ReadS CloudWatchLogOptionsSpecification
Prelude.Read, Int -> CloudWatchLogOptionsSpecification -> ShowS
[CloudWatchLogOptionsSpecification] -> ShowS
CloudWatchLogOptionsSpecification -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CloudWatchLogOptionsSpecification] -> ShowS
$cshowList :: [CloudWatchLogOptionsSpecification] -> ShowS
show :: CloudWatchLogOptionsSpecification -> String
$cshow :: CloudWatchLogOptionsSpecification -> String
showsPrec :: Int -> CloudWatchLogOptionsSpecification -> ShowS
$cshowsPrec :: Int -> CloudWatchLogOptionsSpecification -> ShowS
Prelude.Show, forall x.
Rep CloudWatchLogOptionsSpecification x
-> CloudWatchLogOptionsSpecification
forall x.
CloudWatchLogOptionsSpecification
-> Rep CloudWatchLogOptionsSpecification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CloudWatchLogOptionsSpecification x
-> CloudWatchLogOptionsSpecification
$cfrom :: forall x.
CloudWatchLogOptionsSpecification
-> Rep CloudWatchLogOptionsSpecification x
Prelude.Generic)

-- |
-- Create a value of 'CloudWatchLogOptionsSpecification' 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:
--
-- 'logEnabled', 'cloudWatchLogOptionsSpecification_logEnabled' - Enable or disable VPN tunnel logging feature. Default value is @False@.
--
-- Valid values: @True@ | @False@
--
-- 'logGroupArn', 'cloudWatchLogOptionsSpecification_logGroupArn' - The Amazon Resource Name (ARN) of the CloudWatch log group to send logs
-- to.
--
-- 'logOutputFormat', 'cloudWatchLogOptionsSpecification_logOutputFormat' - Set log format. Default format is @json@.
--
-- Valid values: @json@ | @text@
newCloudWatchLogOptionsSpecification ::
  CloudWatchLogOptionsSpecification
newCloudWatchLogOptionsSpecification :: CloudWatchLogOptionsSpecification
newCloudWatchLogOptionsSpecification =
  CloudWatchLogOptionsSpecification'
    { $sel:logEnabled:CloudWatchLogOptionsSpecification' :: Maybe Bool
logEnabled =
        forall a. Maybe a
Prelude.Nothing,
      $sel:logGroupArn:CloudWatchLogOptionsSpecification' :: Maybe Text
logGroupArn = forall a. Maybe a
Prelude.Nothing,
      $sel:logOutputFormat:CloudWatchLogOptionsSpecification' :: Maybe Text
logOutputFormat = forall a. Maybe a
Prelude.Nothing
    }

-- | Enable or disable VPN tunnel logging feature. Default value is @False@.
--
-- Valid values: @True@ | @False@
cloudWatchLogOptionsSpecification_logEnabled :: Lens.Lens' CloudWatchLogOptionsSpecification (Prelude.Maybe Prelude.Bool)
cloudWatchLogOptionsSpecification_logEnabled :: Lens' CloudWatchLogOptionsSpecification (Maybe Bool)
cloudWatchLogOptionsSpecification_logEnabled = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudWatchLogOptionsSpecification' {Maybe Bool
logEnabled :: Maybe Bool
$sel:logEnabled:CloudWatchLogOptionsSpecification' :: CloudWatchLogOptionsSpecification -> Maybe Bool
logEnabled} -> Maybe Bool
logEnabled) (\s :: CloudWatchLogOptionsSpecification
s@CloudWatchLogOptionsSpecification' {} Maybe Bool
a -> CloudWatchLogOptionsSpecification
s {$sel:logEnabled:CloudWatchLogOptionsSpecification' :: Maybe Bool
logEnabled = Maybe Bool
a} :: CloudWatchLogOptionsSpecification)

-- | The Amazon Resource Name (ARN) of the CloudWatch log group to send logs
-- to.
cloudWatchLogOptionsSpecification_logGroupArn :: Lens.Lens' CloudWatchLogOptionsSpecification (Prelude.Maybe Prelude.Text)
cloudWatchLogOptionsSpecification_logGroupArn :: Lens' CloudWatchLogOptionsSpecification (Maybe Text)
cloudWatchLogOptionsSpecification_logGroupArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudWatchLogOptionsSpecification' {Maybe Text
logGroupArn :: Maybe Text
$sel:logGroupArn:CloudWatchLogOptionsSpecification' :: CloudWatchLogOptionsSpecification -> Maybe Text
logGroupArn} -> Maybe Text
logGroupArn) (\s :: CloudWatchLogOptionsSpecification
s@CloudWatchLogOptionsSpecification' {} Maybe Text
a -> CloudWatchLogOptionsSpecification
s {$sel:logGroupArn:CloudWatchLogOptionsSpecification' :: Maybe Text
logGroupArn = Maybe Text
a} :: CloudWatchLogOptionsSpecification)

-- | Set log format. Default format is @json@.
--
-- Valid values: @json@ | @text@
cloudWatchLogOptionsSpecification_logOutputFormat :: Lens.Lens' CloudWatchLogOptionsSpecification (Prelude.Maybe Prelude.Text)
cloudWatchLogOptionsSpecification_logOutputFormat :: Lens' CloudWatchLogOptionsSpecification (Maybe Text)
cloudWatchLogOptionsSpecification_logOutputFormat = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudWatchLogOptionsSpecification' {Maybe Text
logOutputFormat :: Maybe Text
$sel:logOutputFormat:CloudWatchLogOptionsSpecification' :: CloudWatchLogOptionsSpecification -> Maybe Text
logOutputFormat} -> Maybe Text
logOutputFormat) (\s :: CloudWatchLogOptionsSpecification
s@CloudWatchLogOptionsSpecification' {} Maybe Text
a -> CloudWatchLogOptionsSpecification
s {$sel:logOutputFormat:CloudWatchLogOptionsSpecification' :: Maybe Text
logOutputFormat = Maybe Text
a} :: CloudWatchLogOptionsSpecification)

instance
  Prelude.Hashable
    CloudWatchLogOptionsSpecification
  where
  hashWithSalt :: Int -> CloudWatchLogOptionsSpecification -> Int
hashWithSalt
    Int
_salt
    CloudWatchLogOptionsSpecification' {Maybe Bool
Maybe Text
logOutputFormat :: Maybe Text
logGroupArn :: Maybe Text
logEnabled :: Maybe Bool
$sel:logOutputFormat:CloudWatchLogOptionsSpecification' :: CloudWatchLogOptionsSpecification -> Maybe Text
$sel:logGroupArn:CloudWatchLogOptionsSpecification' :: CloudWatchLogOptionsSpecification -> Maybe Text
$sel:logEnabled:CloudWatchLogOptionsSpecification' :: CloudWatchLogOptionsSpecification -> Maybe Bool
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
logEnabled
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
logGroupArn
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
logOutputFormat

instance
  Prelude.NFData
    CloudWatchLogOptionsSpecification
  where
  rnf :: CloudWatchLogOptionsSpecification -> ()
rnf CloudWatchLogOptionsSpecification' {Maybe Bool
Maybe Text
logOutputFormat :: Maybe Text
logGroupArn :: Maybe Text
logEnabled :: Maybe Bool
$sel:logOutputFormat:CloudWatchLogOptionsSpecification' :: CloudWatchLogOptionsSpecification -> Maybe Text
$sel:logGroupArn:CloudWatchLogOptionsSpecification' :: CloudWatchLogOptionsSpecification -> Maybe Text
$sel:logEnabled:CloudWatchLogOptionsSpecification' :: CloudWatchLogOptionsSpecification -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
logEnabled
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
logGroupArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
logOutputFormat

instance
  Data.ToQuery
    CloudWatchLogOptionsSpecification
  where
  toQuery :: CloudWatchLogOptionsSpecification -> QueryString
toQuery CloudWatchLogOptionsSpecification' {Maybe Bool
Maybe Text
logOutputFormat :: Maybe Text
logGroupArn :: Maybe Text
logEnabled :: Maybe Bool
$sel:logOutputFormat:CloudWatchLogOptionsSpecification' :: CloudWatchLogOptionsSpecification -> Maybe Text
$sel:logGroupArn:CloudWatchLogOptionsSpecification' :: CloudWatchLogOptionsSpecification -> Maybe Text
$sel:logEnabled:CloudWatchLogOptionsSpecification' :: CloudWatchLogOptionsSpecification -> Maybe Bool
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"LogEnabled" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
logEnabled,
        ByteString
"LogGroupArn" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
logGroupArn,
        ByteString
"LogOutputFormat" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
logOutputFormat
      ]