{-# 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.UpdateDistribution
(
UpdateDistribution (..),
newUpdateDistribution,
updateDistribution_ifMatch,
updateDistribution_distributionConfig,
updateDistribution_id,
UpdateDistributionResponse (..),
newUpdateDistributionResponse,
updateDistributionResponse_eTag,
updateDistributionResponse_distribution,
updateDistributionResponse_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 UpdateDistribution = UpdateDistribution'
{
UpdateDistribution -> Maybe Text
ifMatch :: Prelude.Maybe Prelude.Text,
UpdateDistribution -> DistributionConfig
distributionConfig :: DistributionConfig,
UpdateDistribution -> Text
id :: Prelude.Text
}
deriving (UpdateDistribution -> UpdateDistribution -> Bool
(UpdateDistribution -> UpdateDistribution -> Bool)
-> (UpdateDistribution -> UpdateDistribution -> Bool)
-> Eq UpdateDistribution
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateDistribution -> UpdateDistribution -> Bool
$c/= :: UpdateDistribution -> UpdateDistribution -> Bool
== :: UpdateDistribution -> UpdateDistribution -> Bool
$c== :: UpdateDistribution -> UpdateDistribution -> Bool
Prelude.Eq, Int -> UpdateDistribution -> ShowS
[UpdateDistribution] -> ShowS
UpdateDistribution -> String
(Int -> UpdateDistribution -> ShowS)
-> (UpdateDistribution -> String)
-> ([UpdateDistribution] -> ShowS)
-> Show UpdateDistribution
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateDistribution] -> ShowS
$cshowList :: [UpdateDistribution] -> ShowS
show :: UpdateDistribution -> String
$cshow :: UpdateDistribution -> String
showsPrec :: Int -> UpdateDistribution -> ShowS
$cshowsPrec :: Int -> UpdateDistribution -> ShowS
Prelude.Show, (forall x. UpdateDistribution -> Rep UpdateDistribution x)
-> (forall x. Rep UpdateDistribution x -> UpdateDistribution)
-> Generic UpdateDistribution
forall x. Rep UpdateDistribution x -> UpdateDistribution
forall x. UpdateDistribution -> Rep UpdateDistribution x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateDistribution x -> UpdateDistribution
$cfrom :: forall x. UpdateDistribution -> Rep UpdateDistribution x
Prelude.Generic)
newUpdateDistribution ::
DistributionConfig ->
Prelude.Text ->
UpdateDistribution
newUpdateDistribution :: DistributionConfig -> Text -> UpdateDistribution
newUpdateDistribution DistributionConfig
pDistributionConfig_ Text
pId_ =
UpdateDistribution' :: Maybe Text -> DistributionConfig -> Text -> UpdateDistribution
UpdateDistribution'
{ $sel:ifMatch:UpdateDistribution' :: Maybe Text
ifMatch = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:distributionConfig:UpdateDistribution' :: DistributionConfig
distributionConfig = DistributionConfig
pDistributionConfig_,
$sel:id:UpdateDistribution' :: Text
id = Text
pId_
}
updateDistribution_ifMatch :: Lens.Lens' UpdateDistribution (Prelude.Maybe Prelude.Text)
updateDistribution_ifMatch :: (Maybe Text -> f (Maybe Text))
-> UpdateDistribution -> f UpdateDistribution
updateDistribution_ifMatch = (UpdateDistribution -> Maybe Text)
-> (UpdateDistribution -> Maybe Text -> UpdateDistribution)
-> Lens
UpdateDistribution UpdateDistribution (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDistribution' {Maybe Text
ifMatch :: Maybe Text
$sel:ifMatch:UpdateDistribution' :: UpdateDistribution -> Maybe Text
ifMatch} -> Maybe Text
ifMatch) (\s :: UpdateDistribution
s@UpdateDistribution' {} Maybe Text
a -> UpdateDistribution
s {$sel:ifMatch:UpdateDistribution' :: Maybe Text
ifMatch = Maybe Text
a} :: UpdateDistribution)
updateDistribution_distributionConfig :: Lens.Lens' UpdateDistribution DistributionConfig
updateDistribution_distributionConfig :: (DistributionConfig -> f DistributionConfig)
-> UpdateDistribution -> f UpdateDistribution
updateDistribution_distributionConfig = (UpdateDistribution -> DistributionConfig)
-> (UpdateDistribution -> DistributionConfig -> UpdateDistribution)
-> Lens
UpdateDistribution
UpdateDistribution
DistributionConfig
DistributionConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDistribution' {DistributionConfig
distributionConfig :: DistributionConfig
$sel:distributionConfig:UpdateDistribution' :: UpdateDistribution -> DistributionConfig
distributionConfig} -> DistributionConfig
distributionConfig) (\s :: UpdateDistribution
s@UpdateDistribution' {} DistributionConfig
a -> UpdateDistribution
s {$sel:distributionConfig:UpdateDistribution' :: DistributionConfig
distributionConfig = DistributionConfig
a} :: UpdateDistribution)
updateDistribution_id :: Lens.Lens' UpdateDistribution Prelude.Text
updateDistribution_id :: (Text -> f Text) -> UpdateDistribution -> f UpdateDistribution
updateDistribution_id = (UpdateDistribution -> Text)
-> (UpdateDistribution -> Text -> UpdateDistribution)
-> Lens UpdateDistribution UpdateDistribution Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDistribution' {Text
id :: Text
$sel:id:UpdateDistribution' :: UpdateDistribution -> Text
id} -> Text
id) (\s :: UpdateDistribution
s@UpdateDistribution' {} Text
a -> UpdateDistribution
s {$sel:id:UpdateDistribution' :: Text
id = Text
a} :: UpdateDistribution)
instance Core.AWSRequest UpdateDistribution where
type
AWSResponse UpdateDistribution =
UpdateDistributionResponse
request :: UpdateDistribution -> Request UpdateDistribution
request = Service -> UpdateDistribution -> Request UpdateDistribution
forall a. (ToRequest a, ToElement a) => Service -> a -> Request a
Request.putXML Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateDistribution
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateDistribution)))
response =
(Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse UpdateDistribution))
-> Logger
-> Service
-> Proxy UpdateDistribution
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateDistribution)))
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 Text
-> Maybe Distribution -> Int -> UpdateDistributionResponse
UpdateDistributionResponse'
(Maybe Text
-> Maybe Distribution -> Int -> UpdateDistributionResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe Distribution -> Int -> UpdateDistributionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (ResponseHeaders
h ResponseHeaders -> HeaderName -> Either String (Maybe Text)
forall a.
FromText a =>
ResponseHeaders -> HeaderName -> Either String (Maybe a)
Core..#? HeaderName
"ETag")
Either
String (Maybe Distribution -> Int -> UpdateDistributionResponse)
-> Either String (Maybe Distribution)
-> Either String (Int -> UpdateDistributionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node] -> Either String (Maybe Distribution)
forall a. FromXML a => [Node] -> Either String a
Core.parseXML [Node]
x)
Either String (Int -> UpdateDistributionResponse)
-> Either String Int -> Either String UpdateDistributionResponse
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 UpdateDistribution
instance Prelude.NFData UpdateDistribution
instance Core.ToElement UpdateDistribution where
toElement :: UpdateDistribution -> Element
toElement UpdateDistribution' {Maybe Text
Text
DistributionConfig
id :: Text
distributionConfig :: DistributionConfig
ifMatch :: Maybe Text
$sel:id:UpdateDistribution' :: UpdateDistribution -> Text
$sel:distributionConfig:UpdateDistribution' :: UpdateDistribution -> DistributionConfig
$sel:ifMatch:UpdateDistribution' :: UpdateDistribution -> Maybe Text
..} =
Name -> DistributionConfig -> Element
forall a. ToXML a => Name -> a -> Element
Core.mkElement
Name
"{http://cloudfront.amazonaws.com/doc/2020-05-31/}DistributionConfig"
DistributionConfig
distributionConfig
instance Core.ToHeaders UpdateDistribution where
toHeaders :: UpdateDistribution -> ResponseHeaders
toHeaders UpdateDistribution' {Maybe Text
Text
DistributionConfig
id :: Text
distributionConfig :: DistributionConfig
ifMatch :: Maybe Text
$sel:id:UpdateDistribution' :: UpdateDistribution -> Text
$sel:distributionConfig:UpdateDistribution' :: UpdateDistribution -> DistributionConfig
$sel:ifMatch:UpdateDistribution' :: UpdateDistribution -> Maybe Text
..} =
[ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat [HeaderName
"If-Match" HeaderName -> Maybe Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe Text
ifMatch]
instance Core.ToPath UpdateDistribution where
toPath :: UpdateDistribution -> ByteString
toPath UpdateDistribution' {Maybe Text
Text
DistributionConfig
id :: Text
distributionConfig :: DistributionConfig
ifMatch :: Maybe Text
$sel:id:UpdateDistribution' :: UpdateDistribution -> Text
$sel:distributionConfig:UpdateDistribution' :: UpdateDistribution -> DistributionConfig
$sel:ifMatch:UpdateDistribution' :: UpdateDistribution -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/2020-05-31/distribution/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
id,
ByteString
"/config"
]
instance Core.ToQuery UpdateDistribution where
toQuery :: UpdateDistribution -> QueryString
toQuery = QueryString -> UpdateDistribution -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateDistributionResponse = UpdateDistributionResponse'
{
UpdateDistributionResponse -> Maybe Text
eTag :: Prelude.Maybe Prelude.Text,
UpdateDistributionResponse -> Maybe Distribution
distribution :: Prelude.Maybe Distribution,
UpdateDistributionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateDistributionResponse -> UpdateDistributionResponse -> Bool
(UpdateDistributionResponse -> UpdateDistributionResponse -> Bool)
-> (UpdateDistributionResponse
-> UpdateDistributionResponse -> Bool)
-> Eq UpdateDistributionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateDistributionResponse -> UpdateDistributionResponse -> Bool
$c/= :: UpdateDistributionResponse -> UpdateDistributionResponse -> Bool
== :: UpdateDistributionResponse -> UpdateDistributionResponse -> Bool
$c== :: UpdateDistributionResponse -> UpdateDistributionResponse -> Bool
Prelude.Eq, Int -> UpdateDistributionResponse -> ShowS
[UpdateDistributionResponse] -> ShowS
UpdateDistributionResponse -> String
(Int -> UpdateDistributionResponse -> ShowS)
-> (UpdateDistributionResponse -> String)
-> ([UpdateDistributionResponse] -> ShowS)
-> Show UpdateDistributionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateDistributionResponse] -> ShowS
$cshowList :: [UpdateDistributionResponse] -> ShowS
show :: UpdateDistributionResponse -> String
$cshow :: UpdateDistributionResponse -> String
showsPrec :: Int -> UpdateDistributionResponse -> ShowS
$cshowsPrec :: Int -> UpdateDistributionResponse -> ShowS
Prelude.Show, (forall x.
UpdateDistributionResponse -> Rep UpdateDistributionResponse x)
-> (forall x.
Rep UpdateDistributionResponse x -> UpdateDistributionResponse)
-> Generic UpdateDistributionResponse
forall x.
Rep UpdateDistributionResponse x -> UpdateDistributionResponse
forall x.
UpdateDistributionResponse -> Rep UpdateDistributionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateDistributionResponse x -> UpdateDistributionResponse
$cfrom :: forall x.
UpdateDistributionResponse -> Rep UpdateDistributionResponse x
Prelude.Generic)
newUpdateDistributionResponse ::
Prelude.Int ->
UpdateDistributionResponse
newUpdateDistributionResponse :: Int -> UpdateDistributionResponse
newUpdateDistributionResponse Int
pHttpStatus_ =
UpdateDistributionResponse' :: Maybe Text
-> Maybe Distribution -> Int -> UpdateDistributionResponse
UpdateDistributionResponse'
{ $sel:eTag:UpdateDistributionResponse' :: Maybe Text
eTag = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:distribution:UpdateDistributionResponse' :: Maybe Distribution
distribution = Maybe Distribution
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateDistributionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateDistributionResponse_eTag :: Lens.Lens' UpdateDistributionResponse (Prelude.Maybe Prelude.Text)
updateDistributionResponse_eTag :: (Maybe Text -> f (Maybe Text))
-> UpdateDistributionResponse -> f UpdateDistributionResponse
updateDistributionResponse_eTag = (UpdateDistributionResponse -> Maybe Text)
-> (UpdateDistributionResponse
-> Maybe Text -> UpdateDistributionResponse)
-> Lens
UpdateDistributionResponse
UpdateDistributionResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDistributionResponse' {Maybe Text
eTag :: Maybe Text
$sel:eTag:UpdateDistributionResponse' :: UpdateDistributionResponse -> Maybe Text
eTag} -> Maybe Text
eTag) (\s :: UpdateDistributionResponse
s@UpdateDistributionResponse' {} Maybe Text
a -> UpdateDistributionResponse
s {$sel:eTag:UpdateDistributionResponse' :: Maybe Text
eTag = Maybe Text
a} :: UpdateDistributionResponse)
updateDistributionResponse_distribution :: Lens.Lens' UpdateDistributionResponse (Prelude.Maybe Distribution)
updateDistributionResponse_distribution :: (Maybe Distribution -> f (Maybe Distribution))
-> UpdateDistributionResponse -> f UpdateDistributionResponse
updateDistributionResponse_distribution = (UpdateDistributionResponse -> Maybe Distribution)
-> (UpdateDistributionResponse
-> Maybe Distribution -> UpdateDistributionResponse)
-> Lens
UpdateDistributionResponse
UpdateDistributionResponse
(Maybe Distribution)
(Maybe Distribution)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDistributionResponse' {Maybe Distribution
distribution :: Maybe Distribution
$sel:distribution:UpdateDistributionResponse' :: UpdateDistributionResponse -> Maybe Distribution
distribution} -> Maybe Distribution
distribution) (\s :: UpdateDistributionResponse
s@UpdateDistributionResponse' {} Maybe Distribution
a -> UpdateDistributionResponse
s {$sel:distribution:UpdateDistributionResponse' :: Maybe Distribution
distribution = Maybe Distribution
a} :: UpdateDistributionResponse)
updateDistributionResponse_httpStatus :: Lens.Lens' UpdateDistributionResponse Prelude.Int
updateDistributionResponse_httpStatus :: (Int -> f Int)
-> UpdateDistributionResponse -> f UpdateDistributionResponse
updateDistributionResponse_httpStatus = (UpdateDistributionResponse -> Int)
-> (UpdateDistributionResponse
-> Int -> UpdateDistributionResponse)
-> Lens
UpdateDistributionResponse UpdateDistributionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDistributionResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateDistributionResponse' :: UpdateDistributionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateDistributionResponse
s@UpdateDistributionResponse' {} Int
a -> UpdateDistributionResponse
s {$sel:httpStatus:UpdateDistributionResponse' :: Int
httpStatus = Int
a} :: UpdateDistributionResponse)
instance Prelude.NFData UpdateDistributionResponse