{-# 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.SecurityHub.Types.AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
-- 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.SecurityHub.Types.AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails where

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

-- | The FireLens configuration for the container. The configuration
-- specifies and configures a log router for container logs.
--
-- /See:/ 'newAwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails' smart constructor.
data AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails = AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails'
  { -- | The log router to use.
    AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
-> Maybe Text
type' :: Prelude.Maybe Prelude.Text,
    -- | The options to use to configure the log router.
    --
    -- The valid option keys are as follows:
    --
    -- -   @enable-ecs-log-metadata@. The value can be @true@ or @false@.
    --
    -- -   @config-file-type@. The value can be @s3@ or @file@.
    --
    -- -   @config-file-value@. The value is either an S3 ARN or a file path.
    AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
-> Maybe (HashMap Text Text)
options :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
-> AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
-> Bool
(AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
 -> AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
 -> Bool)
-> (AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
    -> AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
    -> Bool)
-> Eq
     AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
-> AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
-> Bool
$c/= :: AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
-> AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
-> Bool
== :: AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
-> AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
-> Bool
$c== :: AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
-> AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
-> Bool
Prelude.Eq, ReadPrec
  [AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails]
ReadPrec
  AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
Int
-> ReadS
     AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
ReadS
  [AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails]
(Int
 -> ReadS
      AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails)
-> ReadS
     [AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails]
-> ReadPrec
     AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
-> ReadPrec
     [AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails]
-> Read
     AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec
  [AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails]
$creadListPrec :: ReadPrec
  [AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails]
readPrec :: ReadPrec
  AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
$creadPrec :: ReadPrec
  AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
readList :: ReadS
  [AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails]
$creadList :: ReadS
  [AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails]
readsPrec :: Int
-> ReadS
     AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
$creadsPrec :: Int
-> ReadS
     AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
Prelude.Read, Int
-> AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
-> ShowS
[AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails]
-> ShowS
AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
-> String
(Int
 -> AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
 -> ShowS)
-> (AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
    -> String)
-> ([AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails]
    -> ShowS)
-> Show
     AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails]
-> ShowS
$cshowList :: [AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails]
-> ShowS
show :: AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
-> String
$cshow :: AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
-> String
showsPrec :: Int
-> AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
-> ShowS
$cshowsPrec :: Int
-> AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
-> ShowS
Prelude.Show, (forall x.
 AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
 -> Rep
      AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
      x)
-> (forall x.
    Rep
      AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
      x
    -> AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails)
-> Generic
     AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
forall x.
Rep
  AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
  x
-> AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
forall x.
AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
-> Rep
     AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
     x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep
  AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
  x
-> AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
$cfrom :: forall x.
AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
-> Rep
     AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
     x
Prelude.Generic)

-- |
-- Create a value of 'AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails' 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:
--
-- 'type'', 'awsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails_type' - The log router to use.
--
-- 'options', 'awsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails_options' - The options to use to configure the log router.
--
-- The valid option keys are as follows:
--
-- -   @enable-ecs-log-metadata@. The value can be @true@ or @false@.
--
-- -   @config-file-type@. The value can be @s3@ or @file@.
--
-- -   @config-file-value@. The value is either an S3 ARN or a file path.
newAwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails ::
  AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
newAwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails :: AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
newAwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails =
  AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails' :: Maybe Text
-> Maybe (HashMap Text Text)
-> AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails'
    { $sel:type':AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails' :: Maybe Text
type' =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:options:AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails' :: Maybe (HashMap Text Text)
options =
        Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | The log router to use.
awsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails_type :: Lens.Lens' AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails (Prelude.Maybe Prelude.Text)
awsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails_type :: (Maybe Text -> f (Maybe Text))
-> AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
-> f AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
awsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails_type = (AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
 -> Maybe Text)
-> (AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
    -> Maybe Text
    -> AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails)
-> Lens
     AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
     AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails' {Maybe Text
type' :: Maybe Text
$sel:type':AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails' :: AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
-> Maybe Text
type'} -> Maybe Text
type') (\s :: AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
s@AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails' {} Maybe Text
a -> AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
s {$sel:type':AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails' :: Maybe Text
type' = Maybe Text
a} :: AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails)

-- | The options to use to configure the log router.
--
-- The valid option keys are as follows:
--
-- -   @enable-ecs-log-metadata@. The value can be @true@ or @false@.
--
-- -   @config-file-type@. The value can be @s3@ or @file@.
--
-- -   @config-file-value@. The value is either an S3 ARN or a file path.
awsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails_options :: Lens.Lens' AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
awsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails_options :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
-> f AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
awsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails_options = (AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
 -> Maybe (HashMap Text Text))
-> (AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
    -> Maybe (HashMap Text Text)
    -> AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails)
-> Lens
     AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
     AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails' {Maybe (HashMap Text Text)
options :: Maybe (HashMap Text Text)
$sel:options:AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails' :: AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
-> Maybe (HashMap Text Text)
options} -> Maybe (HashMap Text Text)
options) (\s :: AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
s@AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails' {} Maybe (HashMap Text Text)
a -> AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
s {$sel:options:AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails' :: Maybe (HashMap Text Text)
options = Maybe (HashMap Text Text)
a} :: AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
 -> f AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
-> f AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Core.FromJSON
    AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
  where
  parseJSON :: Value
-> Parser
     AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
parseJSON =
    String
-> (Object
    -> Parser
         AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails)
-> Value
-> Parser
     AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails"
      ( \Object
x ->
          Maybe Text
-> Maybe (HashMap Text Text)
-> AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails'
            (Maybe Text
 -> Maybe (HashMap Text Text)
 -> AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe (HashMap Text Text)
      -> AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails)
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
"Type")
              Parser
  (Maybe (HashMap Text Text)
   -> AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails)
-> Parser (Maybe (HashMap Text Text))
-> Parser
     AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Options" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
      )

instance
  Prelude.Hashable
    AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails

instance
  Prelude.NFData
    AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails

instance
  Core.ToJSON
    AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
  where
  toJSON :: AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
-> Value
toJSON
    AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails' {Maybe Text
Maybe (HashMap Text Text)
options :: Maybe (HashMap Text Text)
type' :: Maybe Text
$sel:options:AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails' :: AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
-> Maybe (HashMap Text Text)
$sel:type':AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails' :: AwsEcsTaskDefinitionContainerDefinitionsFirelensConfigurationDetails
-> Maybe Text
..} =
      [Pair] -> Value
Core.object
        ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
            [ (Text
"Type" 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
type',
              (Text
"Options" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
options
            ]
        )