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

-- |
-- Create a value of 'CloudWatchLogOptions' 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', 'cloudWatchLogOptions_logEnabled' - Status of VPN tunnel logging feature. Default value is @False@.
--
-- Valid values: @True@ | @False@
--
-- 'logGroupArn', 'cloudWatchLogOptions_logGroupArn' - The Amazon Resource Name (ARN) of the CloudWatch log group to send logs
-- to.
--
-- 'logOutputFormat', 'cloudWatchLogOptions_logOutputFormat' - Configured log format. Default format is @json@.
--
-- Valid values: @json@ | @text@
newCloudWatchLogOptions ::
  CloudWatchLogOptions
newCloudWatchLogOptions :: CloudWatchLogOptions
newCloudWatchLogOptions =
  CloudWatchLogOptions'
    { $sel:logEnabled:CloudWatchLogOptions' :: Maybe Bool
logEnabled = forall a. Maybe a
Prelude.Nothing,
      $sel:logGroupArn:CloudWatchLogOptions' :: Maybe Text
logGroupArn = forall a. Maybe a
Prelude.Nothing,
      $sel:logOutputFormat:CloudWatchLogOptions' :: Maybe Text
logOutputFormat = forall a. Maybe a
Prelude.Nothing
    }

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

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

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

instance Data.FromXML CloudWatchLogOptions where
  parseXML :: [Node] -> Either String CloudWatchLogOptions
parseXML [Node]
x =
    Maybe Bool -> Maybe Text -> Maybe Text -> CloudWatchLogOptions
CloudWatchLogOptions'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"logEnabled")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"logGroupArn")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"logOutputFormat")

instance Prelude.Hashable CloudWatchLogOptions where
  hashWithSalt :: Int -> CloudWatchLogOptions -> Int
hashWithSalt Int
_salt CloudWatchLogOptions' {Maybe Bool
Maybe Text
logOutputFormat :: Maybe Text
logGroupArn :: Maybe Text
logEnabled :: Maybe Bool
$sel:logOutputFormat:CloudWatchLogOptions' :: CloudWatchLogOptions -> Maybe Text
$sel:logGroupArn:CloudWatchLogOptions' :: CloudWatchLogOptions -> Maybe Text
$sel:logEnabled:CloudWatchLogOptions' :: CloudWatchLogOptions -> 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 CloudWatchLogOptions where
  rnf :: CloudWatchLogOptions -> ()
rnf CloudWatchLogOptions' {Maybe Bool
Maybe Text
logOutputFormat :: Maybe Text
logGroupArn :: Maybe Text
logEnabled :: Maybe Bool
$sel:logOutputFormat:CloudWatchLogOptions' :: CloudWatchLogOptions -> Maybe Text
$sel:logGroupArn:CloudWatchLogOptions' :: CloudWatchLogOptions -> Maybe Text
$sel:logEnabled:CloudWatchLogOptions' :: CloudWatchLogOptions -> 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