{-# 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.CloudFront.CreateMonitoringSubscription
(
CreateMonitoringSubscription (..),
newCreateMonitoringSubscription,
createMonitoringSubscription_monitoringSubscription,
createMonitoringSubscription_distributionId,
CreateMonitoringSubscriptionResponse (..),
newCreateMonitoringSubscriptionResponse,
createMonitoringSubscriptionResponse_monitoringSubscription,
createMonitoringSubscriptionResponse_httpStatus,
)
where
import Amazonka.CloudFront.Types
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
data CreateMonitoringSubscription = CreateMonitoringSubscription'
{
CreateMonitoringSubscription -> MonitoringSubscription
monitoringSubscription :: MonitoringSubscription,
CreateMonitoringSubscription -> Text
distributionId :: Prelude.Text
}
deriving (CreateMonitoringSubscription
-> CreateMonitoringSubscription -> Bool
(CreateMonitoringSubscription
-> CreateMonitoringSubscription -> Bool)
-> (CreateMonitoringSubscription
-> CreateMonitoringSubscription -> Bool)
-> Eq CreateMonitoringSubscription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateMonitoringSubscription
-> CreateMonitoringSubscription -> Bool
$c/= :: CreateMonitoringSubscription
-> CreateMonitoringSubscription -> Bool
== :: CreateMonitoringSubscription
-> CreateMonitoringSubscription -> Bool
$c== :: CreateMonitoringSubscription
-> CreateMonitoringSubscription -> Bool
Prelude.Eq, ReadPrec [CreateMonitoringSubscription]
ReadPrec CreateMonitoringSubscription
Int -> ReadS CreateMonitoringSubscription
ReadS [CreateMonitoringSubscription]
(Int -> ReadS CreateMonitoringSubscription)
-> ReadS [CreateMonitoringSubscription]
-> ReadPrec CreateMonitoringSubscription
-> ReadPrec [CreateMonitoringSubscription]
-> Read CreateMonitoringSubscription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateMonitoringSubscription]
$creadListPrec :: ReadPrec [CreateMonitoringSubscription]
readPrec :: ReadPrec CreateMonitoringSubscription
$creadPrec :: ReadPrec CreateMonitoringSubscription
readList :: ReadS [CreateMonitoringSubscription]
$creadList :: ReadS [CreateMonitoringSubscription]
readsPrec :: Int -> ReadS CreateMonitoringSubscription
$creadsPrec :: Int -> ReadS CreateMonitoringSubscription
Prelude.Read, Int -> CreateMonitoringSubscription -> ShowS
[CreateMonitoringSubscription] -> ShowS
CreateMonitoringSubscription -> String
(Int -> CreateMonitoringSubscription -> ShowS)
-> (CreateMonitoringSubscription -> String)
-> ([CreateMonitoringSubscription] -> ShowS)
-> Show CreateMonitoringSubscription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateMonitoringSubscription] -> ShowS
$cshowList :: [CreateMonitoringSubscription] -> ShowS
show :: CreateMonitoringSubscription -> String
$cshow :: CreateMonitoringSubscription -> String
showsPrec :: Int -> CreateMonitoringSubscription -> ShowS
$cshowsPrec :: Int -> CreateMonitoringSubscription -> ShowS
Prelude.Show, (forall x.
CreateMonitoringSubscription -> Rep CreateMonitoringSubscription x)
-> (forall x.
Rep CreateMonitoringSubscription x -> CreateMonitoringSubscription)
-> Generic CreateMonitoringSubscription
forall x.
Rep CreateMonitoringSubscription x -> CreateMonitoringSubscription
forall x.
CreateMonitoringSubscription -> Rep CreateMonitoringSubscription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateMonitoringSubscription x -> CreateMonitoringSubscription
$cfrom :: forall x.
CreateMonitoringSubscription -> Rep CreateMonitoringSubscription x
Prelude.Generic)
newCreateMonitoringSubscription ::
MonitoringSubscription ->
Prelude.Text ->
CreateMonitoringSubscription
newCreateMonitoringSubscription :: MonitoringSubscription -> Text -> CreateMonitoringSubscription
newCreateMonitoringSubscription
MonitoringSubscription
pMonitoringSubscription_
Text
pDistributionId_ =
CreateMonitoringSubscription' :: MonitoringSubscription -> Text -> CreateMonitoringSubscription
CreateMonitoringSubscription'
{ $sel:monitoringSubscription:CreateMonitoringSubscription' :: MonitoringSubscription
monitoringSubscription =
MonitoringSubscription
pMonitoringSubscription_,
$sel:distributionId:CreateMonitoringSubscription' :: Text
distributionId = Text
pDistributionId_
}
createMonitoringSubscription_monitoringSubscription :: Lens.Lens' CreateMonitoringSubscription MonitoringSubscription
createMonitoringSubscription_monitoringSubscription :: (MonitoringSubscription -> f MonitoringSubscription)
-> CreateMonitoringSubscription -> f CreateMonitoringSubscription
createMonitoringSubscription_monitoringSubscription = (CreateMonitoringSubscription -> MonitoringSubscription)
-> (CreateMonitoringSubscription
-> MonitoringSubscription -> CreateMonitoringSubscription)
-> Lens
CreateMonitoringSubscription
CreateMonitoringSubscription
MonitoringSubscription
MonitoringSubscription
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMonitoringSubscription' {MonitoringSubscription
monitoringSubscription :: MonitoringSubscription
$sel:monitoringSubscription:CreateMonitoringSubscription' :: CreateMonitoringSubscription -> MonitoringSubscription
monitoringSubscription} -> MonitoringSubscription
monitoringSubscription) (\s :: CreateMonitoringSubscription
s@CreateMonitoringSubscription' {} MonitoringSubscription
a -> CreateMonitoringSubscription
s {$sel:monitoringSubscription:CreateMonitoringSubscription' :: MonitoringSubscription
monitoringSubscription = MonitoringSubscription
a} :: CreateMonitoringSubscription)
createMonitoringSubscription_distributionId :: Lens.Lens' CreateMonitoringSubscription Prelude.Text
createMonitoringSubscription_distributionId :: (Text -> f Text)
-> CreateMonitoringSubscription -> f CreateMonitoringSubscription
createMonitoringSubscription_distributionId = (CreateMonitoringSubscription -> Text)
-> (CreateMonitoringSubscription
-> Text -> CreateMonitoringSubscription)
-> Lens
CreateMonitoringSubscription CreateMonitoringSubscription Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMonitoringSubscription' {Text
distributionId :: Text
$sel:distributionId:CreateMonitoringSubscription' :: CreateMonitoringSubscription -> Text
distributionId} -> Text
distributionId) (\s :: CreateMonitoringSubscription
s@CreateMonitoringSubscription' {} Text
a -> CreateMonitoringSubscription
s {$sel:distributionId:CreateMonitoringSubscription' :: Text
distributionId = Text
a} :: CreateMonitoringSubscription)
instance Core.AWSRequest CreateMonitoringSubscription where
type
AWSResponse CreateMonitoringSubscription =
CreateMonitoringSubscriptionResponse
request :: CreateMonitoringSubscription
-> Request CreateMonitoringSubscription
request = Service
-> CreateMonitoringSubscription
-> Request CreateMonitoringSubscription
forall a. (ToRequest a, ToElement a) => Service -> a -> Request a
Request.postXML Service
defaultService
response :: Logger
-> Service
-> Proxy CreateMonitoringSubscription
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateMonitoringSubscription)))
response =
(Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse CreateMonitoringSubscription))
-> Logger
-> Service
-> Proxy CreateMonitoringSubscription
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateMonitoringSubscription)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe MonitoringSubscription
-> Int -> CreateMonitoringSubscriptionResponse
CreateMonitoringSubscriptionResponse'
(Maybe MonitoringSubscription
-> Int -> CreateMonitoringSubscriptionResponse)
-> Either String (Maybe MonitoringSubscription)
-> Either String (Int -> CreateMonitoringSubscriptionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node] -> Either String (Maybe MonitoringSubscription)
forall a. FromXML a => [Node] -> Either String a
Core.parseXML [Node]
x)
Either String (Int -> CreateMonitoringSubscriptionResponse)
-> Either String Int
-> Either String CreateMonitoringSubscriptionResponse
forall (f :: * -> *) a b. Applicative f => 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
CreateMonitoringSubscription
instance Prelude.NFData CreateMonitoringSubscription
instance Core.ToElement CreateMonitoringSubscription where
toElement :: CreateMonitoringSubscription -> Element
toElement CreateMonitoringSubscription' {Text
MonitoringSubscription
distributionId :: Text
monitoringSubscription :: MonitoringSubscription
$sel:distributionId:CreateMonitoringSubscription' :: CreateMonitoringSubscription -> Text
$sel:monitoringSubscription:CreateMonitoringSubscription' :: CreateMonitoringSubscription -> MonitoringSubscription
..} =
Name -> MonitoringSubscription -> Element
forall a. ToXML a => Name -> a -> Element
Core.mkElement
Name
"{http://cloudfront.amazonaws.com/doc/2020-05-31/}MonitoringSubscription"
MonitoringSubscription
monitoringSubscription
instance Core.ToHeaders CreateMonitoringSubscription where
toHeaders :: CreateMonitoringSubscription -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateMonitoringSubscription -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath CreateMonitoringSubscription where
toPath :: CreateMonitoringSubscription -> ByteString
toPath CreateMonitoringSubscription' {Text
MonitoringSubscription
distributionId :: Text
monitoringSubscription :: MonitoringSubscription
$sel:distributionId:CreateMonitoringSubscription' :: CreateMonitoringSubscription -> Text
$sel:monitoringSubscription:CreateMonitoringSubscription' :: CreateMonitoringSubscription -> MonitoringSubscription
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/2020-05-31/distributions/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
distributionId,
ByteString
"/monitoring-subscription"
]
instance Core.ToQuery CreateMonitoringSubscription where
toQuery :: CreateMonitoringSubscription -> QueryString
toQuery = QueryString -> CreateMonitoringSubscription -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateMonitoringSubscriptionResponse = CreateMonitoringSubscriptionResponse'
{
CreateMonitoringSubscriptionResponse
-> Maybe MonitoringSubscription
monitoringSubscription :: Prelude.Maybe MonitoringSubscription,
CreateMonitoringSubscriptionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateMonitoringSubscriptionResponse
-> CreateMonitoringSubscriptionResponse -> Bool
(CreateMonitoringSubscriptionResponse
-> CreateMonitoringSubscriptionResponse -> Bool)
-> (CreateMonitoringSubscriptionResponse
-> CreateMonitoringSubscriptionResponse -> Bool)
-> Eq CreateMonitoringSubscriptionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateMonitoringSubscriptionResponse
-> CreateMonitoringSubscriptionResponse -> Bool
$c/= :: CreateMonitoringSubscriptionResponse
-> CreateMonitoringSubscriptionResponse -> Bool
== :: CreateMonitoringSubscriptionResponse
-> CreateMonitoringSubscriptionResponse -> Bool
$c== :: CreateMonitoringSubscriptionResponse
-> CreateMonitoringSubscriptionResponse -> Bool
Prelude.Eq, ReadPrec [CreateMonitoringSubscriptionResponse]
ReadPrec CreateMonitoringSubscriptionResponse
Int -> ReadS CreateMonitoringSubscriptionResponse
ReadS [CreateMonitoringSubscriptionResponse]
(Int -> ReadS CreateMonitoringSubscriptionResponse)
-> ReadS [CreateMonitoringSubscriptionResponse]
-> ReadPrec CreateMonitoringSubscriptionResponse
-> ReadPrec [CreateMonitoringSubscriptionResponse]
-> Read CreateMonitoringSubscriptionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateMonitoringSubscriptionResponse]
$creadListPrec :: ReadPrec [CreateMonitoringSubscriptionResponse]
readPrec :: ReadPrec CreateMonitoringSubscriptionResponse
$creadPrec :: ReadPrec CreateMonitoringSubscriptionResponse
readList :: ReadS [CreateMonitoringSubscriptionResponse]
$creadList :: ReadS [CreateMonitoringSubscriptionResponse]
readsPrec :: Int -> ReadS CreateMonitoringSubscriptionResponse
$creadsPrec :: Int -> ReadS CreateMonitoringSubscriptionResponse
Prelude.Read, Int -> CreateMonitoringSubscriptionResponse -> ShowS
[CreateMonitoringSubscriptionResponse] -> ShowS
CreateMonitoringSubscriptionResponse -> String
(Int -> CreateMonitoringSubscriptionResponse -> ShowS)
-> (CreateMonitoringSubscriptionResponse -> String)
-> ([CreateMonitoringSubscriptionResponse] -> ShowS)
-> Show CreateMonitoringSubscriptionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateMonitoringSubscriptionResponse] -> ShowS
$cshowList :: [CreateMonitoringSubscriptionResponse] -> ShowS
show :: CreateMonitoringSubscriptionResponse -> String
$cshow :: CreateMonitoringSubscriptionResponse -> String
showsPrec :: Int -> CreateMonitoringSubscriptionResponse -> ShowS
$cshowsPrec :: Int -> CreateMonitoringSubscriptionResponse -> ShowS
Prelude.Show, (forall x.
CreateMonitoringSubscriptionResponse
-> Rep CreateMonitoringSubscriptionResponse x)
-> (forall x.
Rep CreateMonitoringSubscriptionResponse x
-> CreateMonitoringSubscriptionResponse)
-> Generic CreateMonitoringSubscriptionResponse
forall x.
Rep CreateMonitoringSubscriptionResponse x
-> CreateMonitoringSubscriptionResponse
forall x.
CreateMonitoringSubscriptionResponse
-> Rep CreateMonitoringSubscriptionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateMonitoringSubscriptionResponse x
-> CreateMonitoringSubscriptionResponse
$cfrom :: forall x.
CreateMonitoringSubscriptionResponse
-> Rep CreateMonitoringSubscriptionResponse x
Prelude.Generic)
newCreateMonitoringSubscriptionResponse ::
Prelude.Int ->
CreateMonitoringSubscriptionResponse
newCreateMonitoringSubscriptionResponse :: Int -> CreateMonitoringSubscriptionResponse
newCreateMonitoringSubscriptionResponse Int
pHttpStatus_ =
CreateMonitoringSubscriptionResponse' :: Maybe MonitoringSubscription
-> Int -> CreateMonitoringSubscriptionResponse
CreateMonitoringSubscriptionResponse'
{ $sel:monitoringSubscription:CreateMonitoringSubscriptionResponse' :: Maybe MonitoringSubscription
monitoringSubscription =
Maybe MonitoringSubscription
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateMonitoringSubscriptionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createMonitoringSubscriptionResponse_monitoringSubscription :: Lens.Lens' CreateMonitoringSubscriptionResponse (Prelude.Maybe MonitoringSubscription)
createMonitoringSubscriptionResponse_monitoringSubscription :: (Maybe MonitoringSubscription -> f (Maybe MonitoringSubscription))
-> CreateMonitoringSubscriptionResponse
-> f CreateMonitoringSubscriptionResponse
createMonitoringSubscriptionResponse_monitoringSubscription = (CreateMonitoringSubscriptionResponse
-> Maybe MonitoringSubscription)
-> (CreateMonitoringSubscriptionResponse
-> Maybe MonitoringSubscription
-> CreateMonitoringSubscriptionResponse)
-> Lens
CreateMonitoringSubscriptionResponse
CreateMonitoringSubscriptionResponse
(Maybe MonitoringSubscription)
(Maybe MonitoringSubscription)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMonitoringSubscriptionResponse' {Maybe MonitoringSubscription
monitoringSubscription :: Maybe MonitoringSubscription
$sel:monitoringSubscription:CreateMonitoringSubscriptionResponse' :: CreateMonitoringSubscriptionResponse
-> Maybe MonitoringSubscription
monitoringSubscription} -> Maybe MonitoringSubscription
monitoringSubscription) (\s :: CreateMonitoringSubscriptionResponse
s@CreateMonitoringSubscriptionResponse' {} Maybe MonitoringSubscription
a -> CreateMonitoringSubscriptionResponse
s {$sel:monitoringSubscription:CreateMonitoringSubscriptionResponse' :: Maybe MonitoringSubscription
monitoringSubscription = Maybe MonitoringSubscription
a} :: CreateMonitoringSubscriptionResponse)
createMonitoringSubscriptionResponse_httpStatus :: Lens.Lens' CreateMonitoringSubscriptionResponse Prelude.Int
createMonitoringSubscriptionResponse_httpStatus :: (Int -> f Int)
-> CreateMonitoringSubscriptionResponse
-> f CreateMonitoringSubscriptionResponse
createMonitoringSubscriptionResponse_httpStatus = (CreateMonitoringSubscriptionResponse -> Int)
-> (CreateMonitoringSubscriptionResponse
-> Int -> CreateMonitoringSubscriptionResponse)
-> Lens
CreateMonitoringSubscriptionResponse
CreateMonitoringSubscriptionResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMonitoringSubscriptionResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateMonitoringSubscriptionResponse' :: CreateMonitoringSubscriptionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateMonitoringSubscriptionResponse
s@CreateMonitoringSubscriptionResponse' {} Int
a -> CreateMonitoringSubscriptionResponse
s {$sel:httpStatus:CreateMonitoringSubscriptionResponse' :: Int
httpStatus = Int
a} :: CreateMonitoringSubscriptionResponse)
instance
Prelude.NFData
CreateMonitoringSubscriptionResponse