{-# 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 #-}
module Amazonka.ECS.Types.FirelensConfiguration where
import qualified Amazonka.Core as Core
import Amazonka.ECS.Types.FirelensConfigurationType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data FirelensConfiguration = FirelensConfiguration'
{
FirelensConfiguration -> Maybe (HashMap Text Text)
options :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
FirelensConfiguration -> FirelensConfigurationType
type' :: FirelensConfigurationType
}
deriving (FirelensConfiguration -> FirelensConfiguration -> Bool
(FirelensConfiguration -> FirelensConfiguration -> Bool)
-> (FirelensConfiguration -> FirelensConfiguration -> Bool)
-> Eq FirelensConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FirelensConfiguration -> FirelensConfiguration -> Bool
$c/= :: FirelensConfiguration -> FirelensConfiguration -> Bool
== :: FirelensConfiguration -> FirelensConfiguration -> Bool
$c== :: FirelensConfiguration -> FirelensConfiguration -> Bool
Prelude.Eq, ReadPrec [FirelensConfiguration]
ReadPrec FirelensConfiguration
Int -> ReadS FirelensConfiguration
ReadS [FirelensConfiguration]
(Int -> ReadS FirelensConfiguration)
-> ReadS [FirelensConfiguration]
-> ReadPrec FirelensConfiguration
-> ReadPrec [FirelensConfiguration]
-> Read FirelensConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FirelensConfiguration]
$creadListPrec :: ReadPrec [FirelensConfiguration]
readPrec :: ReadPrec FirelensConfiguration
$creadPrec :: ReadPrec FirelensConfiguration
readList :: ReadS [FirelensConfiguration]
$creadList :: ReadS [FirelensConfiguration]
readsPrec :: Int -> ReadS FirelensConfiguration
$creadsPrec :: Int -> ReadS FirelensConfiguration
Prelude.Read, Int -> FirelensConfiguration -> ShowS
[FirelensConfiguration] -> ShowS
FirelensConfiguration -> String
(Int -> FirelensConfiguration -> ShowS)
-> (FirelensConfiguration -> String)
-> ([FirelensConfiguration] -> ShowS)
-> Show FirelensConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FirelensConfiguration] -> ShowS
$cshowList :: [FirelensConfiguration] -> ShowS
show :: FirelensConfiguration -> String
$cshow :: FirelensConfiguration -> String
showsPrec :: Int -> FirelensConfiguration -> ShowS
$cshowsPrec :: Int -> FirelensConfiguration -> ShowS
Prelude.Show, (forall x. FirelensConfiguration -> Rep FirelensConfiguration x)
-> (forall x. Rep FirelensConfiguration x -> FirelensConfiguration)
-> Generic FirelensConfiguration
forall x. Rep FirelensConfiguration x -> FirelensConfiguration
forall x. FirelensConfiguration -> Rep FirelensConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FirelensConfiguration x -> FirelensConfiguration
$cfrom :: forall x. FirelensConfiguration -> Rep FirelensConfiguration x
Prelude.Generic)
newFirelensConfiguration ::
FirelensConfigurationType ->
FirelensConfiguration
newFirelensConfiguration :: FirelensConfigurationType -> FirelensConfiguration
newFirelensConfiguration FirelensConfigurationType
pType_ =
FirelensConfiguration' :: Maybe (HashMap Text Text)
-> FirelensConfigurationType -> FirelensConfiguration
FirelensConfiguration'
{ $sel:options:FirelensConfiguration' :: Maybe (HashMap Text Text)
options = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:type':FirelensConfiguration' :: FirelensConfigurationType
type' = FirelensConfigurationType
pType_
}
firelensConfiguration_options :: Lens.Lens' FirelensConfiguration (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
firelensConfiguration_options :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> FirelensConfiguration -> f FirelensConfiguration
firelensConfiguration_options = (FirelensConfiguration -> Maybe (HashMap Text Text))
-> (FirelensConfiguration
-> Maybe (HashMap Text Text) -> FirelensConfiguration)
-> Lens
FirelensConfiguration
FirelensConfiguration
(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 (\FirelensConfiguration' {Maybe (HashMap Text Text)
options :: Maybe (HashMap Text Text)
$sel:options:FirelensConfiguration' :: FirelensConfiguration -> Maybe (HashMap Text Text)
options} -> Maybe (HashMap Text Text)
options) (\s :: FirelensConfiguration
s@FirelensConfiguration' {} Maybe (HashMap Text Text)
a -> FirelensConfiguration
s {$sel:options:FirelensConfiguration' :: Maybe (HashMap Text Text)
options = Maybe (HashMap Text Text)
a} :: FirelensConfiguration) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> FirelensConfiguration -> f FirelensConfiguration)
-> ((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)))
-> FirelensConfiguration
-> f FirelensConfiguration
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
firelensConfiguration_type :: Lens.Lens' FirelensConfiguration FirelensConfigurationType
firelensConfiguration_type :: (FirelensConfigurationType -> f FirelensConfigurationType)
-> FirelensConfiguration -> f FirelensConfiguration
firelensConfiguration_type = (FirelensConfiguration -> FirelensConfigurationType)
-> (FirelensConfiguration
-> FirelensConfigurationType -> FirelensConfiguration)
-> Lens
FirelensConfiguration
FirelensConfiguration
FirelensConfigurationType
FirelensConfigurationType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FirelensConfiguration' {FirelensConfigurationType
type' :: FirelensConfigurationType
$sel:type':FirelensConfiguration' :: FirelensConfiguration -> FirelensConfigurationType
type'} -> FirelensConfigurationType
type') (\s :: FirelensConfiguration
s@FirelensConfiguration' {} FirelensConfigurationType
a -> FirelensConfiguration
s {$sel:type':FirelensConfiguration' :: FirelensConfigurationType
type' = FirelensConfigurationType
a} :: FirelensConfiguration)
instance Core.FromJSON FirelensConfiguration where
parseJSON :: Value -> Parser FirelensConfiguration
parseJSON =
String
-> (Object -> Parser FirelensConfiguration)
-> Value
-> Parser FirelensConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"FirelensConfiguration"
( \Object
x ->
Maybe (HashMap Text Text)
-> FirelensConfigurationType -> FirelensConfiguration
FirelensConfiguration'
(Maybe (HashMap Text Text)
-> FirelensConfigurationType -> FirelensConfiguration)
-> Parser (Maybe (HashMap Text Text))
-> Parser (FirelensConfigurationType -> FirelensConfiguration)
forall (f :: * -> *) a b. Functor 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)
Parser (FirelensConfigurationType -> FirelensConfiguration)
-> Parser FirelensConfigurationType -> Parser FirelensConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser FirelensConfigurationType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"type")
)
instance Prelude.Hashable FirelensConfiguration
instance Prelude.NFData FirelensConfiguration
instance Core.ToJSON FirelensConfiguration where
toJSON :: FirelensConfiguration -> Value
toJSON FirelensConfiguration' {Maybe (HashMap Text Text)
FirelensConfigurationType
type' :: FirelensConfigurationType
options :: Maybe (HashMap Text Text)
$sel:type':FirelensConfiguration' :: FirelensConfiguration -> FirelensConfigurationType
$sel:options:FirelensConfiguration' :: FirelensConfiguration -> Maybe (HashMap Text Text)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (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,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"type" Text -> FirelensConfigurationType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= FirelensConfigurationType
type')
]
)