{-# 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.SSMContacts.Types.Contact where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SSMContacts.Types.ContactType
data Contact = Contact'
{
Contact -> Maybe Text
displayName :: Prelude.Maybe Prelude.Text,
Contact -> Text
contactArn :: Prelude.Text,
Contact -> Text
alias :: Prelude.Text,
Contact -> ContactType
type' :: ContactType
}
deriving (Contact -> Contact -> Bool
(Contact -> Contact -> Bool)
-> (Contact -> Contact -> Bool) -> Eq Contact
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Contact -> Contact -> Bool
$c/= :: Contact -> Contact -> Bool
== :: Contact -> Contact -> Bool
$c== :: Contact -> Contact -> Bool
Prelude.Eq, ReadPrec [Contact]
ReadPrec Contact
Int -> ReadS Contact
ReadS [Contact]
(Int -> ReadS Contact)
-> ReadS [Contact]
-> ReadPrec Contact
-> ReadPrec [Contact]
-> Read Contact
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Contact]
$creadListPrec :: ReadPrec [Contact]
readPrec :: ReadPrec Contact
$creadPrec :: ReadPrec Contact
readList :: ReadS [Contact]
$creadList :: ReadS [Contact]
readsPrec :: Int -> ReadS Contact
$creadsPrec :: Int -> ReadS Contact
Prelude.Read, Int -> Contact -> ShowS
[Contact] -> ShowS
Contact -> String
(Int -> Contact -> ShowS)
-> (Contact -> String) -> ([Contact] -> ShowS) -> Show Contact
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Contact] -> ShowS
$cshowList :: [Contact] -> ShowS
show :: Contact -> String
$cshow :: Contact -> String
showsPrec :: Int -> Contact -> ShowS
$cshowsPrec :: Int -> Contact -> ShowS
Prelude.Show, (forall x. Contact -> Rep Contact x)
-> (forall x. Rep Contact x -> Contact) -> Generic Contact
forall x. Rep Contact x -> Contact
forall x. Contact -> Rep Contact x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Contact x -> Contact
$cfrom :: forall x. Contact -> Rep Contact x
Prelude.Generic)
newContact ::
Prelude.Text ->
Prelude.Text ->
ContactType ->
Contact
newContact :: Text -> Text -> ContactType -> Contact
newContact Text
pContactArn_ Text
pAlias_ ContactType
pType_ =
Contact' :: Maybe Text -> Text -> Text -> ContactType -> Contact
Contact'
{ $sel:displayName:Contact' :: Maybe Text
displayName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:contactArn:Contact' :: Text
contactArn = Text
pContactArn_,
$sel:alias:Contact' :: Text
alias = Text
pAlias_,
$sel:type':Contact' :: ContactType
type' = ContactType
pType_
}
contact_displayName :: Lens.Lens' Contact (Prelude.Maybe Prelude.Text)
contact_displayName :: (Maybe Text -> f (Maybe Text)) -> Contact -> f Contact
contact_displayName = (Contact -> Maybe Text)
-> (Contact -> Maybe Text -> Contact)
-> Lens Contact Contact (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Contact' {Maybe Text
displayName :: Maybe Text
$sel:displayName:Contact' :: Contact -> Maybe Text
displayName} -> Maybe Text
displayName) (\s :: Contact
s@Contact' {} Maybe Text
a -> Contact
s {$sel:displayName:Contact' :: Maybe Text
displayName = Maybe Text
a} :: Contact)
contact_contactArn :: Lens.Lens' Contact Prelude.Text
contact_contactArn :: (Text -> f Text) -> Contact -> f Contact
contact_contactArn = (Contact -> Text)
-> (Contact -> Text -> Contact) -> Lens Contact Contact Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Contact' {Text
contactArn :: Text
$sel:contactArn:Contact' :: Contact -> Text
contactArn} -> Text
contactArn) (\s :: Contact
s@Contact' {} Text
a -> Contact
s {$sel:contactArn:Contact' :: Text
contactArn = Text
a} :: Contact)
contact_alias :: Lens.Lens' Contact Prelude.Text
contact_alias :: (Text -> f Text) -> Contact -> f Contact
contact_alias = (Contact -> Text)
-> (Contact -> Text -> Contact) -> Lens Contact Contact Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Contact' {Text
alias :: Text
$sel:alias:Contact' :: Contact -> Text
alias} -> Text
alias) (\s :: Contact
s@Contact' {} Text
a -> Contact
s {$sel:alias:Contact' :: Text
alias = Text
a} :: Contact)
contact_type :: Lens.Lens' Contact ContactType
contact_type :: (ContactType -> f ContactType) -> Contact -> f Contact
contact_type = (Contact -> ContactType)
-> (Contact -> ContactType -> Contact)
-> Lens Contact Contact ContactType ContactType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Contact' {ContactType
type' :: ContactType
$sel:type':Contact' :: Contact -> ContactType
type'} -> ContactType
type') (\s :: Contact
s@Contact' {} ContactType
a -> Contact
s {$sel:type':Contact' :: ContactType
type' = ContactType
a} :: Contact)
instance Core.FromJSON Contact where
parseJSON :: Value -> Parser Contact
parseJSON =
String -> (Object -> Parser Contact) -> Value -> Parser Contact
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Contact"
( \Object
x ->
Maybe Text -> Text -> Text -> ContactType -> Contact
Contact'
(Maybe Text -> Text -> Text -> ContactType -> Contact)
-> Parser (Maybe Text)
-> Parser (Text -> Text -> ContactType -> Contact)
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
"DisplayName")
Parser (Text -> Text -> ContactType -> Contact)
-> Parser Text -> Parser (Text -> ContactType -> Contact)
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
"ContactArn")
Parser (Text -> ContactType -> Contact)
-> Parser Text -> Parser (ContactType -> Contact)
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
"Alias")
Parser (ContactType -> Contact)
-> Parser ContactType -> Parser Contact
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ContactType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Type")
)
instance Prelude.Hashable Contact
instance Prelude.NFData Contact