{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $sel:contactChannelId:SendActivationCode' :: Text
contactChannelId =
Text
pContactChannelId_
}
sendActivationCode_contactChannelId :: Lens.Lens' SendActivationCode Prelude.Text
sendActivationCode_contactChannelId :: Lens' SendActivationCode Text
sendActivationCode_contactChannelId = 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 :: (Service -> Service)
-> SendActivationCode -> Request SendActivationCode
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy SendActivationCode
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse SendActivationCode)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> SendActivationCodeResponse
SendActivationCodeResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable SendActivationCode where
hashWithSalt :: Int -> SendActivationCode -> Int
hashWithSalt Int
_salt SendActivationCode' {Text
contactChannelId :: Text
$sel:contactChannelId:SendActivationCode' :: SendActivationCode -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
contactChannelId
instance Prelude.NFData SendActivationCode where
rnf :: SendActivationCode -> ()
rnf SendActivationCode' {Text
contactChannelId :: Text
$sel:contactChannelId:SendActivationCode' :: SendActivationCode -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
contactChannelId
instance Data.ToHeaders SendActivationCode where
toHeaders :: SendActivationCode -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"SSMContacts.SendActivationCode" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON SendActivationCode where
toJSON :: SendActivationCode -> Value
toJSON SendActivationCode' {Text
contactChannelId :: Text
$sel:contactChannelId:SendActivationCode' :: SendActivationCode -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
(Key
"ContactChannelId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
contactChannelId)
]
)
instance Data.ToPath SendActivationCode where
toPath :: SendActivationCode -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery SendActivationCode where
toQuery :: SendActivationCode -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data SendActivationCodeResponse = SendActivationCodeResponse'
{
SendActivationCodeResponse -> Int
httpStatus :: Prelude.Int
}
deriving (SendActivationCodeResponse -> SendActivationCodeResponse -> Bool
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]
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
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.
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'
{ $sel:httpStatus:SendActivationCodeResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
sendActivationCodeResponse_httpStatus :: Lens.Lens' SendActivationCodeResponse Prelude.Int
sendActivationCodeResponse_httpStatus :: Lens' SendActivationCodeResponse Int
sendActivationCodeResponse_httpStatus = 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 where
rnf :: SendActivationCodeResponse -> ()
rnf SendActivationCodeResponse' {Int
httpStatus :: Int
$sel:httpStatus:SendActivationCodeResponse' :: SendActivationCodeResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus