{-# 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.ElasticSearch.Types.DomainInformation where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data DomainInformation = DomainInformation'
{ DomainInformation -> Maybe Text
ownerId :: Prelude.Maybe Prelude.Text,
DomainInformation -> Maybe Text
region :: Prelude.Maybe Prelude.Text,
DomainInformation -> Text
domainName :: Prelude.Text
}
deriving (DomainInformation -> DomainInformation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DomainInformation -> DomainInformation -> Bool
$c/= :: DomainInformation -> DomainInformation -> Bool
== :: DomainInformation -> DomainInformation -> Bool
$c== :: DomainInformation -> DomainInformation -> Bool
Prelude.Eq, ReadPrec [DomainInformation]
ReadPrec DomainInformation
Int -> ReadS DomainInformation
ReadS [DomainInformation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DomainInformation]
$creadListPrec :: ReadPrec [DomainInformation]
readPrec :: ReadPrec DomainInformation
$creadPrec :: ReadPrec DomainInformation
readList :: ReadS [DomainInformation]
$creadList :: ReadS [DomainInformation]
readsPrec :: Int -> ReadS DomainInformation
$creadsPrec :: Int -> ReadS DomainInformation
Prelude.Read, Int -> DomainInformation -> ShowS
[DomainInformation] -> ShowS
DomainInformation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DomainInformation] -> ShowS
$cshowList :: [DomainInformation] -> ShowS
show :: DomainInformation -> String
$cshow :: DomainInformation -> String
showsPrec :: Int -> DomainInformation -> ShowS
$cshowsPrec :: Int -> DomainInformation -> ShowS
Prelude.Show, forall x. Rep DomainInformation x -> DomainInformation
forall x. DomainInformation -> Rep DomainInformation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DomainInformation x -> DomainInformation
$cfrom :: forall x. DomainInformation -> Rep DomainInformation x
Prelude.Generic)
newDomainInformation ::
Prelude.Text ->
DomainInformation
newDomainInformation :: Text -> DomainInformation
newDomainInformation Text
pDomainName_ =
DomainInformation'
{ $sel:ownerId:DomainInformation' :: Maybe Text
ownerId = forall a. Maybe a
Prelude.Nothing,
$sel:region:DomainInformation' :: Maybe Text
region = forall a. Maybe a
Prelude.Nothing,
$sel:domainName:DomainInformation' :: Text
domainName = Text
pDomainName_
}
domainInformation_ownerId :: Lens.Lens' DomainInformation (Prelude.Maybe Prelude.Text)
domainInformation_ownerId :: Lens' DomainInformation (Maybe Text)
domainInformation_ownerId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainInformation' {Maybe Text
ownerId :: Maybe Text
$sel:ownerId:DomainInformation' :: DomainInformation -> Maybe Text
ownerId} -> Maybe Text
ownerId) (\s :: DomainInformation
s@DomainInformation' {} Maybe Text
a -> DomainInformation
s {$sel:ownerId:DomainInformation' :: Maybe Text
ownerId = Maybe Text
a} :: DomainInformation)
domainInformation_region :: Lens.Lens' DomainInformation (Prelude.Maybe Prelude.Text)
domainInformation_region :: Lens' DomainInformation (Maybe Text)
domainInformation_region = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainInformation' {Maybe Text
region :: Maybe Text
$sel:region:DomainInformation' :: DomainInformation -> Maybe Text
region} -> Maybe Text
region) (\s :: DomainInformation
s@DomainInformation' {} Maybe Text
a -> DomainInformation
s {$sel:region:DomainInformation' :: Maybe Text
region = Maybe Text
a} :: DomainInformation)
domainInformation_domainName :: Lens.Lens' DomainInformation Prelude.Text
domainInformation_domainName :: Lens' DomainInformation Text
domainInformation_domainName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainInformation' {Text
domainName :: Text
$sel:domainName:DomainInformation' :: DomainInformation -> Text
domainName} -> Text
domainName) (\s :: DomainInformation
s@DomainInformation' {} Text
a -> DomainInformation
s {$sel:domainName:DomainInformation' :: Text
domainName = Text
a} :: DomainInformation)
instance Data.FromJSON DomainInformation where
parseJSON :: Value -> Parser DomainInformation
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"DomainInformation"
( \Object
x ->
Maybe Text -> Maybe Text -> Text -> DomainInformation
DomainInformation'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"OwnerId")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Region")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"DomainName")
)
instance Prelude.Hashable DomainInformation where
hashWithSalt :: Int -> DomainInformation -> Int
hashWithSalt Int
_salt DomainInformation' {Maybe Text
Text
domainName :: Text
region :: Maybe Text
ownerId :: Maybe Text
$sel:domainName:DomainInformation' :: DomainInformation -> Text
$sel:region:DomainInformation' :: DomainInformation -> Maybe Text
$sel:ownerId:DomainInformation' :: DomainInformation -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
ownerId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
region
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
domainName
instance Prelude.NFData DomainInformation where
rnf :: DomainInformation -> ()
rnf DomainInformation' {Maybe Text
Text
domainName :: Text
region :: Maybe Text
ownerId :: Maybe Text
$sel:domainName:DomainInformation' :: DomainInformation -> Text
$sel:region:DomainInformation' :: DomainInformation -> Maybe Text
$sel:ownerId:DomainInformation' :: DomainInformation -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
ownerId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
region
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
domainName
instance Data.ToJSON DomainInformation where
toJSON :: DomainInformation -> Value
toJSON DomainInformation' {Maybe Text
Text
domainName :: Text
region :: Maybe Text
ownerId :: Maybe Text
$sel:domainName:DomainInformation' :: DomainInformation -> Text
$sel:region:DomainInformation' :: DomainInformation -> Maybe Text
$sel:ownerId:DomainInformation' :: DomainInformation -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"OwnerId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
ownerId,
(Key
"Region" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
region,
forall a. a -> Maybe a
Prelude.Just (Key
"DomainName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
domainName)
]
)