{-# 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.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 ActivateContactChannel = ActivateContactChannel'
{
ActivateContactChannel -> Text
contactChannelId :: Prelude.Text,
ActivateContactChannel -> Text
activationCode :: Prelude.Text
}
deriving (ActivateContactChannel -> ActivateContactChannel -> Bool
(ActivateContactChannel -> ActivateContactChannel -> Bool)
-> (ActivateContactChannel -> ActivateContactChannel -> Bool)
-> Eq ActivateContactChannel
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]
(Int -> ReadS ActivateContactChannel)
-> ReadS [ActivateContactChannel]
-> ReadPrec ActivateContactChannel
-> ReadPrec [ActivateContactChannel]
-> Read 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
(Int -> ActivateContactChannel -> ShowS)
-> (ActivateContactChannel -> String)
-> ([ActivateContactChannel] -> ShowS)
-> Show ActivateContactChannel
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. ActivateContactChannel -> Rep ActivateContactChannel x)
-> (forall x.
Rep ActivateContactChannel x -> ActivateContactChannel)
-> Generic ActivateContactChannel
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' :: Text -> Text -> ActivateContactChannel
ActivateContactChannel'
{ $sel:contactChannelId:ActivateContactChannel' :: Text
contactChannelId =
Text
pContactChannelId_,
$sel:activationCode:ActivateContactChannel' :: Text
activationCode = Text
pActivationCode_
}
activateContactChannel_contactChannelId :: Lens.Lens' ActivateContactChannel Prelude.Text
activateContactChannel_contactChannelId :: (Text -> f Text)
-> ActivateContactChannel -> f ActivateContactChannel
activateContactChannel_contactChannelId = (ActivateContactChannel -> Text)
-> (ActivateContactChannel -> Text -> ActivateContactChannel)
-> Lens ActivateContactChannel ActivateContactChannel Text Text
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 :: (Text -> f Text)
-> ActivateContactChannel -> f ActivateContactChannel
activateContactChannel_activationCode = (ActivateContactChannel -> Text)
-> (ActivateContactChannel -> Text -> ActivateContactChannel)
-> Lens ActivateContactChannel ActivateContactChannel Text Text
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 :: ActivateContactChannel -> Request ActivateContactChannel
request = Service -> ActivateContactChannel -> Request ActivateContactChannel
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ActivateContactChannel
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ActivateContactChannel)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse ActivateContactChannel))
-> Logger
-> Service
-> Proxy ActivateContactChannel
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ActivateContactChannel)))
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 -> ActivateContactChannelResponse
ActivateContactChannelResponse'
(Int -> ActivateContactChannelResponse)
-> Either String Int
-> Either String ActivateContactChannelResponse
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 ActivateContactChannel
instance Prelude.NFData ActivateContactChannel
instance Core.ToHeaders ActivateContactChannel where
toHeaders :: ActivateContactChannel -> ResponseHeaders
toHeaders =
ResponseHeaders -> ActivateContactChannel -> 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.ActivateContactChannel" ::
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 ActivateContactChannel where
toJSON :: ActivateContactChannel -> Value
toJSON ActivateContactChannel' {Text
activationCode :: Text
contactChannelId :: Text
$sel:activationCode:ActivateContactChannel' :: ActivateContactChannel -> Text
$sel:contactChannelId:ActivateContactChannel' :: ActivateContactChannel -> 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),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"ActivationCode" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
activationCode)
]
)
instance Core.ToPath ActivateContactChannel where
toPath :: ActivateContactChannel -> ByteString
toPath = ByteString -> ActivateContactChannel -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ActivateContactChannel where
toQuery :: ActivateContactChannel -> QueryString
toQuery = QueryString -> ActivateContactChannel -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ActivateContactChannelResponse = ActivateContactChannelResponse'
{
ActivateContactChannelResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ActivateContactChannelResponse
-> ActivateContactChannelResponse -> Bool
(ActivateContactChannelResponse
-> ActivateContactChannelResponse -> Bool)
-> (ActivateContactChannelResponse
-> ActivateContactChannelResponse -> Bool)
-> Eq ActivateContactChannelResponse
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]
(Int -> ReadS ActivateContactChannelResponse)
-> ReadS [ActivateContactChannelResponse]
-> ReadPrec ActivateContactChannelResponse
-> ReadPrec [ActivateContactChannelResponse]
-> Read 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
(Int -> ActivateContactChannelResponse -> ShowS)
-> (ActivateContactChannelResponse -> String)
-> ([ActivateContactChannelResponse] -> ShowS)
-> Show ActivateContactChannelResponse
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.
ActivateContactChannelResponse
-> Rep ActivateContactChannelResponse x)
-> (forall x.
Rep ActivateContactChannelResponse x
-> ActivateContactChannelResponse)
-> Generic ActivateContactChannelResponse
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' :: Int -> ActivateContactChannelResponse
ActivateContactChannelResponse'
{ $sel:httpStatus:ActivateContactChannelResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
activateContactChannelResponse_httpStatus :: Lens.Lens' ActivateContactChannelResponse Prelude.Int
activateContactChannelResponse_httpStatus :: (Int -> f Int)
-> ActivateContactChannelResponse
-> f ActivateContactChannelResponse
activateContactChannelResponse_httpStatus = (ActivateContactChannelResponse -> Int)
-> (ActivateContactChannelResponse
-> Int -> ActivateContactChannelResponse)
-> Lens
ActivateContactChannelResponse
ActivateContactChannelResponse
Int
Int
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