{-# 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.SSMContacts.SendActivationCode
(
SendActivationCode (..),
newSendActivationCode,
sendActivationCode_contactChannelId,
SendActivationCodeResponse (..),
newSendActivationCodeResponse,
sendActivationCodeResponse_httpStatus,
)
where
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
import Amazonka.SSMContacts.Types
data SendActivationCode = SendActivationCode'
{
SendActivationCode -> Text
contactChannelId :: Prelude.Text
}
deriving (SendActivationCode -> SendActivationCode -> Bool
(SendActivationCode -> SendActivationCode -> Bool)
-> (SendActivationCode -> SendActivationCode -> Bool)
-> Eq SendActivationCode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SendActivationCode -> SendActivationCode -> Bool
$c/= :: SendActivationCode -> SendActivationCode -> Bool
== :: SendActivationCode -> SendActivationCode -> Bool
$c== :: SendActivationCode -> SendActivationCode -> Bool
Prelude.Eq, ReadPrec [SendActivationCode]
ReadPrec SendActivationCode
Int -> ReadS SendActivationCode
ReadS [SendActivationCode]
(Int -> ReadS SendActivationCode)
-> ReadS [SendActivationCode]
-> ReadPrec SendActivationCode
-> ReadPrec [SendActivationCode]
-> Read SendActivationCode
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SendActivationCode]
$creadListPrec :: ReadPrec [SendActivationCode]
readPrec :: ReadPrec SendActivationCode
$creadPrec :: ReadPrec SendActivationCode
readList :: ReadS [SendActivationCode]
$creadList :: ReadS [SendActivationCode]
readsPrec :: Int -> ReadS SendActivationCode
$creadsPrec :: Int -> ReadS SendActivationCode
Prelude.Read, Int -> SendActivationCode -> ShowS
[SendActivationCode] -> ShowS
SendActivationCode -> String
(Int -> SendActivationCode -> ShowS)
-> (SendActivationCode -> String)
-> ([SendActivationCode] -> ShowS)
-> Show SendActivationCode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SendActivationCode] -> ShowS
$cshowList :: [SendActivationCode] -> ShowS
show :: SendActivationCode -> String
$cshow :: SendActivationCode -> String
showsPrec :: Int -> SendActivationCode -> ShowS
$cshowsPrec :: Int -> SendActivationCode -> ShowS
Prelude.Show, (forall x. SendActivationCode -> Rep SendActivationCode x)
-> (forall x. Rep SendActivationCode x -> SendActivationCode)
-> Generic SendActivationCode
forall x. Rep SendActivationCode x -> SendActivationCode
forall x. SendActivationCode -> Rep SendActivationCode x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SendActivationCode x -> SendActivationCode
$cfrom :: forall x. SendActivationCode -> Rep SendActivationCode x
Prelude.Generic)
newSendActivationCode ::
Prelude.Text ->
SendActivationCode
newSendActivationCode :: Text -> SendActivationCode
newSendActivationCode Text
pContactChannelId_ =
SendActivationCode' :: Text -> SendActivationCode
SendActivationCode'
{ $sel:contactChannelId:SendActivationCode' :: Text
contactChannelId =
Text
pContactChannelId_
}
sendActivationCode_contactChannelId :: Lens.Lens' SendActivationCode Prelude.Text
sendActivationCode_contactChannelId :: (Text -> f Text) -> SendActivationCode -> f SendActivationCode
sendActivationCode_contactChannelId = (SendActivationCode -> Text)
-> (SendActivationCode -> Text -> SendActivationCode)
-> Lens SendActivationCode SendActivationCode Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendActivationCode' {Text
contactChannelId :: Text
$sel:contactChannelId:SendActivationCode' :: SendActivationCode -> Text
contactChannelId} -> Text
contactChannelId) (\s :: SendActivationCode
s@SendActivationCode' {} Text
a -> SendActivationCode
s {$sel:contactChannelId:SendActivationCode' :: Text
contactChannelId = Text
a} :: SendActivationCode)
instance Core.AWSRequest SendActivationCode where
type
AWSResponse SendActivationCode =
SendActivationCodeResponse
request :: SendActivationCode -> Request SendActivationCode
request = Service -> SendActivationCode -> Request SendActivationCode
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy SendActivationCode
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse SendActivationCode)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse SendActivationCode))
-> Logger
-> Service
-> Proxy SendActivationCode
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse SendActivationCode)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> SendActivationCodeResponse
SendActivationCodeResponse'
(Int -> SendActivationCodeResponse)
-> Either String Int -> Either String SendActivationCodeResponse
forall (f :: * -> *) a b. Functor 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 SendActivationCode
instance Prelude.NFData SendActivationCode
instance Core.ToHeaders SendActivationCode where
toHeaders :: SendActivationCode -> ResponseHeaders
toHeaders =
ResponseHeaders -> SendActivationCode -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"SSMContacts.SendActivationCode" ::
Prelude.ByteString
),
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 SendActivationCode where
toJSON :: SendActivationCode -> Value
toJSON SendActivationCode' {Text
contactChannelId :: Text
$sel:contactChannelId:SendActivationCode' :: SendActivationCode -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"ContactChannelId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
contactChannelId)
]
)
instance Core.ToPath SendActivationCode where
toPath :: SendActivationCode -> ByteString
toPath = ByteString -> SendActivationCode -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery SendActivationCode where
toQuery :: SendActivationCode -> QueryString
toQuery = QueryString -> SendActivationCode -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data SendActivationCodeResponse = SendActivationCodeResponse'
{
SendActivationCodeResponse -> Int
httpStatus :: Prelude.Int
}
deriving (SendActivationCodeResponse -> SendActivationCodeResponse -> Bool
(SendActivationCodeResponse -> SendActivationCodeResponse -> Bool)
-> (SendActivationCodeResponse
-> SendActivationCodeResponse -> Bool)
-> Eq SendActivationCodeResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SendActivationCodeResponse -> SendActivationCodeResponse -> Bool
$c/= :: SendActivationCodeResponse -> SendActivationCodeResponse -> Bool
== :: SendActivationCodeResponse -> SendActivationCodeResponse -> Bool
$c== :: SendActivationCodeResponse -> SendActivationCodeResponse -> Bool
Prelude.Eq, ReadPrec [SendActivationCodeResponse]
ReadPrec SendActivationCodeResponse
Int -> ReadS SendActivationCodeResponse
ReadS [SendActivationCodeResponse]
(Int -> ReadS SendActivationCodeResponse)
-> ReadS [SendActivationCodeResponse]
-> ReadPrec SendActivationCodeResponse
-> ReadPrec [SendActivationCodeResponse]
-> Read SendActivationCodeResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SendActivationCodeResponse]
$creadListPrec :: ReadPrec [SendActivationCodeResponse]
readPrec :: ReadPrec SendActivationCodeResponse
$creadPrec :: ReadPrec SendActivationCodeResponse
readList :: ReadS [SendActivationCodeResponse]
$creadList :: ReadS [SendActivationCodeResponse]
readsPrec :: Int -> ReadS SendActivationCodeResponse
$creadsPrec :: Int -> ReadS SendActivationCodeResponse
Prelude.Read, Int -> SendActivationCodeResponse -> ShowS
[SendActivationCodeResponse] -> ShowS
SendActivationCodeResponse -> String
(Int -> SendActivationCodeResponse -> ShowS)
-> (SendActivationCodeResponse -> String)
-> ([SendActivationCodeResponse] -> ShowS)
-> Show SendActivationCodeResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SendActivationCodeResponse] -> ShowS
$cshowList :: [SendActivationCodeResponse] -> ShowS
show :: SendActivationCodeResponse -> String
$cshow :: SendActivationCodeResponse -> String
showsPrec :: Int -> SendActivationCodeResponse -> ShowS
$cshowsPrec :: Int -> SendActivationCodeResponse -> ShowS
Prelude.Show, (forall x.
SendActivationCodeResponse -> Rep SendActivationCodeResponse x)
-> (forall x.
Rep SendActivationCodeResponse x -> SendActivationCodeResponse)
-> Generic SendActivationCodeResponse
forall x.
Rep SendActivationCodeResponse x -> SendActivationCodeResponse
forall x.
SendActivationCodeResponse -> Rep SendActivationCodeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SendActivationCodeResponse x -> SendActivationCodeResponse
$cfrom :: forall x.
SendActivationCodeResponse -> Rep SendActivationCodeResponse x
Prelude.Generic)
newSendActivationCodeResponse ::
Prelude.Int ->
SendActivationCodeResponse
newSendActivationCodeResponse :: Int -> SendActivationCodeResponse
newSendActivationCodeResponse Int
pHttpStatus_ =
SendActivationCodeResponse' :: Int -> SendActivationCodeResponse
SendActivationCodeResponse'
{ $sel:httpStatus:SendActivationCodeResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
sendActivationCodeResponse_httpStatus :: Lens.Lens' SendActivationCodeResponse Prelude.Int
sendActivationCodeResponse_httpStatus :: (Int -> f Int)
-> SendActivationCodeResponse -> f SendActivationCodeResponse
sendActivationCodeResponse_httpStatus = (SendActivationCodeResponse -> Int)
-> (SendActivationCodeResponse
-> Int -> SendActivationCodeResponse)
-> Lens
SendActivationCodeResponse SendActivationCodeResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendActivationCodeResponse' {Int
httpStatus :: Int
$sel:httpStatus:SendActivationCodeResponse' :: SendActivationCodeResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: SendActivationCodeResponse
s@SendActivationCodeResponse' {} Int
a -> SendActivationCodeResponse
s {$sel:httpStatus:SendActivationCodeResponse' :: Int
httpStatus = Int
a} :: SendActivationCodeResponse)
instance Prelude.NFData SendActivationCodeResponse