{-# 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.AcceptPage
(
AcceptPage (..),
newAcceptPage,
acceptPage_note,
acceptPage_contactChannelId,
acceptPage_acceptCodeValidation,
acceptPage_pageId,
acceptPage_acceptType,
acceptPage_acceptCode,
AcceptPageResponse (..),
newAcceptPageResponse,
acceptPageResponse_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 AcceptPage = AcceptPage'
{
AcceptPage -> Maybe Text
note :: Prelude.Maybe Prelude.Text,
AcceptPage -> Maybe Text
contactChannelId :: Prelude.Maybe Prelude.Text,
AcceptPage -> Maybe AcceptCodeValidation
acceptCodeValidation :: Prelude.Maybe AcceptCodeValidation,
AcceptPage -> Text
pageId :: Prelude.Text,
AcceptPage -> AcceptType
acceptType :: AcceptType,
AcceptPage -> Text
acceptCode :: Prelude.Text
}
deriving (AcceptPage -> AcceptPage -> Bool
(AcceptPage -> AcceptPage -> Bool)
-> (AcceptPage -> AcceptPage -> Bool) -> Eq AcceptPage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AcceptPage -> AcceptPage -> Bool
$c/= :: AcceptPage -> AcceptPage -> Bool
== :: AcceptPage -> AcceptPage -> Bool
$c== :: AcceptPage -> AcceptPage -> Bool
Prelude.Eq, ReadPrec [AcceptPage]
ReadPrec AcceptPage
Int -> ReadS AcceptPage
ReadS [AcceptPage]
(Int -> ReadS AcceptPage)
-> ReadS [AcceptPage]
-> ReadPrec AcceptPage
-> ReadPrec [AcceptPage]
-> Read AcceptPage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AcceptPage]
$creadListPrec :: ReadPrec [AcceptPage]
readPrec :: ReadPrec AcceptPage
$creadPrec :: ReadPrec AcceptPage
readList :: ReadS [AcceptPage]
$creadList :: ReadS [AcceptPage]
readsPrec :: Int -> ReadS AcceptPage
$creadsPrec :: Int -> ReadS AcceptPage
Prelude.Read, Int -> AcceptPage -> ShowS
[AcceptPage] -> ShowS
AcceptPage -> String
(Int -> AcceptPage -> ShowS)
-> (AcceptPage -> String)
-> ([AcceptPage] -> ShowS)
-> Show AcceptPage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AcceptPage] -> ShowS
$cshowList :: [AcceptPage] -> ShowS
show :: AcceptPage -> String
$cshow :: AcceptPage -> String
showsPrec :: Int -> AcceptPage -> ShowS
$cshowsPrec :: Int -> AcceptPage -> ShowS
Prelude.Show, (forall x. AcceptPage -> Rep AcceptPage x)
-> (forall x. Rep AcceptPage x -> AcceptPage) -> Generic AcceptPage
forall x. Rep AcceptPage x -> AcceptPage
forall x. AcceptPage -> Rep AcceptPage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AcceptPage x -> AcceptPage
$cfrom :: forall x. AcceptPage -> Rep AcceptPage x
Prelude.Generic)
newAcceptPage ::
Prelude.Text ->
AcceptType ->
Prelude.Text ->
AcceptPage
newAcceptPage :: Text -> AcceptType -> Text -> AcceptPage
newAcceptPage Text
pPageId_ AcceptType
pAcceptType_ Text
pAcceptCode_ =
AcceptPage' :: Maybe Text
-> Maybe Text
-> Maybe AcceptCodeValidation
-> Text
-> AcceptType
-> Text
-> AcceptPage
AcceptPage'
{ $sel:note:AcceptPage' :: Maybe Text
note = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:contactChannelId:AcceptPage' :: Maybe Text
contactChannelId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:acceptCodeValidation:AcceptPage' :: Maybe AcceptCodeValidation
acceptCodeValidation = Maybe AcceptCodeValidation
forall a. Maybe a
Prelude.Nothing,
$sel:pageId:AcceptPage' :: Text
pageId = Text
pPageId_,
$sel:acceptType:AcceptPage' :: AcceptType
acceptType = AcceptType
pAcceptType_,
$sel:acceptCode:AcceptPage' :: Text
acceptCode = Text
pAcceptCode_
}
acceptPage_note :: Lens.Lens' AcceptPage (Prelude.Maybe Prelude.Text)
acceptPage_note :: (Maybe Text -> f (Maybe Text)) -> AcceptPage -> f AcceptPage
acceptPage_note = (AcceptPage -> Maybe Text)
-> (AcceptPage -> Maybe Text -> AcceptPage)
-> Lens AcceptPage AcceptPage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptPage' {Maybe Text
note :: Maybe Text
$sel:note:AcceptPage' :: AcceptPage -> Maybe Text
note} -> Maybe Text
note) (\s :: AcceptPage
s@AcceptPage' {} Maybe Text
a -> AcceptPage
s {$sel:note:AcceptPage' :: Maybe Text
note = Maybe Text
a} :: AcceptPage)
acceptPage_contactChannelId :: Lens.Lens' AcceptPage (Prelude.Maybe Prelude.Text)
acceptPage_contactChannelId :: (Maybe Text -> f (Maybe Text)) -> AcceptPage -> f AcceptPage
acceptPage_contactChannelId = (AcceptPage -> Maybe Text)
-> (AcceptPage -> Maybe Text -> AcceptPage)
-> Lens AcceptPage AcceptPage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptPage' {Maybe Text
contactChannelId :: Maybe Text
$sel:contactChannelId:AcceptPage' :: AcceptPage -> Maybe Text
contactChannelId} -> Maybe Text
contactChannelId) (\s :: AcceptPage
s@AcceptPage' {} Maybe Text
a -> AcceptPage
s {$sel:contactChannelId:AcceptPage' :: Maybe Text
contactChannelId = Maybe Text
a} :: AcceptPage)
acceptPage_acceptCodeValidation :: Lens.Lens' AcceptPage (Prelude.Maybe AcceptCodeValidation)
acceptPage_acceptCodeValidation :: (Maybe AcceptCodeValidation -> f (Maybe AcceptCodeValidation))
-> AcceptPage -> f AcceptPage
acceptPage_acceptCodeValidation = (AcceptPage -> Maybe AcceptCodeValidation)
-> (AcceptPage -> Maybe AcceptCodeValidation -> AcceptPage)
-> Lens
AcceptPage
AcceptPage
(Maybe AcceptCodeValidation)
(Maybe AcceptCodeValidation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptPage' {Maybe AcceptCodeValidation
acceptCodeValidation :: Maybe AcceptCodeValidation
$sel:acceptCodeValidation:AcceptPage' :: AcceptPage -> Maybe AcceptCodeValidation
acceptCodeValidation} -> Maybe AcceptCodeValidation
acceptCodeValidation) (\s :: AcceptPage
s@AcceptPage' {} Maybe AcceptCodeValidation
a -> AcceptPage
s {$sel:acceptCodeValidation:AcceptPage' :: Maybe AcceptCodeValidation
acceptCodeValidation = Maybe AcceptCodeValidation
a} :: AcceptPage)
acceptPage_pageId :: Lens.Lens' AcceptPage Prelude.Text
acceptPage_pageId :: (Text -> f Text) -> AcceptPage -> f AcceptPage
acceptPage_pageId = (AcceptPage -> Text)
-> (AcceptPage -> Text -> AcceptPage)
-> Lens AcceptPage AcceptPage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptPage' {Text
pageId :: Text
$sel:pageId:AcceptPage' :: AcceptPage -> Text
pageId} -> Text
pageId) (\s :: AcceptPage
s@AcceptPage' {} Text
a -> AcceptPage
s {$sel:pageId:AcceptPage' :: Text
pageId = Text
a} :: AcceptPage)
acceptPage_acceptType :: Lens.Lens' AcceptPage AcceptType
acceptPage_acceptType :: (AcceptType -> f AcceptType) -> AcceptPage -> f AcceptPage
acceptPage_acceptType = (AcceptPage -> AcceptType)
-> (AcceptPage -> AcceptType -> AcceptPage)
-> Lens AcceptPage AcceptPage AcceptType AcceptType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptPage' {AcceptType
acceptType :: AcceptType
$sel:acceptType:AcceptPage' :: AcceptPage -> AcceptType
acceptType} -> AcceptType
acceptType) (\s :: AcceptPage
s@AcceptPage' {} AcceptType
a -> AcceptPage
s {$sel:acceptType:AcceptPage' :: AcceptType
acceptType = AcceptType
a} :: AcceptPage)
acceptPage_acceptCode :: Lens.Lens' AcceptPage Prelude.Text
acceptPage_acceptCode :: (Text -> f Text) -> AcceptPage -> f AcceptPage
acceptPage_acceptCode = (AcceptPage -> Text)
-> (AcceptPage -> Text -> AcceptPage)
-> Lens AcceptPage AcceptPage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptPage' {Text
acceptCode :: Text
$sel:acceptCode:AcceptPage' :: AcceptPage -> Text
acceptCode} -> Text
acceptCode) (\s :: AcceptPage
s@AcceptPage' {} Text
a -> AcceptPage
s {$sel:acceptCode:AcceptPage' :: Text
acceptCode = Text
a} :: AcceptPage)
instance Core.AWSRequest AcceptPage where
type AWSResponse AcceptPage = AcceptPageResponse
request :: AcceptPage -> Request AcceptPage
request = Service -> AcceptPage -> Request AcceptPage
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AcceptPage
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AcceptPage)))
response =
(Int
-> ResponseHeaders -> () -> Either String (AWSResponse AcceptPage))
-> Logger
-> Service
-> Proxy AcceptPage
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AcceptPage)))
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 -> AcceptPageResponse
AcceptPageResponse'
(Int -> AcceptPageResponse)
-> Either String Int -> Either String AcceptPageResponse
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 AcceptPage
instance Prelude.NFData AcceptPage
instance Core.ToHeaders AcceptPage where
toHeaders :: AcceptPage -> ResponseHeaders
toHeaders =
ResponseHeaders -> AcceptPage -> 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.AcceptPage" :: 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 AcceptPage where
toJSON :: AcceptPage -> Value
toJSON AcceptPage' {Maybe Text
Maybe AcceptCodeValidation
Text
AcceptType
acceptCode :: Text
acceptType :: AcceptType
pageId :: Text
acceptCodeValidation :: Maybe AcceptCodeValidation
contactChannelId :: Maybe Text
note :: Maybe Text
$sel:acceptCode:AcceptPage' :: AcceptPage -> Text
$sel:acceptType:AcceptPage' :: AcceptPage -> AcceptType
$sel:pageId:AcceptPage' :: AcceptPage -> Text
$sel:acceptCodeValidation:AcceptPage' :: AcceptPage -> Maybe AcceptCodeValidation
$sel:contactChannelId:AcceptPage' :: AcceptPage -> Maybe Text
$sel:note:AcceptPage' :: AcceptPage -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Note" 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
note,
(Text
"ContactChannelId" 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
contactChannelId,
(Text
"AcceptCodeValidation" Text -> AcceptCodeValidation -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(AcceptCodeValidation -> Pair)
-> Maybe AcceptCodeValidation -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AcceptCodeValidation
acceptCodeValidation,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"PageId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
pageId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"AcceptType" Text -> AcceptType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= AcceptType
acceptType),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"AcceptCode" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
acceptCode)
]
)
instance Core.ToPath AcceptPage where
toPath :: AcceptPage -> ByteString
toPath = ByteString -> AcceptPage -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery AcceptPage where
toQuery :: AcceptPage -> QueryString
toQuery = QueryString -> AcceptPage -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data =
{
:: Prelude.Int
}
deriving (AcceptPageResponse -> AcceptPageResponse -> Bool
(AcceptPageResponse -> AcceptPageResponse -> Bool)
-> (AcceptPageResponse -> AcceptPageResponse -> Bool)
-> Eq AcceptPageResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AcceptPageResponse -> AcceptPageResponse -> Bool
$c/= :: AcceptPageResponse -> AcceptPageResponse -> Bool
== :: AcceptPageResponse -> AcceptPageResponse -> Bool
$c== :: AcceptPageResponse -> AcceptPageResponse -> Bool
Prelude.Eq, ReadPrec [AcceptPageResponse]
ReadPrec AcceptPageResponse
Int -> ReadS AcceptPageResponse
ReadS [AcceptPageResponse]
(Int -> ReadS AcceptPageResponse)
-> ReadS [AcceptPageResponse]
-> ReadPrec AcceptPageResponse
-> ReadPrec [AcceptPageResponse]
-> Read AcceptPageResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AcceptPageResponse]
$creadListPrec :: ReadPrec [AcceptPageResponse]
readPrec :: ReadPrec AcceptPageResponse
$creadPrec :: ReadPrec AcceptPageResponse
readList :: ReadS [AcceptPageResponse]
$creadList :: ReadS [AcceptPageResponse]
readsPrec :: Int -> ReadS AcceptPageResponse
$creadsPrec :: Int -> ReadS AcceptPageResponse
Prelude.Read, Int -> AcceptPageResponse -> ShowS
[AcceptPageResponse] -> ShowS
AcceptPageResponse -> String
(Int -> AcceptPageResponse -> ShowS)
-> (AcceptPageResponse -> String)
-> ([AcceptPageResponse] -> ShowS)
-> Show AcceptPageResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AcceptPageResponse] -> ShowS
$cshowList :: [AcceptPageResponse] -> ShowS
show :: AcceptPageResponse -> String
$cshow :: AcceptPageResponse -> String
showsPrec :: Int -> AcceptPageResponse -> ShowS
$cshowsPrec :: Int -> AcceptPageResponse -> ShowS
Prelude.Show, (forall x. AcceptPageResponse -> Rep AcceptPageResponse x)
-> (forall x. Rep AcceptPageResponse x -> AcceptPageResponse)
-> Generic AcceptPageResponse
forall x. Rep AcceptPageResponse x -> AcceptPageResponse
forall x. AcceptPageResponse -> Rep AcceptPageResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AcceptPageResponse x -> AcceptPageResponse
$cfrom :: forall x. AcceptPageResponse -> Rep AcceptPageResponse x
Prelude.Generic)
newAcceptPageResponse ::
Prelude.Int ->
AcceptPageResponse
Int
pHttpStatus_ =
AcceptPageResponse' :: Int -> AcceptPageResponse
AcceptPageResponse' {$sel:httpStatus:AcceptPageResponse' :: Int
httpStatus = Int
pHttpStatus_}
acceptPageResponse_httpStatus :: Lens.Lens' AcceptPageResponse Prelude.Int
= (AcceptPageResponse -> Int)
-> (AcceptPageResponse -> Int -> AcceptPageResponse)
-> Lens AcceptPageResponse AcceptPageResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptPageResponse' {Int
httpStatus :: Int
$sel:httpStatus:AcceptPageResponse' :: AcceptPageResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AcceptPageResponse
s@AcceptPageResponse' {} Int
a -> AcceptPageResponse
s {$sel:httpStatus:AcceptPageResponse' :: Int
httpStatus = Int
a} :: AcceptPageResponse)
instance Prelude.NFData AcceptPageResponse