{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.Account.GetAlternateContact
(
GetAlternateContact (..),
newGetAlternateContact,
getAlternateContact_accountId,
getAlternateContact_alternateContactType,
GetAlternateContactResponse (..),
newGetAlternateContactResponse,
getAlternateContactResponse_alternateContact,
getAlternateContactResponse_httpStatus,
)
where
import Amazonka.Account.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetAlternateContact = GetAlternateContact'
{
GetAlternateContact -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text,
GetAlternateContact -> AlternateContactType
alternateContactType :: AlternateContactType
}
deriving (GetAlternateContact -> GetAlternateContact -> Bool
(GetAlternateContact -> GetAlternateContact -> Bool)
-> (GetAlternateContact -> GetAlternateContact -> Bool)
-> Eq GetAlternateContact
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAlternateContact -> GetAlternateContact -> Bool
$c/= :: GetAlternateContact -> GetAlternateContact -> Bool
== :: GetAlternateContact -> GetAlternateContact -> Bool
$c== :: GetAlternateContact -> GetAlternateContact -> Bool
Prelude.Eq, ReadPrec [GetAlternateContact]
ReadPrec GetAlternateContact
Int -> ReadS GetAlternateContact
ReadS [GetAlternateContact]
(Int -> ReadS GetAlternateContact)
-> ReadS [GetAlternateContact]
-> ReadPrec GetAlternateContact
-> ReadPrec [GetAlternateContact]
-> Read GetAlternateContact
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAlternateContact]
$creadListPrec :: ReadPrec [GetAlternateContact]
readPrec :: ReadPrec GetAlternateContact
$creadPrec :: ReadPrec GetAlternateContact
readList :: ReadS [GetAlternateContact]
$creadList :: ReadS [GetAlternateContact]
readsPrec :: Int -> ReadS GetAlternateContact
$creadsPrec :: Int -> ReadS GetAlternateContact
Prelude.Read, Int -> GetAlternateContact -> ShowS
[GetAlternateContact] -> ShowS
GetAlternateContact -> String
(Int -> GetAlternateContact -> ShowS)
-> (GetAlternateContact -> String)
-> ([GetAlternateContact] -> ShowS)
-> Show GetAlternateContact
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAlternateContact] -> ShowS
$cshowList :: [GetAlternateContact] -> ShowS
show :: GetAlternateContact -> String
$cshow :: GetAlternateContact -> String
showsPrec :: Int -> GetAlternateContact -> ShowS
$cshowsPrec :: Int -> GetAlternateContact -> ShowS
Prelude.Show, (forall x. GetAlternateContact -> Rep GetAlternateContact x)
-> (forall x. Rep GetAlternateContact x -> GetAlternateContact)
-> Generic GetAlternateContact
forall x. Rep GetAlternateContact x -> GetAlternateContact
forall x. GetAlternateContact -> Rep GetAlternateContact x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetAlternateContact x -> GetAlternateContact
$cfrom :: forall x. GetAlternateContact -> Rep GetAlternateContact x
Prelude.Generic)
newGetAlternateContact ::
AlternateContactType ->
GetAlternateContact
newGetAlternateContact :: AlternateContactType -> GetAlternateContact
newGetAlternateContact AlternateContactType
pAlternateContactType_ =
GetAlternateContact' :: Maybe Text -> AlternateContactType -> GetAlternateContact
GetAlternateContact'
{ $sel:accountId:GetAlternateContact' :: Maybe Text
accountId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:alternateContactType:GetAlternateContact' :: AlternateContactType
alternateContactType = AlternateContactType
pAlternateContactType_
}
getAlternateContact_accountId :: Lens.Lens' GetAlternateContact (Prelude.Maybe Prelude.Text)
getAlternateContact_accountId :: (Maybe Text -> f (Maybe Text))
-> GetAlternateContact -> f GetAlternateContact
getAlternateContact_accountId = (GetAlternateContact -> Maybe Text)
-> (GetAlternateContact -> Maybe Text -> GetAlternateContact)
-> Lens
GetAlternateContact GetAlternateContact (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAlternateContact' {Maybe Text
accountId :: Maybe Text
$sel:accountId:GetAlternateContact' :: GetAlternateContact -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: GetAlternateContact
s@GetAlternateContact' {} Maybe Text
a -> GetAlternateContact
s {$sel:accountId:GetAlternateContact' :: Maybe Text
accountId = Maybe Text
a} :: GetAlternateContact)
getAlternateContact_alternateContactType :: Lens.Lens' GetAlternateContact AlternateContactType
getAlternateContact_alternateContactType :: (AlternateContactType -> f AlternateContactType)
-> GetAlternateContact -> f GetAlternateContact
getAlternateContact_alternateContactType = (GetAlternateContact -> AlternateContactType)
-> (GetAlternateContact
-> AlternateContactType -> GetAlternateContact)
-> Lens
GetAlternateContact
GetAlternateContact
AlternateContactType
AlternateContactType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAlternateContact' {AlternateContactType
alternateContactType :: AlternateContactType
$sel:alternateContactType:GetAlternateContact' :: GetAlternateContact -> AlternateContactType
alternateContactType} -> AlternateContactType
alternateContactType) (\s :: GetAlternateContact
s@GetAlternateContact' {} AlternateContactType
a -> GetAlternateContact
s {$sel:alternateContactType:GetAlternateContact' :: AlternateContactType
alternateContactType = AlternateContactType
a} :: GetAlternateContact)
instance Core.AWSRequest GetAlternateContact where
type
AWSResponse GetAlternateContact =
GetAlternateContactResponse
request :: GetAlternateContact -> Request GetAlternateContact
request = Service -> GetAlternateContact -> Request GetAlternateContact
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetAlternateContact
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetAlternateContact)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetAlternateContact))
-> Logger
-> Service
-> Proxy GetAlternateContact
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetAlternateContact)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe AlternateContact -> Int -> GetAlternateContactResponse
GetAlternateContactResponse'
(Maybe AlternateContact -> Int -> GetAlternateContactResponse)
-> Either String (Maybe AlternateContact)
-> Either String (Int -> GetAlternateContactResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe AlternateContact)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"AlternateContact")
Either String (Int -> GetAlternateContactResponse)
-> Either String Int -> Either String GetAlternateContactResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetAlternateContact
instance Prelude.NFData GetAlternateContact
instance Core.ToHeaders GetAlternateContact where
toHeaders :: GetAlternateContact -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetAlternateContact -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON GetAlternateContact where
toJSON :: GetAlternateContact -> Value
toJSON GetAlternateContact' {Maybe Text
AlternateContactType
alternateContactType :: AlternateContactType
accountId :: Maybe Text
$sel:alternateContactType:GetAlternateContact' :: GetAlternateContact -> AlternateContactType
$sel:accountId:GetAlternateContact' :: GetAlternateContact -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"AccountId" 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
accountId,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"AlternateContactType"
Text -> AlternateContactType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= AlternateContactType
alternateContactType
)
]
)
instance Core.ToPath GetAlternateContact where
toPath :: GetAlternateContact -> ByteString
toPath = ByteString -> GetAlternateContact -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/getAlternateContact"
instance Core.ToQuery GetAlternateContact where
toQuery :: GetAlternateContact -> QueryString
toQuery = QueryString -> GetAlternateContact -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetAlternateContactResponse = GetAlternateContactResponse'
{
GetAlternateContactResponse -> Maybe AlternateContact
alternateContact :: Prelude.Maybe AlternateContact,
GetAlternateContactResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetAlternateContactResponse -> GetAlternateContactResponse -> Bool
(GetAlternateContactResponse
-> GetAlternateContactResponse -> Bool)
-> (GetAlternateContactResponse
-> GetAlternateContactResponse -> Bool)
-> Eq GetAlternateContactResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAlternateContactResponse -> GetAlternateContactResponse -> Bool
$c/= :: GetAlternateContactResponse -> GetAlternateContactResponse -> Bool
== :: GetAlternateContactResponse -> GetAlternateContactResponse -> Bool
$c== :: GetAlternateContactResponse -> GetAlternateContactResponse -> Bool
Prelude.Eq, Int -> GetAlternateContactResponse -> ShowS
[GetAlternateContactResponse] -> ShowS
GetAlternateContactResponse -> String
(Int -> GetAlternateContactResponse -> ShowS)
-> (GetAlternateContactResponse -> String)
-> ([GetAlternateContactResponse] -> ShowS)
-> Show GetAlternateContactResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAlternateContactResponse] -> ShowS
$cshowList :: [GetAlternateContactResponse] -> ShowS
show :: GetAlternateContactResponse -> String
$cshow :: GetAlternateContactResponse -> String
showsPrec :: Int -> GetAlternateContactResponse -> ShowS
$cshowsPrec :: Int -> GetAlternateContactResponse -> ShowS
Prelude.Show, (forall x.
GetAlternateContactResponse -> Rep GetAlternateContactResponse x)
-> (forall x.
Rep GetAlternateContactResponse x -> GetAlternateContactResponse)
-> Generic GetAlternateContactResponse
forall x.
Rep GetAlternateContactResponse x -> GetAlternateContactResponse
forall x.
GetAlternateContactResponse -> Rep GetAlternateContactResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetAlternateContactResponse x -> GetAlternateContactResponse
$cfrom :: forall x.
GetAlternateContactResponse -> Rep GetAlternateContactResponse x
Prelude.Generic)
newGetAlternateContactResponse ::
Prelude.Int ->
GetAlternateContactResponse
newGetAlternateContactResponse :: Int -> GetAlternateContactResponse
newGetAlternateContactResponse Int
pHttpStatus_ =
GetAlternateContactResponse' :: Maybe AlternateContact -> Int -> GetAlternateContactResponse
GetAlternateContactResponse'
{ $sel:alternateContact:GetAlternateContactResponse' :: Maybe AlternateContact
alternateContact =
Maybe AlternateContact
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetAlternateContactResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getAlternateContactResponse_alternateContact :: Lens.Lens' GetAlternateContactResponse (Prelude.Maybe AlternateContact)
getAlternateContactResponse_alternateContact :: (Maybe AlternateContact -> f (Maybe AlternateContact))
-> GetAlternateContactResponse -> f GetAlternateContactResponse
getAlternateContactResponse_alternateContact = (GetAlternateContactResponse -> Maybe AlternateContact)
-> (GetAlternateContactResponse
-> Maybe AlternateContact -> GetAlternateContactResponse)
-> Lens
GetAlternateContactResponse
GetAlternateContactResponse
(Maybe AlternateContact)
(Maybe AlternateContact)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAlternateContactResponse' {Maybe AlternateContact
alternateContact :: Maybe AlternateContact
$sel:alternateContact:GetAlternateContactResponse' :: GetAlternateContactResponse -> Maybe AlternateContact
alternateContact} -> Maybe AlternateContact
alternateContact) (\s :: GetAlternateContactResponse
s@GetAlternateContactResponse' {} Maybe AlternateContact
a -> GetAlternateContactResponse
s {$sel:alternateContact:GetAlternateContactResponse' :: Maybe AlternateContact
alternateContact = Maybe AlternateContact
a} :: GetAlternateContactResponse)
getAlternateContactResponse_httpStatus :: Lens.Lens' GetAlternateContactResponse Prelude.Int
getAlternateContactResponse_httpStatus :: (Int -> f Int)
-> GetAlternateContactResponse -> f GetAlternateContactResponse
getAlternateContactResponse_httpStatus = (GetAlternateContactResponse -> Int)
-> (GetAlternateContactResponse
-> Int -> GetAlternateContactResponse)
-> Lens
GetAlternateContactResponse GetAlternateContactResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAlternateContactResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetAlternateContactResponse' :: GetAlternateContactResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetAlternateContactResponse
s@GetAlternateContactResponse' {} Int
a -> GetAlternateContactResponse
s {$sel:httpStatus:GetAlternateContactResponse' :: Int
httpStatus = Int
a} :: GetAlternateContactResponse)
instance Prelude.NFData GetAlternateContactResponse