{-# 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.GetDistribution
(
GetDistribution (..),
newGetDistribution,
getDistribution_id,
GetDistributionResponse (..),
newGetDistributionResponse,
getDistributionResponse_distribution,
getDistributionResponse_eTag,
getDistributionResponse_httpStatus,
)
where
import Amazonka.CloudFront.Types
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
data GetDistribution = GetDistribution'
{
GetDistribution -> Text
id :: Prelude.Text
}
deriving (GetDistribution -> GetDistribution -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDistribution -> GetDistribution -> Bool
$c/= :: GetDistribution -> GetDistribution -> Bool
== :: GetDistribution -> GetDistribution -> Bool
$c== :: GetDistribution -> GetDistribution -> Bool
Prelude.Eq, ReadPrec [GetDistribution]
ReadPrec GetDistribution
Int -> ReadS GetDistribution
ReadS [GetDistribution]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDistribution]
$creadListPrec :: ReadPrec [GetDistribution]
readPrec :: ReadPrec GetDistribution
$creadPrec :: ReadPrec GetDistribution
readList :: ReadS [GetDistribution]
$creadList :: ReadS [GetDistribution]
readsPrec :: Int -> ReadS GetDistribution
$creadsPrec :: Int -> ReadS GetDistribution
Prelude.Read, Int -> GetDistribution -> ShowS
[GetDistribution] -> ShowS
GetDistribution -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDistribution] -> ShowS
$cshowList :: [GetDistribution] -> ShowS
show :: GetDistribution -> String
$cshow :: GetDistribution -> String
showsPrec :: Int -> GetDistribution -> ShowS
$cshowsPrec :: Int -> GetDistribution -> ShowS
Prelude.Show, forall x. Rep GetDistribution x -> GetDistribution
forall x. GetDistribution -> Rep GetDistribution x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetDistribution x -> GetDistribution
$cfrom :: forall x. GetDistribution -> Rep GetDistribution x
Prelude.Generic)
newGetDistribution ::
Prelude.Text ->
GetDistribution
newGetDistribution :: Text -> GetDistribution
newGetDistribution Text
pId_ = GetDistribution' {$sel:id:GetDistribution' :: Text
id = Text
pId_}
getDistribution_id :: Lens.Lens' GetDistribution Prelude.Text
getDistribution_id :: Lens' GetDistribution Text
getDistribution_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDistribution' {Text
id :: Text
$sel:id:GetDistribution' :: GetDistribution -> Text
id} -> Text
id) (\s :: GetDistribution
s@GetDistribution' {} Text
a -> GetDistribution
s {$sel:id:GetDistribution' :: Text
id = Text
a} :: GetDistribution)
instance Core.AWSRequest GetDistribution where
type
AWSResponse GetDistribution =
GetDistributionResponse
request :: (Service -> Service) -> GetDistribution -> Request GetDistribution
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetDistribution
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetDistribution)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Distribution -> Maybe Text -> Int -> GetDistributionResponse
GetDistributionResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall a. FromXML a => [Node] -> Either String a
Data.parseXML [Node]
x)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (ResponseHeaders
h forall a.
FromText a =>
ResponseHeaders -> HeaderName -> Either String (Maybe a)
Data..#? HeaderName
"ETag")
forall (f :: * -> *) a b. Applicative f => 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 GetDistribution where
hashWithSalt :: Int -> GetDistribution -> Int
hashWithSalt Int
_salt GetDistribution' {Text
id :: Text
$sel:id:GetDistribution' :: GetDistribution -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
instance Prelude.NFData GetDistribution where
rnf :: GetDistribution -> ()
rnf GetDistribution' {Text
id :: Text
$sel:id:GetDistribution' :: GetDistribution -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
id
instance Data.ToHeaders GetDistribution where
toHeaders :: GetDistribution -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath GetDistribution where
toPath :: GetDistribution -> ByteString
toPath GetDistribution' {Text
id :: Text
$sel:id:GetDistribution' :: GetDistribution -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/2020-05-31/distribution/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
id]
instance Data.ToQuery GetDistribution where
toQuery :: GetDistribution -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetDistributionResponse = GetDistributionResponse'
{
GetDistributionResponse -> Maybe Distribution
distribution :: Prelude.Maybe Distribution,
GetDistributionResponse -> Maybe Text
eTag :: Prelude.Maybe Prelude.Text,
GetDistributionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetDistributionResponse -> GetDistributionResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDistributionResponse -> GetDistributionResponse -> Bool
$c/= :: GetDistributionResponse -> GetDistributionResponse -> Bool
== :: GetDistributionResponse -> GetDistributionResponse -> Bool
$c== :: GetDistributionResponse -> GetDistributionResponse -> Bool
Prelude.Eq, Int -> GetDistributionResponse -> ShowS
[GetDistributionResponse] -> ShowS
GetDistributionResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDistributionResponse] -> ShowS
$cshowList :: [GetDistributionResponse] -> ShowS
show :: GetDistributionResponse -> String
$cshow :: GetDistributionResponse -> String
showsPrec :: Int -> GetDistributionResponse -> ShowS
$cshowsPrec :: Int -> GetDistributionResponse -> ShowS
Prelude.Show, forall x. Rep GetDistributionResponse x -> GetDistributionResponse
forall x. GetDistributionResponse -> Rep GetDistributionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetDistributionResponse x -> GetDistributionResponse
$cfrom :: forall x. GetDistributionResponse -> Rep GetDistributionResponse x
Prelude.Generic)
newGetDistributionResponse ::
Prelude.Int ->
GetDistributionResponse
newGetDistributionResponse :: Int -> GetDistributionResponse
newGetDistributionResponse Int
pHttpStatus_ =
GetDistributionResponse'
{ $sel:distribution:GetDistributionResponse' :: Maybe Distribution
distribution =
forall a. Maybe a
Prelude.Nothing,
$sel:eTag:GetDistributionResponse' :: Maybe Text
eTag = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetDistributionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getDistributionResponse_distribution :: Lens.Lens' GetDistributionResponse (Prelude.Maybe Distribution)
getDistributionResponse_distribution :: Lens' GetDistributionResponse (Maybe Distribution)
getDistributionResponse_distribution = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDistributionResponse' {Maybe Distribution
distribution :: Maybe Distribution
$sel:distribution:GetDistributionResponse' :: GetDistributionResponse -> Maybe Distribution
distribution} -> Maybe Distribution
distribution) (\s :: GetDistributionResponse
s@GetDistributionResponse' {} Maybe Distribution
a -> GetDistributionResponse
s {$sel:distribution:GetDistributionResponse' :: Maybe Distribution
distribution = Maybe Distribution
a} :: GetDistributionResponse)
getDistributionResponse_eTag :: Lens.Lens' GetDistributionResponse (Prelude.Maybe Prelude.Text)
getDistributionResponse_eTag :: Lens' GetDistributionResponse (Maybe Text)
getDistributionResponse_eTag = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDistributionResponse' {Maybe Text
eTag :: Maybe Text
$sel:eTag:GetDistributionResponse' :: GetDistributionResponse -> Maybe Text
eTag} -> Maybe Text
eTag) (\s :: GetDistributionResponse
s@GetDistributionResponse' {} Maybe Text
a -> GetDistributionResponse
s {$sel:eTag:GetDistributionResponse' :: Maybe Text
eTag = Maybe Text
a} :: GetDistributionResponse)
getDistributionResponse_httpStatus :: Lens.Lens' GetDistributionResponse Prelude.Int
getDistributionResponse_httpStatus :: Lens' GetDistributionResponse Int
getDistributionResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDistributionResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetDistributionResponse' :: GetDistributionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetDistributionResponse
s@GetDistributionResponse' {} Int
a -> GetDistributionResponse
s {$sel:httpStatus:GetDistributionResponse' :: Int
httpStatus = Int
a} :: GetDistributionResponse)
instance Prelude.NFData GetDistributionResponse where
rnf :: GetDistributionResponse -> ()
rnf GetDistributionResponse' {Int
Maybe Text
Maybe Distribution
httpStatus :: Int
eTag :: Maybe Text
distribution :: Maybe Distribution
$sel:httpStatus:GetDistributionResponse' :: GetDistributionResponse -> Int
$sel:eTag:GetDistributionResponse' :: GetDistributionResponse -> Maybe Text
$sel:distribution:GetDistributionResponse' :: GetDistributionResponse -> Maybe Distribution
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Distribution
distribution
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
eTag
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus