{-# 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.ActivateContactChannel
(
ActivateContactChannel (..),
newActivateContactChannel,
activateContactChannel_contactChannelId,
activateContactChannel_activationCode,
ActivateContactChannelResponse (..),
newActivateContactChannelResponse,
activateContactChannelResponse_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 ActivateContactChannel = ActivateContactChannel'
{
ActivateContactChannel -> Text
contactChannelId :: Prelude.Text,
ActivateContactChannel -> Text
activationCode :: Prelude.Text
}
deriving (ActivateContactChannel -> ActivateContactChannel -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ActivateContactChannel -> ActivateContactChannel -> Bool
$c/= :: ActivateContactChannel -> ActivateContactChannel -> Bool
== :: ActivateContactChannel -> ActivateContactChannel -> Bool
$c== :: ActivateContactChannel -> ActivateContactChannel -> Bool
Prelude.Eq, ReadPrec [ActivateContactChannel]
ReadPrec ActivateContactChannel
Int -> ReadS ActivateContactChannel
ReadS [ActivateContactChannel]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ActivateContactChannel]
$creadListPrec :: ReadPrec [ActivateContactChannel]
readPrec :: ReadPrec ActivateContactChannel
$creadPrec :: ReadPrec ActivateContactChannel
readList :: ReadS [ActivateContactChannel]
$creadList :: ReadS [ActivateContactChannel]
readsPrec :: Int -> ReadS ActivateContactChannel
$creadsPrec :: Int -> ReadS ActivateContactChannel
Prelude.Read, Int -> ActivateContactChannel -> ShowS
[ActivateContactChannel] -> ShowS
ActivateContactChannel -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ActivateContactChannel] -> ShowS
$cshowList :: [ActivateContactChannel] -> ShowS
show :: ActivateContactChannel -> String
$cshow :: ActivateContactChannel -> String
showsPrec :: Int -> ActivateContactChannel -> ShowS
$cshowsPrec :: Int -> ActivateContactChannel -> ShowS
Prelude.Show, forall x. Rep ActivateContactChannel x -> ActivateContactChannel
forall x. ActivateContactChannel -> Rep ActivateContactChannel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ActivateContactChannel x -> ActivateContactChannel
$cfrom :: forall x. ActivateContactChannel -> Rep ActivateContactChannel x
Prelude.Generic)
newActivateContactChannel ::
Prelude.Text ->
Prelude.Text ->
ActivateContactChannel
newActivateContactChannel :: Text -> Text -> ActivateContactChannel
newActivateContactChannel
Text
pContactChannelId_
Text
pActivationCode_ =
ActivateContactChannel'
{ $sel:contactChannelId:ActivateContactChannel' :: Text
contactChannelId =
Text
pContactChannelId_,
$sel:activationCode:ActivateContactChannel' :: Text
activationCode = Text
pActivationCode_
}
activateContactChannel_contactChannelId :: Lens.Lens' ActivateContactChannel Prelude.Text
activateContactChannel_contactChannelId :: Lens' ActivateContactChannel Text
activateContactChannel_contactChannelId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActivateContactChannel' {Text
contactChannelId :: Text
$sel:contactChannelId:ActivateContactChannel' :: ActivateContactChannel -> Text
contactChannelId} -> Text
contactChannelId) (\s :: ActivateContactChannel
s@ActivateContactChannel' {} Text
a -> ActivateContactChannel
s {$sel:contactChannelId:ActivateContactChannel' :: Text
contactChannelId = Text
a} :: ActivateContactChannel)
activateContactChannel_activationCode :: Lens.Lens' ActivateContactChannel Prelude.Text
activateContactChannel_activationCode :: Lens' ActivateContactChannel Text
activateContactChannel_activationCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActivateContactChannel' {Text
activationCode :: Text
$sel:activationCode:ActivateContactChannel' :: ActivateContactChannel -> Text
activationCode} -> Text
activationCode) (\s :: ActivateContactChannel
s@ActivateContactChannel' {} Text
a -> ActivateContactChannel
s {$sel:activationCode:ActivateContactChannel' :: Text
activationCode = Text
a} :: ActivateContactChannel)
instance Core.AWSRequest ActivateContactChannel where
type
AWSResponse ActivateContactChannel =
ActivateContactChannelResponse
request :: (Service -> Service)
-> ActivateContactChannel -> Request ActivateContactChannel
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 ActivateContactChannel
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ActivateContactChannel)))
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 -> ActivateContactChannelResponse
ActivateContactChannelResponse'
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 ActivateContactChannel where
hashWithSalt :: Int -> ActivateContactChannel -> Int
hashWithSalt Int
_salt ActivateContactChannel' {Text
activationCode :: Text
contactChannelId :: Text
$sel:activationCode:ActivateContactChannel' :: ActivateContactChannel -> Text
$sel:contactChannelId:ActivateContactChannel' :: ActivateContactChannel -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
contactChannelId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
activationCode
instance Prelude.NFData ActivateContactChannel where
rnf :: ActivateContactChannel -> ()
rnf ActivateContactChannel' {Text
activationCode :: Text
contactChannelId :: Text
$sel:activationCode:ActivateContactChannel' :: ActivateContactChannel -> Text
$sel:contactChannelId:ActivateContactChannel' :: ActivateContactChannel -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
contactChannelId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
activationCode
instance Data.ToHeaders ActivateContactChannel where
toHeaders :: ActivateContactChannel -> 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.ActivateContactChannel" ::
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 ActivateContactChannel where
toJSON :: ActivateContactChannel -> Value
toJSON ActivateContactChannel' {Text
activationCode :: Text
contactChannelId :: Text
$sel:activationCode:ActivateContactChannel' :: ActivateContactChannel -> Text
$sel:contactChannelId:ActivateContactChannel' :: ActivateContactChannel -> 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),
forall a. a -> Maybe a
Prelude.Just
(Key
"ActivationCode" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
activationCode)
]
)
instance Data.ToPath ActivateContactChannel where
toPath :: ActivateContactChannel -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ActivateContactChannel where
toQuery :: ActivateContactChannel -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ActivateContactChannelResponse = ActivateContactChannelResponse'
{
ActivateContactChannelResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ActivateContactChannelResponse
-> ActivateContactChannelResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ActivateContactChannelResponse
-> ActivateContactChannelResponse -> Bool
$c/= :: ActivateContactChannelResponse
-> ActivateContactChannelResponse -> Bool
== :: ActivateContactChannelResponse
-> ActivateContactChannelResponse -> Bool
$c== :: ActivateContactChannelResponse
-> ActivateContactChannelResponse -> Bool
Prelude.Eq, ReadPrec [ActivateContactChannelResponse]
ReadPrec ActivateContactChannelResponse
Int -> ReadS ActivateContactChannelResponse
ReadS [ActivateContactChannelResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ActivateContactChannelResponse]
$creadListPrec :: ReadPrec [ActivateContactChannelResponse]
readPrec :: ReadPrec ActivateContactChannelResponse
$creadPrec :: ReadPrec ActivateContactChannelResponse
readList :: ReadS [ActivateContactChannelResponse]
$creadList :: ReadS [ActivateContactChannelResponse]
readsPrec :: Int -> ReadS ActivateContactChannelResponse
$creadsPrec :: Int -> ReadS ActivateContactChannelResponse
Prelude.Read, Int -> ActivateContactChannelResponse -> ShowS
[ActivateContactChannelResponse] -> ShowS
ActivateContactChannelResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ActivateContactChannelResponse] -> ShowS
$cshowList :: [ActivateContactChannelResponse] -> ShowS
show :: ActivateContactChannelResponse -> String
$cshow :: ActivateContactChannelResponse -> String
showsPrec :: Int -> ActivateContactChannelResponse -> ShowS
$cshowsPrec :: Int -> ActivateContactChannelResponse -> ShowS
Prelude.Show, forall x.
Rep ActivateContactChannelResponse x
-> ActivateContactChannelResponse
forall x.
ActivateContactChannelResponse
-> Rep ActivateContactChannelResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ActivateContactChannelResponse x
-> ActivateContactChannelResponse
$cfrom :: forall x.
ActivateContactChannelResponse
-> Rep ActivateContactChannelResponse x
Prelude.Generic)
newActivateContactChannelResponse ::
Prelude.Int ->
ActivateContactChannelResponse
newActivateContactChannelResponse :: Int -> ActivateContactChannelResponse
newActivateContactChannelResponse Int
pHttpStatus_ =
ActivateContactChannelResponse'
{ $sel:httpStatus:ActivateContactChannelResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
activateContactChannelResponse_httpStatus :: Lens.Lens' ActivateContactChannelResponse Prelude.Int
activateContactChannelResponse_httpStatus :: Lens' ActivateContactChannelResponse Int
activateContactChannelResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActivateContactChannelResponse' {Int
httpStatus :: Int
$sel:httpStatus:ActivateContactChannelResponse' :: ActivateContactChannelResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ActivateContactChannelResponse
s@ActivateContactChannelResponse' {} Int
a -> ActivateContactChannelResponse
s {$sel:httpStatus:ActivateContactChannelResponse' :: Int
httpStatus = Int
a} :: ActivateContactChannelResponse)
instance
Prelude.NFData
ActivateContactChannelResponse
where
rnf :: ActivateContactChannelResponse -> ()
rnf ActivateContactChannelResponse' {Int
httpStatus :: Int
$sel:httpStatus:ActivateContactChannelResponse' :: ActivateContactChannelResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus