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