{-# 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.EMRContainers.Types.Configuration where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Configuration = Configuration'
{
Configuration -> Maybe [Configuration]
configurations :: Prelude.Maybe [Configuration],
Configuration -> Maybe (Sensitive (HashMap Text Text))
properties :: Prelude.Maybe (Core.Sensitive (Prelude.HashMap Prelude.Text Prelude.Text)),
Configuration -> Text
classification :: Prelude.Text
}
deriving (Configuration -> Configuration -> Bool
(Configuration -> Configuration -> Bool)
-> (Configuration -> Configuration -> Bool) -> Eq Configuration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Configuration -> Configuration -> Bool
$c/= :: Configuration -> Configuration -> Bool
== :: Configuration -> Configuration -> Bool
$c== :: Configuration -> Configuration -> Bool
Prelude.Eq, Int -> Configuration -> ShowS
[Configuration] -> ShowS
Configuration -> String
(Int -> Configuration -> ShowS)
-> (Configuration -> String)
-> ([Configuration] -> ShowS)
-> Show Configuration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Configuration] -> ShowS
$cshowList :: [Configuration] -> ShowS
show :: Configuration -> String
$cshow :: Configuration -> String
showsPrec :: Int -> Configuration -> ShowS
$cshowsPrec :: Int -> Configuration -> ShowS
Prelude.Show, (forall x. Configuration -> Rep Configuration x)
-> (forall x. Rep Configuration x -> Configuration)
-> Generic Configuration
forall x. Rep Configuration x -> Configuration
forall x. Configuration -> Rep Configuration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Configuration x -> Configuration
$cfrom :: forall x. Configuration -> Rep Configuration x
Prelude.Generic)
newConfiguration ::
Prelude.Text ->
Configuration
newConfiguration :: Text -> Configuration
newConfiguration Text
pClassification_ =
Configuration' :: Maybe [Configuration]
-> Maybe (Sensitive (HashMap Text Text)) -> Text -> Configuration
Configuration'
{ $sel:configurations:Configuration' :: Maybe [Configuration]
configurations = Maybe [Configuration]
forall a. Maybe a
Prelude.Nothing,
$sel:properties:Configuration' :: Maybe (Sensitive (HashMap Text Text))
properties = Maybe (Sensitive (HashMap Text Text))
forall a. Maybe a
Prelude.Nothing,
$sel:classification:Configuration' :: Text
classification = Text
pClassification_
}
configuration_configurations :: Lens.Lens' Configuration (Prelude.Maybe [Configuration])
configuration_configurations :: (Maybe [Configuration] -> f (Maybe [Configuration]))
-> Configuration -> f Configuration
configuration_configurations = (Configuration -> Maybe [Configuration])
-> (Configuration -> Maybe [Configuration] -> Configuration)
-> Lens
Configuration
Configuration
(Maybe [Configuration])
(Maybe [Configuration])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Configuration' {Maybe [Configuration]
configurations :: Maybe [Configuration]
$sel:configurations:Configuration' :: Configuration -> Maybe [Configuration]
configurations} -> Maybe [Configuration]
configurations) (\s :: Configuration
s@Configuration' {} Maybe [Configuration]
a -> Configuration
s {$sel:configurations:Configuration' :: Maybe [Configuration]
configurations = Maybe [Configuration]
a} :: Configuration) ((Maybe [Configuration] -> f (Maybe [Configuration]))
-> Configuration -> f Configuration)
-> ((Maybe [Configuration] -> f (Maybe [Configuration]))
-> Maybe [Configuration] -> f (Maybe [Configuration]))
-> (Maybe [Configuration] -> f (Maybe [Configuration]))
-> Configuration
-> f Configuration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[Configuration] [Configuration] [Configuration] [Configuration]
-> Iso
(Maybe [Configuration])
(Maybe [Configuration])
(Maybe [Configuration])
(Maybe [Configuration])
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
[Configuration] [Configuration] [Configuration] [Configuration]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
configuration_properties :: Lens.Lens' Configuration (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
configuration_properties :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Configuration -> f Configuration
configuration_properties = (Configuration -> Maybe (Sensitive (HashMap Text Text)))
-> (Configuration
-> Maybe (Sensitive (HashMap Text Text)) -> Configuration)
-> Lens
Configuration
Configuration
(Maybe (Sensitive (HashMap Text Text)))
(Maybe (Sensitive (HashMap Text Text)))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Configuration' {Maybe (Sensitive (HashMap Text Text))
properties :: Maybe (Sensitive (HashMap Text Text))
$sel:properties:Configuration' :: Configuration -> Maybe (Sensitive (HashMap Text Text))
properties} -> Maybe (Sensitive (HashMap Text Text))
properties) (\s :: Configuration
s@Configuration' {} Maybe (Sensitive (HashMap Text Text))
a -> Configuration
s {$sel:properties:Configuration' :: Maybe (Sensitive (HashMap Text Text))
properties = Maybe (Sensitive (HashMap Text Text))
a} :: Configuration) ((Maybe (Sensitive (HashMap Text Text))
-> f (Maybe (Sensitive (HashMap Text Text))))
-> Configuration -> f Configuration)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (Sensitive (HashMap Text Text))
-> f (Maybe (Sensitive (HashMap Text Text))))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Configuration
-> f Configuration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(Sensitive (HashMap Text Text))
(Sensitive (HashMap Text Text))
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (Sensitive (HashMap Text Text)))
(Maybe (Sensitive (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
(Sensitive (HashMap Text Text))
(Sensitive (HashMap Text Text))
(HashMap Text Text)
(HashMap Text Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive AnIso
(Sensitive (HashMap Text Text))
(Sensitive (HashMap Text Text))
(HashMap Text Text)
(HashMap Text Text)
-> (Exchange
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(Identity (HashMap Text Text))
-> Exchange
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(Identity (HashMap Text Text)))
-> AnIso
(Sensitive (HashMap Text Text))
(Sensitive (HashMap Text Text))
(HashMap Text Text)
(HashMap Text Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Exchange
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(Identity (HashMap Text Text))
-> Exchange
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(Identity (HashMap Text Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced)
configuration_classification :: Lens.Lens' Configuration Prelude.Text
configuration_classification :: (Text -> f Text) -> Configuration -> f Configuration
configuration_classification = (Configuration -> Text)
-> (Configuration -> Text -> Configuration)
-> Lens Configuration Configuration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Configuration' {Text
classification :: Text
$sel:classification:Configuration' :: Configuration -> Text
classification} -> Text
classification) (\s :: Configuration
s@Configuration' {} Text
a -> Configuration
s {$sel:classification:Configuration' :: Text
classification = Text
a} :: Configuration)
instance Core.FromJSON Configuration where
parseJSON :: Value -> Parser Configuration
parseJSON =
String
-> (Object -> Parser Configuration)
-> Value
-> Parser Configuration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Configuration"
( \Object
x ->
Maybe [Configuration]
-> Maybe (Sensitive (HashMap Text Text)) -> Text -> Configuration
Configuration'
(Maybe [Configuration]
-> Maybe (Sensitive (HashMap Text Text)) -> Text -> Configuration)
-> Parser (Maybe [Configuration])
-> Parser
(Maybe (Sensitive (HashMap Text Text)) -> Text -> Configuration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [Configuration]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"configurations" Parser (Maybe (Maybe [Configuration]))
-> Maybe [Configuration] -> Parser (Maybe [Configuration])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Configuration]
forall a. Monoid a => a
Prelude.mempty)
Parser
(Maybe (Sensitive (HashMap Text Text)) -> Text -> Configuration)
-> Parser (Maybe (Sensitive (HashMap Text Text)))
-> Parser (Text -> Configuration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Parser (Maybe (Maybe (Sensitive (HashMap Text Text))))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"properties" Parser (Maybe (Maybe (Sensitive (HashMap Text Text))))
-> Maybe (Sensitive (HashMap Text Text))
-> Parser (Maybe (Sensitive (HashMap Text Text)))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (Sensitive (HashMap Text Text))
forall a. Monoid a => a
Prelude.mempty)
Parser (Text -> Configuration)
-> Parser Text -> Parser Configuration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"classification")
)
instance Prelude.Hashable Configuration
instance Prelude.NFData Configuration
instance Core.ToJSON Configuration where
toJSON :: Configuration -> Value
toJSON Configuration' {Maybe [Configuration]
Maybe (Sensitive (HashMap Text Text))
Text
classification :: Text
properties :: Maybe (Sensitive (HashMap Text Text))
configurations :: Maybe [Configuration]
$sel:classification:Configuration' :: Configuration -> Text
$sel:properties:Configuration' :: Configuration -> Maybe (Sensitive (HashMap Text Text))
$sel:configurations:Configuration' :: Configuration -> Maybe [Configuration]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"configurations" Text -> [Configuration] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([Configuration] -> Pair) -> Maybe [Configuration] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Configuration]
configurations,
(Text
"properties" Text -> Sensitive (HashMap Text Text) -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive (HashMap Text Text) -> Pair)
-> Maybe (Sensitive (HashMap Text Text)) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive (HashMap Text Text))
properties,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"classification" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
classification)
]
)