{-# 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.Snowball.Types.Ec2AmiResource where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Ec2AmiResource = Ec2AmiResource'
{
Ec2AmiResource -> Maybe Text
snowballAmiId :: Prelude.Maybe Prelude.Text,
Ec2AmiResource -> Text
amiId :: Prelude.Text
}
deriving (Ec2AmiResource -> Ec2AmiResource -> Bool
(Ec2AmiResource -> Ec2AmiResource -> Bool)
-> (Ec2AmiResource -> Ec2AmiResource -> Bool) -> Eq Ec2AmiResource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Ec2AmiResource -> Ec2AmiResource -> Bool
$c/= :: Ec2AmiResource -> Ec2AmiResource -> Bool
== :: Ec2AmiResource -> Ec2AmiResource -> Bool
$c== :: Ec2AmiResource -> Ec2AmiResource -> Bool
Prelude.Eq, ReadPrec [Ec2AmiResource]
ReadPrec Ec2AmiResource
Int -> ReadS Ec2AmiResource
ReadS [Ec2AmiResource]
(Int -> ReadS Ec2AmiResource)
-> ReadS [Ec2AmiResource]
-> ReadPrec Ec2AmiResource
-> ReadPrec [Ec2AmiResource]
-> Read Ec2AmiResource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Ec2AmiResource]
$creadListPrec :: ReadPrec [Ec2AmiResource]
readPrec :: ReadPrec Ec2AmiResource
$creadPrec :: ReadPrec Ec2AmiResource
readList :: ReadS [Ec2AmiResource]
$creadList :: ReadS [Ec2AmiResource]
readsPrec :: Int -> ReadS Ec2AmiResource
$creadsPrec :: Int -> ReadS Ec2AmiResource
Prelude.Read, Int -> Ec2AmiResource -> ShowS
[Ec2AmiResource] -> ShowS
Ec2AmiResource -> String
(Int -> Ec2AmiResource -> ShowS)
-> (Ec2AmiResource -> String)
-> ([Ec2AmiResource] -> ShowS)
-> Show Ec2AmiResource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Ec2AmiResource] -> ShowS
$cshowList :: [Ec2AmiResource] -> ShowS
show :: Ec2AmiResource -> String
$cshow :: Ec2AmiResource -> String
showsPrec :: Int -> Ec2AmiResource -> ShowS
$cshowsPrec :: Int -> Ec2AmiResource -> ShowS
Prelude.Show, (forall x. Ec2AmiResource -> Rep Ec2AmiResource x)
-> (forall x. Rep Ec2AmiResource x -> Ec2AmiResource)
-> Generic Ec2AmiResource
forall x. Rep Ec2AmiResource x -> Ec2AmiResource
forall x. Ec2AmiResource -> Rep Ec2AmiResource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Ec2AmiResource x -> Ec2AmiResource
$cfrom :: forall x. Ec2AmiResource -> Rep Ec2AmiResource x
Prelude.Generic)
newEc2AmiResource ::
Prelude.Text ->
Ec2AmiResource
newEc2AmiResource :: Text -> Ec2AmiResource
newEc2AmiResource Text
pAmiId_ =
Ec2AmiResource' :: Maybe Text -> Text -> Ec2AmiResource
Ec2AmiResource'
{ $sel:snowballAmiId:Ec2AmiResource' :: Maybe Text
snowballAmiId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:amiId:Ec2AmiResource' :: Text
amiId = Text
pAmiId_
}
ec2AmiResource_snowballAmiId :: Lens.Lens' Ec2AmiResource (Prelude.Maybe Prelude.Text)
ec2AmiResource_snowballAmiId :: (Maybe Text -> f (Maybe Text))
-> Ec2AmiResource -> f Ec2AmiResource
ec2AmiResource_snowballAmiId = (Ec2AmiResource -> Maybe Text)
-> (Ec2AmiResource -> Maybe Text -> Ec2AmiResource)
-> Lens Ec2AmiResource Ec2AmiResource (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Ec2AmiResource' {Maybe Text
snowballAmiId :: Maybe Text
$sel:snowballAmiId:Ec2AmiResource' :: Ec2AmiResource -> Maybe Text
snowballAmiId} -> Maybe Text
snowballAmiId) (\s :: Ec2AmiResource
s@Ec2AmiResource' {} Maybe Text
a -> Ec2AmiResource
s {$sel:snowballAmiId:Ec2AmiResource' :: Maybe Text
snowballAmiId = Maybe Text
a} :: Ec2AmiResource)
ec2AmiResource_amiId :: Lens.Lens' Ec2AmiResource Prelude.Text
ec2AmiResource_amiId :: (Text -> f Text) -> Ec2AmiResource -> f Ec2AmiResource
ec2AmiResource_amiId = (Ec2AmiResource -> Text)
-> (Ec2AmiResource -> Text -> Ec2AmiResource)
-> Lens Ec2AmiResource Ec2AmiResource Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Ec2AmiResource' {Text
amiId :: Text
$sel:amiId:Ec2AmiResource' :: Ec2AmiResource -> Text
amiId} -> Text
amiId) (\s :: Ec2AmiResource
s@Ec2AmiResource' {} Text
a -> Ec2AmiResource
s {$sel:amiId:Ec2AmiResource' :: Text
amiId = Text
a} :: Ec2AmiResource)
instance Core.FromJSON Ec2AmiResource where
parseJSON :: Value -> Parser Ec2AmiResource
parseJSON =
String
-> (Object -> Parser Ec2AmiResource)
-> Value
-> Parser Ec2AmiResource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Ec2AmiResource"
( \Object
x ->
Maybe Text -> Text -> Ec2AmiResource
Ec2AmiResource'
(Maybe Text -> Text -> Ec2AmiResource)
-> Parser (Maybe Text) -> Parser (Text -> Ec2AmiResource)
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
"SnowballAmiId")
Parser (Text -> Ec2AmiResource)
-> Parser Text -> Parser Ec2AmiResource
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
"AmiId")
)
instance Prelude.Hashable Ec2AmiResource
instance Prelude.NFData Ec2AmiResource
instance Core.ToJSON Ec2AmiResource where
toJSON :: Ec2AmiResource -> Value
toJSON Ec2AmiResource' {Maybe Text
Text
amiId :: Text
snowballAmiId :: Maybe Text
$sel:amiId:Ec2AmiResource' :: Ec2AmiResource -> Text
$sel:snowballAmiId:Ec2AmiResource' :: Ec2AmiResource -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"SnowballAmiId" 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
snowballAmiId,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"AmiId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
amiId)
]
)