{-# 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.GetInvalidation
(
GetInvalidation (..),
newGetInvalidation,
getInvalidation_distributionId,
getInvalidation_id,
GetInvalidationResponse (..),
newGetInvalidationResponse,
getInvalidationResponse_invalidation,
getInvalidationResponse_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 GetInvalidation = GetInvalidation'
{
GetInvalidation -> Text
distributionId :: Prelude.Text,
GetInvalidation -> Text
id :: Prelude.Text
}
deriving (GetInvalidation -> GetInvalidation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetInvalidation -> GetInvalidation -> Bool
$c/= :: GetInvalidation -> GetInvalidation -> Bool
== :: GetInvalidation -> GetInvalidation -> Bool
$c== :: GetInvalidation -> GetInvalidation -> Bool
Prelude.Eq, ReadPrec [GetInvalidation]
ReadPrec GetInvalidation
Int -> ReadS GetInvalidation
ReadS [GetInvalidation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetInvalidation]
$creadListPrec :: ReadPrec [GetInvalidation]
readPrec :: ReadPrec GetInvalidation
$creadPrec :: ReadPrec GetInvalidation
readList :: ReadS [GetInvalidation]
$creadList :: ReadS [GetInvalidation]
readsPrec :: Int -> ReadS GetInvalidation
$creadsPrec :: Int -> ReadS GetInvalidation
Prelude.Read, Int -> GetInvalidation -> ShowS
[GetInvalidation] -> ShowS
GetInvalidation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetInvalidation] -> ShowS
$cshowList :: [GetInvalidation] -> ShowS
show :: GetInvalidation -> String
$cshow :: GetInvalidation -> String
showsPrec :: Int -> GetInvalidation -> ShowS
$cshowsPrec :: Int -> GetInvalidation -> ShowS
Prelude.Show, forall x. Rep GetInvalidation x -> GetInvalidation
forall x. GetInvalidation -> Rep GetInvalidation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetInvalidation x -> GetInvalidation
$cfrom :: forall x. GetInvalidation -> Rep GetInvalidation x
Prelude.Generic)
newGetInvalidation ::
Prelude.Text ->
Prelude.Text ->
GetInvalidation
newGetInvalidation :: Text -> Text -> GetInvalidation
newGetInvalidation Text
pDistributionId_ Text
pId_ =
GetInvalidation'
{ $sel:distributionId:GetInvalidation' :: Text
distributionId = Text
pDistributionId_,
$sel:id:GetInvalidation' :: Text
id = Text
pId_
}
getInvalidation_distributionId :: Lens.Lens' GetInvalidation Prelude.Text
getInvalidation_distributionId :: Lens' GetInvalidation Text
getInvalidation_distributionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInvalidation' {Text
distributionId :: Text
$sel:distributionId:GetInvalidation' :: GetInvalidation -> Text
distributionId} -> Text
distributionId) (\s :: GetInvalidation
s@GetInvalidation' {} Text
a -> GetInvalidation
s {$sel:distributionId:GetInvalidation' :: Text
distributionId = Text
a} :: GetInvalidation)
getInvalidation_id :: Lens.Lens' GetInvalidation Prelude.Text
getInvalidation_id :: Lens' GetInvalidation Text
getInvalidation_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInvalidation' {Text
id :: Text
$sel:id:GetInvalidation' :: GetInvalidation -> Text
id} -> Text
id) (\s :: GetInvalidation
s@GetInvalidation' {} Text
a -> GetInvalidation
s {$sel:id:GetInvalidation' :: Text
id = Text
a} :: GetInvalidation)
instance Core.AWSRequest GetInvalidation where
type
AWSResponse GetInvalidation =
GetInvalidationResponse
request :: (Service -> Service) -> GetInvalidation -> Request GetInvalidation
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 GetInvalidation
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetInvalidation)))
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 Invalidation -> Int -> GetInvalidationResponse
GetInvalidationResponse'
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.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetInvalidation where
hashWithSalt :: Int -> GetInvalidation -> Int
hashWithSalt Int
_salt GetInvalidation' {Text
id :: Text
distributionId :: Text
$sel:id:GetInvalidation' :: GetInvalidation -> Text
$sel:distributionId:GetInvalidation' :: GetInvalidation -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
distributionId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
instance Prelude.NFData GetInvalidation where
rnf :: GetInvalidation -> ()
rnf GetInvalidation' {Text
id :: Text
distributionId :: Text
$sel:id:GetInvalidation' :: GetInvalidation -> Text
$sel:distributionId:GetInvalidation' :: GetInvalidation -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
distributionId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
id
instance Data.ToHeaders GetInvalidation where
toHeaders :: GetInvalidation -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath GetInvalidation where
toPath :: GetInvalidation -> ByteString
toPath GetInvalidation' {Text
id :: Text
distributionId :: Text
$sel:id:GetInvalidation' :: GetInvalidation -> Text
$sel:distributionId:GetInvalidation' :: GetInvalidation -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/2020-05-31/distribution/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
distributionId,
ByteString
"/invalidation/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
id
]
instance Data.ToQuery GetInvalidation where
toQuery :: GetInvalidation -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetInvalidationResponse = GetInvalidationResponse'
{
GetInvalidationResponse -> Maybe Invalidation
invalidation :: Prelude.Maybe Invalidation,
GetInvalidationResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetInvalidationResponse -> GetInvalidationResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetInvalidationResponse -> GetInvalidationResponse -> Bool
$c/= :: GetInvalidationResponse -> GetInvalidationResponse -> Bool
== :: GetInvalidationResponse -> GetInvalidationResponse -> Bool
$c== :: GetInvalidationResponse -> GetInvalidationResponse -> Bool
Prelude.Eq, ReadPrec [GetInvalidationResponse]
ReadPrec GetInvalidationResponse
Int -> ReadS GetInvalidationResponse
ReadS [GetInvalidationResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetInvalidationResponse]
$creadListPrec :: ReadPrec [GetInvalidationResponse]
readPrec :: ReadPrec GetInvalidationResponse
$creadPrec :: ReadPrec GetInvalidationResponse
readList :: ReadS [GetInvalidationResponse]
$creadList :: ReadS [GetInvalidationResponse]
readsPrec :: Int -> ReadS GetInvalidationResponse
$creadsPrec :: Int -> ReadS GetInvalidationResponse
Prelude.Read, Int -> GetInvalidationResponse -> ShowS
[GetInvalidationResponse] -> ShowS
GetInvalidationResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetInvalidationResponse] -> ShowS
$cshowList :: [GetInvalidationResponse] -> ShowS
show :: GetInvalidationResponse -> String
$cshow :: GetInvalidationResponse -> String
showsPrec :: Int -> GetInvalidationResponse -> ShowS
$cshowsPrec :: Int -> GetInvalidationResponse -> ShowS
Prelude.Show, forall x. Rep GetInvalidationResponse x -> GetInvalidationResponse
forall x. GetInvalidationResponse -> Rep GetInvalidationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetInvalidationResponse x -> GetInvalidationResponse
$cfrom :: forall x. GetInvalidationResponse -> Rep GetInvalidationResponse x
Prelude.Generic)
newGetInvalidationResponse ::
Prelude.Int ->
GetInvalidationResponse
newGetInvalidationResponse :: Int -> GetInvalidationResponse
newGetInvalidationResponse Int
pHttpStatus_ =
GetInvalidationResponse'
{ $sel:invalidation:GetInvalidationResponse' :: Maybe Invalidation
invalidation =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetInvalidationResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getInvalidationResponse_invalidation :: Lens.Lens' GetInvalidationResponse (Prelude.Maybe Invalidation)
getInvalidationResponse_invalidation :: Lens' GetInvalidationResponse (Maybe Invalidation)
getInvalidationResponse_invalidation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInvalidationResponse' {Maybe Invalidation
invalidation :: Maybe Invalidation
$sel:invalidation:GetInvalidationResponse' :: GetInvalidationResponse -> Maybe Invalidation
invalidation} -> Maybe Invalidation
invalidation) (\s :: GetInvalidationResponse
s@GetInvalidationResponse' {} Maybe Invalidation
a -> GetInvalidationResponse
s {$sel:invalidation:GetInvalidationResponse' :: Maybe Invalidation
invalidation = Maybe Invalidation
a} :: GetInvalidationResponse)
getInvalidationResponse_httpStatus :: Lens.Lens' GetInvalidationResponse Prelude.Int
getInvalidationResponse_httpStatus :: Lens' GetInvalidationResponse Int
getInvalidationResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInvalidationResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetInvalidationResponse' :: GetInvalidationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetInvalidationResponse
s@GetInvalidationResponse' {} Int
a -> GetInvalidationResponse
s {$sel:httpStatus:GetInvalidationResponse' :: Int
httpStatus = Int
a} :: GetInvalidationResponse)
instance Prelude.NFData GetInvalidationResponse where
rnf :: GetInvalidationResponse -> ()
rnf GetInvalidationResponse' {Int
Maybe Invalidation
httpStatus :: Int
invalidation :: Maybe Invalidation
$sel:httpStatus:GetInvalidationResponse' :: GetInvalidationResponse -> Int
$sel:invalidation:GetInvalidationResponse' :: GetInvalidationResponse -> Maybe Invalidation
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Invalidation
invalidation
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus