{-# 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.GetMonitoringSubscription
(
GetMonitoringSubscription (..),
newGetMonitoringSubscription,
getMonitoringSubscription_distributionId,
GetMonitoringSubscriptionResponse (..),
newGetMonitoringSubscriptionResponse,
getMonitoringSubscriptionResponse_monitoringSubscription,
getMonitoringSubscriptionResponse_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 GetMonitoringSubscription = GetMonitoringSubscription'
{
GetMonitoringSubscription -> Text
distributionId :: Prelude.Text
}
deriving (GetMonitoringSubscription -> GetMonitoringSubscription -> Bool
(GetMonitoringSubscription -> GetMonitoringSubscription -> Bool)
-> (GetMonitoringSubscription -> GetMonitoringSubscription -> Bool)
-> Eq GetMonitoringSubscription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetMonitoringSubscription -> GetMonitoringSubscription -> Bool
$c/= :: GetMonitoringSubscription -> GetMonitoringSubscription -> Bool
== :: GetMonitoringSubscription -> GetMonitoringSubscription -> Bool
$c== :: GetMonitoringSubscription -> GetMonitoringSubscription -> Bool
Prelude.Eq, ReadPrec [GetMonitoringSubscription]
ReadPrec GetMonitoringSubscription
Int -> ReadS GetMonitoringSubscription
ReadS [GetMonitoringSubscription]
(Int -> ReadS GetMonitoringSubscription)
-> ReadS [GetMonitoringSubscription]
-> ReadPrec GetMonitoringSubscription
-> ReadPrec [GetMonitoringSubscription]
-> Read GetMonitoringSubscription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetMonitoringSubscription]
$creadListPrec :: ReadPrec [GetMonitoringSubscription]
readPrec :: ReadPrec GetMonitoringSubscription
$creadPrec :: ReadPrec GetMonitoringSubscription
readList :: ReadS [GetMonitoringSubscription]
$creadList :: ReadS [GetMonitoringSubscription]
readsPrec :: Int -> ReadS GetMonitoringSubscription
$creadsPrec :: Int -> ReadS GetMonitoringSubscription
Prelude.Read, Int -> GetMonitoringSubscription -> ShowS
[GetMonitoringSubscription] -> ShowS
GetMonitoringSubscription -> String
(Int -> GetMonitoringSubscription -> ShowS)
-> (GetMonitoringSubscription -> String)
-> ([GetMonitoringSubscription] -> ShowS)
-> Show GetMonitoringSubscription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetMonitoringSubscription] -> ShowS
$cshowList :: [GetMonitoringSubscription] -> ShowS
show :: GetMonitoringSubscription -> String
$cshow :: GetMonitoringSubscription -> String
showsPrec :: Int -> GetMonitoringSubscription -> ShowS
$cshowsPrec :: Int -> GetMonitoringSubscription -> ShowS
Prelude.Show, (forall x.
GetMonitoringSubscription -> Rep GetMonitoringSubscription x)
-> (forall x.
Rep GetMonitoringSubscription x -> GetMonitoringSubscription)
-> Generic GetMonitoringSubscription
forall x.
Rep GetMonitoringSubscription x -> GetMonitoringSubscription
forall x.
GetMonitoringSubscription -> Rep GetMonitoringSubscription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetMonitoringSubscription x -> GetMonitoringSubscription
$cfrom :: forall x.
GetMonitoringSubscription -> Rep GetMonitoringSubscription x
Prelude.Generic)
newGetMonitoringSubscription ::
Prelude.Text ->
GetMonitoringSubscription
newGetMonitoringSubscription :: Text -> GetMonitoringSubscription
newGetMonitoringSubscription Text
pDistributionId_ =
GetMonitoringSubscription' :: Text -> GetMonitoringSubscription
GetMonitoringSubscription'
{ $sel:distributionId:GetMonitoringSubscription' :: Text
distributionId =
Text
pDistributionId_
}
getMonitoringSubscription_distributionId :: Lens.Lens' GetMonitoringSubscription Prelude.Text
getMonitoringSubscription_distributionId :: (Text -> f Text)
-> GetMonitoringSubscription -> f GetMonitoringSubscription
getMonitoringSubscription_distributionId = (GetMonitoringSubscription -> Text)
-> (GetMonitoringSubscription -> Text -> GetMonitoringSubscription)
-> Lens
GetMonitoringSubscription GetMonitoringSubscription Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMonitoringSubscription' {Text
distributionId :: Text
$sel:distributionId:GetMonitoringSubscription' :: GetMonitoringSubscription -> Text
distributionId} -> Text
distributionId) (\s :: GetMonitoringSubscription
s@GetMonitoringSubscription' {} Text
a -> GetMonitoringSubscription
s {$sel:distributionId:GetMonitoringSubscription' :: Text
distributionId = Text
a} :: GetMonitoringSubscription)
instance Core.AWSRequest GetMonitoringSubscription where
type
AWSResponse GetMonitoringSubscription =
GetMonitoringSubscriptionResponse
request :: GetMonitoringSubscription -> Request GetMonitoringSubscription
request = Service
-> GetMonitoringSubscription -> Request GetMonitoringSubscription
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetMonitoringSubscription
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetMonitoringSubscription)))
response =
(Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse GetMonitoringSubscription))
-> Logger
-> Service
-> Proxy GetMonitoringSubscription
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetMonitoringSubscription)))
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 -> GetMonitoringSubscriptionResponse
GetMonitoringSubscriptionResponse'
(Maybe MonitoringSubscription
-> Int -> GetMonitoringSubscriptionResponse)
-> Either String (Maybe MonitoringSubscription)
-> Either String (Int -> GetMonitoringSubscriptionResponse)
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 -> GetMonitoringSubscriptionResponse)
-> Either String Int
-> Either String GetMonitoringSubscriptionResponse
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 GetMonitoringSubscription
instance Prelude.NFData GetMonitoringSubscription
instance Core.ToHeaders GetMonitoringSubscription where
toHeaders :: GetMonitoringSubscription -> ResponseHeaders
toHeaders = ResponseHeaders -> GetMonitoringSubscription -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath GetMonitoringSubscription where
toPath :: GetMonitoringSubscription -> ByteString
toPath GetMonitoringSubscription' {Text
distributionId :: Text
$sel:distributionId:GetMonitoringSubscription' :: GetMonitoringSubscription -> Text
..} =
[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 GetMonitoringSubscription where
toQuery :: GetMonitoringSubscription -> QueryString
toQuery = QueryString -> GetMonitoringSubscription -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetMonitoringSubscriptionResponse = GetMonitoringSubscriptionResponse'
{
GetMonitoringSubscriptionResponse -> Maybe MonitoringSubscription
monitoringSubscription :: Prelude.Maybe MonitoringSubscription,
GetMonitoringSubscriptionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetMonitoringSubscriptionResponse
-> GetMonitoringSubscriptionResponse -> Bool
(GetMonitoringSubscriptionResponse
-> GetMonitoringSubscriptionResponse -> Bool)
-> (GetMonitoringSubscriptionResponse
-> GetMonitoringSubscriptionResponse -> Bool)
-> Eq GetMonitoringSubscriptionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetMonitoringSubscriptionResponse
-> GetMonitoringSubscriptionResponse -> Bool
$c/= :: GetMonitoringSubscriptionResponse
-> GetMonitoringSubscriptionResponse -> Bool
== :: GetMonitoringSubscriptionResponse
-> GetMonitoringSubscriptionResponse -> Bool
$c== :: GetMonitoringSubscriptionResponse
-> GetMonitoringSubscriptionResponse -> Bool
Prelude.Eq, ReadPrec [GetMonitoringSubscriptionResponse]
ReadPrec GetMonitoringSubscriptionResponse
Int -> ReadS GetMonitoringSubscriptionResponse
ReadS [GetMonitoringSubscriptionResponse]
(Int -> ReadS GetMonitoringSubscriptionResponse)
-> ReadS [GetMonitoringSubscriptionResponse]
-> ReadPrec GetMonitoringSubscriptionResponse
-> ReadPrec [GetMonitoringSubscriptionResponse]
-> Read GetMonitoringSubscriptionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetMonitoringSubscriptionResponse]
$creadListPrec :: ReadPrec [GetMonitoringSubscriptionResponse]
readPrec :: ReadPrec GetMonitoringSubscriptionResponse
$creadPrec :: ReadPrec GetMonitoringSubscriptionResponse
readList :: ReadS [GetMonitoringSubscriptionResponse]
$creadList :: ReadS [GetMonitoringSubscriptionResponse]
readsPrec :: Int -> ReadS GetMonitoringSubscriptionResponse
$creadsPrec :: Int -> ReadS GetMonitoringSubscriptionResponse
Prelude.Read, Int -> GetMonitoringSubscriptionResponse -> ShowS
[GetMonitoringSubscriptionResponse] -> ShowS
GetMonitoringSubscriptionResponse -> String
(Int -> GetMonitoringSubscriptionResponse -> ShowS)
-> (GetMonitoringSubscriptionResponse -> String)
-> ([GetMonitoringSubscriptionResponse] -> ShowS)
-> Show GetMonitoringSubscriptionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetMonitoringSubscriptionResponse] -> ShowS
$cshowList :: [GetMonitoringSubscriptionResponse] -> ShowS
show :: GetMonitoringSubscriptionResponse -> String
$cshow :: GetMonitoringSubscriptionResponse -> String
showsPrec :: Int -> GetMonitoringSubscriptionResponse -> ShowS
$cshowsPrec :: Int -> GetMonitoringSubscriptionResponse -> ShowS
Prelude.Show, (forall x.
GetMonitoringSubscriptionResponse
-> Rep GetMonitoringSubscriptionResponse x)
-> (forall x.
Rep GetMonitoringSubscriptionResponse x
-> GetMonitoringSubscriptionResponse)
-> Generic GetMonitoringSubscriptionResponse
forall x.
Rep GetMonitoringSubscriptionResponse x
-> GetMonitoringSubscriptionResponse
forall x.
GetMonitoringSubscriptionResponse
-> Rep GetMonitoringSubscriptionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetMonitoringSubscriptionResponse x
-> GetMonitoringSubscriptionResponse
$cfrom :: forall x.
GetMonitoringSubscriptionResponse
-> Rep GetMonitoringSubscriptionResponse x
Prelude.Generic)
newGetMonitoringSubscriptionResponse ::
Prelude.Int ->
GetMonitoringSubscriptionResponse
newGetMonitoringSubscriptionResponse :: Int -> GetMonitoringSubscriptionResponse
newGetMonitoringSubscriptionResponse Int
pHttpStatus_ =
GetMonitoringSubscriptionResponse' :: Maybe MonitoringSubscription
-> Int -> GetMonitoringSubscriptionResponse
GetMonitoringSubscriptionResponse'
{ $sel:monitoringSubscription:GetMonitoringSubscriptionResponse' :: Maybe MonitoringSubscription
monitoringSubscription =
Maybe MonitoringSubscription
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetMonitoringSubscriptionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getMonitoringSubscriptionResponse_monitoringSubscription :: Lens.Lens' GetMonitoringSubscriptionResponse (Prelude.Maybe MonitoringSubscription)
getMonitoringSubscriptionResponse_monitoringSubscription :: (Maybe MonitoringSubscription -> f (Maybe MonitoringSubscription))
-> GetMonitoringSubscriptionResponse
-> f GetMonitoringSubscriptionResponse
getMonitoringSubscriptionResponse_monitoringSubscription = (GetMonitoringSubscriptionResponse -> Maybe MonitoringSubscription)
-> (GetMonitoringSubscriptionResponse
-> Maybe MonitoringSubscription
-> GetMonitoringSubscriptionResponse)
-> Lens
GetMonitoringSubscriptionResponse
GetMonitoringSubscriptionResponse
(Maybe MonitoringSubscription)
(Maybe MonitoringSubscription)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMonitoringSubscriptionResponse' {Maybe MonitoringSubscription
monitoringSubscription :: Maybe MonitoringSubscription
$sel:monitoringSubscription:GetMonitoringSubscriptionResponse' :: GetMonitoringSubscriptionResponse -> Maybe MonitoringSubscription
monitoringSubscription} -> Maybe MonitoringSubscription
monitoringSubscription) (\s :: GetMonitoringSubscriptionResponse
s@GetMonitoringSubscriptionResponse' {} Maybe MonitoringSubscription
a -> GetMonitoringSubscriptionResponse
s {$sel:monitoringSubscription:GetMonitoringSubscriptionResponse' :: Maybe MonitoringSubscription
monitoringSubscription = Maybe MonitoringSubscription
a} :: GetMonitoringSubscriptionResponse)
getMonitoringSubscriptionResponse_httpStatus :: Lens.Lens' GetMonitoringSubscriptionResponse Prelude.Int
getMonitoringSubscriptionResponse_httpStatus :: (Int -> f Int)
-> GetMonitoringSubscriptionResponse
-> f GetMonitoringSubscriptionResponse
getMonitoringSubscriptionResponse_httpStatus = (GetMonitoringSubscriptionResponse -> Int)
-> (GetMonitoringSubscriptionResponse
-> Int -> GetMonitoringSubscriptionResponse)
-> Lens
GetMonitoringSubscriptionResponse
GetMonitoringSubscriptionResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMonitoringSubscriptionResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetMonitoringSubscriptionResponse' :: GetMonitoringSubscriptionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetMonitoringSubscriptionResponse
s@GetMonitoringSubscriptionResponse' {} Int
a -> GetMonitoringSubscriptionResponse
s {$sel:httpStatus:GetMonitoringSubscriptionResponse' :: Int
httpStatus = Int
a} :: GetMonitoringSubscriptionResponse)
instance
Prelude.NFData
GetMonitoringSubscriptionResponse