{-# 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.UpdateFunction
(
UpdateFunction (..),
newUpdateFunction,
updateFunction_ifMatch,
updateFunction_functionConfig,
updateFunction_functionCode,
updateFunction_name,
UpdateFunctionResponse (..),
newUpdateFunctionResponse,
updateFunctionResponse_eTag,
updateFunctionResponse_functionSummary,
updateFunctionResponse_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 UpdateFunction = UpdateFunction'
{
UpdateFunction -> Text
ifMatch :: Prelude.Text,
UpdateFunction -> FunctionConfig
functionConfig :: FunctionConfig,
UpdateFunction -> Sensitive Base64
functionCode :: Core.Sensitive Core.Base64,
UpdateFunction -> Text
name :: Prelude.Text
}
deriving (UpdateFunction -> UpdateFunction -> Bool
(UpdateFunction -> UpdateFunction -> Bool)
-> (UpdateFunction -> UpdateFunction -> Bool) -> Eq UpdateFunction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateFunction -> UpdateFunction -> Bool
$c/= :: UpdateFunction -> UpdateFunction -> Bool
== :: UpdateFunction -> UpdateFunction -> Bool
$c== :: UpdateFunction -> UpdateFunction -> Bool
Prelude.Eq, Int -> UpdateFunction -> ShowS
[UpdateFunction] -> ShowS
UpdateFunction -> String
(Int -> UpdateFunction -> ShowS)
-> (UpdateFunction -> String)
-> ([UpdateFunction] -> ShowS)
-> Show UpdateFunction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateFunction] -> ShowS
$cshowList :: [UpdateFunction] -> ShowS
show :: UpdateFunction -> String
$cshow :: UpdateFunction -> String
showsPrec :: Int -> UpdateFunction -> ShowS
$cshowsPrec :: Int -> UpdateFunction -> ShowS
Prelude.Show, (forall x. UpdateFunction -> Rep UpdateFunction x)
-> (forall x. Rep UpdateFunction x -> UpdateFunction)
-> Generic UpdateFunction
forall x. Rep UpdateFunction x -> UpdateFunction
forall x. UpdateFunction -> Rep UpdateFunction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateFunction x -> UpdateFunction
$cfrom :: forall x. UpdateFunction -> Rep UpdateFunction x
Prelude.Generic)
newUpdateFunction ::
Prelude.Text ->
FunctionConfig ->
Prelude.ByteString ->
Prelude.Text ->
UpdateFunction
newUpdateFunction :: Text -> FunctionConfig -> ByteString -> Text -> UpdateFunction
newUpdateFunction
Text
pIfMatch_
FunctionConfig
pFunctionConfig_
ByteString
pFunctionCode_
Text
pName_ =
UpdateFunction' :: Text
-> FunctionConfig -> Sensitive Base64 -> Text -> UpdateFunction
UpdateFunction'
{ $sel:ifMatch:UpdateFunction' :: Text
ifMatch = Text
pIfMatch_,
$sel:functionConfig:UpdateFunction' :: FunctionConfig
functionConfig = FunctionConfig
pFunctionConfig_,
$sel:functionCode:UpdateFunction' :: Sensitive Base64
functionCode =
Tagged Base64 (Identity Base64)
-> Tagged (Sensitive Base64) (Identity (Sensitive Base64))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Base64 (Identity Base64)
-> Tagged (Sensitive Base64) (Identity (Sensitive Base64)))
-> (Tagged ByteString (Identity ByteString)
-> Tagged Base64 (Identity Base64))
-> Tagged ByteString (Identity ByteString)
-> Tagged (Sensitive Base64) (Identity (Sensitive Base64))
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Tagged ByteString (Identity ByteString)
-> Tagged Base64 (Identity Base64)
Iso' Base64 ByteString
Core._Base64
(Tagged ByteString (Identity ByteString)
-> Tagged (Sensitive Base64) (Identity (Sensitive Base64)))
-> ByteString -> Sensitive Base64
forall t b. AReview t b -> b -> t
Lens.# ByteString
pFunctionCode_,
$sel:name:UpdateFunction' :: Text
name = Text
pName_
}
updateFunction_ifMatch :: Lens.Lens' UpdateFunction Prelude.Text
updateFunction_ifMatch :: (Text -> f Text) -> UpdateFunction -> f UpdateFunction
updateFunction_ifMatch = (UpdateFunction -> Text)
-> (UpdateFunction -> Text -> UpdateFunction)
-> Lens UpdateFunction UpdateFunction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFunction' {Text
ifMatch :: Text
$sel:ifMatch:UpdateFunction' :: UpdateFunction -> Text
ifMatch} -> Text
ifMatch) (\s :: UpdateFunction
s@UpdateFunction' {} Text
a -> UpdateFunction
s {$sel:ifMatch:UpdateFunction' :: Text
ifMatch = Text
a} :: UpdateFunction)
updateFunction_functionConfig :: Lens.Lens' UpdateFunction FunctionConfig
updateFunction_functionConfig :: (FunctionConfig -> f FunctionConfig)
-> UpdateFunction -> f UpdateFunction
updateFunction_functionConfig = (UpdateFunction -> FunctionConfig)
-> (UpdateFunction -> FunctionConfig -> UpdateFunction)
-> Lens UpdateFunction UpdateFunction FunctionConfig FunctionConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFunction' {FunctionConfig
functionConfig :: FunctionConfig
$sel:functionConfig:UpdateFunction' :: UpdateFunction -> FunctionConfig
functionConfig} -> FunctionConfig
functionConfig) (\s :: UpdateFunction
s@UpdateFunction' {} FunctionConfig
a -> UpdateFunction
s {$sel:functionConfig:UpdateFunction' :: FunctionConfig
functionConfig = FunctionConfig
a} :: UpdateFunction)
updateFunction_functionCode :: Lens.Lens' UpdateFunction Prelude.ByteString
updateFunction_functionCode :: (ByteString -> f ByteString) -> UpdateFunction -> f UpdateFunction
updateFunction_functionCode = (UpdateFunction -> Sensitive Base64)
-> (UpdateFunction -> Sensitive Base64 -> UpdateFunction)
-> Lens
UpdateFunction UpdateFunction (Sensitive Base64) (Sensitive Base64)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFunction' {Sensitive Base64
functionCode :: Sensitive Base64
$sel:functionCode:UpdateFunction' :: UpdateFunction -> Sensitive Base64
functionCode} -> Sensitive Base64
functionCode) (\s :: UpdateFunction
s@UpdateFunction' {} Sensitive Base64
a -> UpdateFunction
s {$sel:functionCode:UpdateFunction' :: Sensitive Base64
functionCode = Sensitive Base64
a} :: UpdateFunction) ((Sensitive Base64 -> f (Sensitive Base64))
-> UpdateFunction -> f UpdateFunction)
-> ((ByteString -> f ByteString)
-> Sensitive Base64 -> f (Sensitive Base64))
-> (ByteString -> f ByteString)
-> UpdateFunction
-> f UpdateFunction
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Base64 -> f Base64) -> Sensitive Base64 -> f (Sensitive Base64)
forall a. Iso' (Sensitive a) a
Core._Sensitive ((Base64 -> f Base64) -> Sensitive Base64 -> f (Sensitive Base64))
-> ((ByteString -> f ByteString) -> Base64 -> f Base64)
-> (ByteString -> f ByteString)
-> Sensitive Base64
-> f (Sensitive Base64)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (ByteString -> f ByteString) -> Base64 -> f Base64
Iso' Base64 ByteString
Core._Base64
updateFunction_name :: Lens.Lens' UpdateFunction Prelude.Text
updateFunction_name :: (Text -> f Text) -> UpdateFunction -> f UpdateFunction
updateFunction_name = (UpdateFunction -> Text)
-> (UpdateFunction -> Text -> UpdateFunction)
-> Lens UpdateFunction UpdateFunction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFunction' {Text
name :: Text
$sel:name:UpdateFunction' :: UpdateFunction -> Text
name} -> Text
name) (\s :: UpdateFunction
s@UpdateFunction' {} Text
a -> UpdateFunction
s {$sel:name:UpdateFunction' :: Text
name = Text
a} :: UpdateFunction)
instance Core.AWSRequest UpdateFunction where
type
AWSResponse UpdateFunction =
UpdateFunctionResponse
request :: UpdateFunction -> Request UpdateFunction
request = Service -> UpdateFunction -> Request UpdateFunction
forall a. (ToRequest a, ToElement a) => Service -> a -> Request a
Request.putXML Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateFunction
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateFunction)))
response =
(Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse UpdateFunction))
-> Logger
-> Service
-> Proxy UpdateFunction
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateFunction)))
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 FunctionSummary -> Int -> UpdateFunctionResponse
UpdateFunctionResponse'
(Maybe Text
-> Maybe FunctionSummary -> Int -> UpdateFunctionResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe FunctionSummary -> Int -> UpdateFunctionResponse)
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
"ETtag")
Either
String (Maybe FunctionSummary -> Int -> UpdateFunctionResponse)
-> Either String (Maybe FunctionSummary)
-> Either String (Int -> UpdateFunctionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node] -> Either String (Maybe FunctionSummary)
forall a. FromXML a => [Node] -> Either String a
Core.parseXML [Node]
x)
Either String (Int -> UpdateFunctionResponse)
-> Either String Int -> Either String UpdateFunctionResponse
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 UpdateFunction
instance Prelude.NFData UpdateFunction
instance Core.ToElement UpdateFunction where
toElement :: UpdateFunction -> Element
toElement =
Name -> UpdateFunction -> Element
forall a. ToXML a => Name -> a -> Element
Core.mkElement
Name
"{http://cloudfront.amazonaws.com/doc/2020-05-31/}UpdateFunctionRequest"
instance Core.ToHeaders UpdateFunction where
toHeaders :: UpdateFunction -> ResponseHeaders
toHeaders UpdateFunction' {Text
Sensitive Base64
FunctionConfig
name :: Text
functionCode :: Sensitive Base64
functionConfig :: FunctionConfig
ifMatch :: Text
$sel:name:UpdateFunction' :: UpdateFunction -> Text
$sel:functionCode:UpdateFunction' :: UpdateFunction -> Sensitive Base64
$sel:functionConfig:UpdateFunction' :: UpdateFunction -> FunctionConfig
$sel:ifMatch:UpdateFunction' :: UpdateFunction -> Text
..} =
[ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat [HeaderName
"If-Match" HeaderName -> Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Text
ifMatch]
instance Core.ToPath UpdateFunction where
toPath :: UpdateFunction -> ByteString
toPath UpdateFunction' {Text
Sensitive Base64
FunctionConfig
name :: Text
functionCode :: Sensitive Base64
functionConfig :: FunctionConfig
ifMatch :: Text
$sel:name:UpdateFunction' :: UpdateFunction -> Text
$sel:functionCode:UpdateFunction' :: UpdateFunction -> Sensitive Base64
$sel:functionConfig:UpdateFunction' :: UpdateFunction -> FunctionConfig
$sel:ifMatch:UpdateFunction' :: UpdateFunction -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/2020-05-31/function/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
name]
instance Core.ToQuery UpdateFunction where
toQuery :: UpdateFunction -> QueryString
toQuery = QueryString -> UpdateFunction -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
instance Core.ToXML UpdateFunction where
toXML :: UpdateFunction -> XML
toXML UpdateFunction' {Text
Sensitive Base64
FunctionConfig
name :: Text
functionCode :: Sensitive Base64
functionConfig :: FunctionConfig
ifMatch :: Text
$sel:name:UpdateFunction' :: UpdateFunction -> Text
$sel:functionCode:UpdateFunction' :: UpdateFunction -> Sensitive Base64
$sel:functionConfig:UpdateFunction' :: UpdateFunction -> FunctionConfig
$sel:ifMatch:UpdateFunction' :: UpdateFunction -> Text
..} =
[XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ Name
"FunctionConfig" Name -> FunctionConfig -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= FunctionConfig
functionConfig,
Name
"FunctionCode" Name -> Sensitive Base64 -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Sensitive Base64
functionCode
]
data UpdateFunctionResponse = UpdateFunctionResponse'
{
UpdateFunctionResponse -> Maybe Text
eTag :: Prelude.Maybe Prelude.Text,
UpdateFunctionResponse -> Maybe FunctionSummary
functionSummary :: Prelude.Maybe FunctionSummary,
UpdateFunctionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateFunctionResponse -> UpdateFunctionResponse -> Bool
(UpdateFunctionResponse -> UpdateFunctionResponse -> Bool)
-> (UpdateFunctionResponse -> UpdateFunctionResponse -> Bool)
-> Eq UpdateFunctionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateFunctionResponse -> UpdateFunctionResponse -> Bool
$c/= :: UpdateFunctionResponse -> UpdateFunctionResponse -> Bool
== :: UpdateFunctionResponse -> UpdateFunctionResponse -> Bool
$c== :: UpdateFunctionResponse -> UpdateFunctionResponse -> Bool
Prelude.Eq, ReadPrec [UpdateFunctionResponse]
ReadPrec UpdateFunctionResponse
Int -> ReadS UpdateFunctionResponse
ReadS [UpdateFunctionResponse]
(Int -> ReadS UpdateFunctionResponse)
-> ReadS [UpdateFunctionResponse]
-> ReadPrec UpdateFunctionResponse
-> ReadPrec [UpdateFunctionResponse]
-> Read UpdateFunctionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateFunctionResponse]
$creadListPrec :: ReadPrec [UpdateFunctionResponse]
readPrec :: ReadPrec UpdateFunctionResponse
$creadPrec :: ReadPrec UpdateFunctionResponse
readList :: ReadS [UpdateFunctionResponse]
$creadList :: ReadS [UpdateFunctionResponse]
readsPrec :: Int -> ReadS UpdateFunctionResponse
$creadsPrec :: Int -> ReadS UpdateFunctionResponse
Prelude.Read, Int -> UpdateFunctionResponse -> ShowS
[UpdateFunctionResponse] -> ShowS
UpdateFunctionResponse -> String
(Int -> UpdateFunctionResponse -> ShowS)
-> (UpdateFunctionResponse -> String)
-> ([UpdateFunctionResponse] -> ShowS)
-> Show UpdateFunctionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateFunctionResponse] -> ShowS
$cshowList :: [UpdateFunctionResponse] -> ShowS
show :: UpdateFunctionResponse -> String
$cshow :: UpdateFunctionResponse -> String
showsPrec :: Int -> UpdateFunctionResponse -> ShowS
$cshowsPrec :: Int -> UpdateFunctionResponse -> ShowS
Prelude.Show, (forall x. UpdateFunctionResponse -> Rep UpdateFunctionResponse x)
-> (forall x.
Rep UpdateFunctionResponse x -> UpdateFunctionResponse)
-> Generic UpdateFunctionResponse
forall x. Rep UpdateFunctionResponse x -> UpdateFunctionResponse
forall x. UpdateFunctionResponse -> Rep UpdateFunctionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateFunctionResponse x -> UpdateFunctionResponse
$cfrom :: forall x. UpdateFunctionResponse -> Rep UpdateFunctionResponse x
Prelude.Generic)
newUpdateFunctionResponse ::
Prelude.Int ->
UpdateFunctionResponse
newUpdateFunctionResponse :: Int -> UpdateFunctionResponse
newUpdateFunctionResponse Int
pHttpStatus_ =
UpdateFunctionResponse' :: Maybe Text
-> Maybe FunctionSummary -> Int -> UpdateFunctionResponse
UpdateFunctionResponse'
{ $sel:eTag:UpdateFunctionResponse' :: Maybe Text
eTag = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:functionSummary:UpdateFunctionResponse' :: Maybe FunctionSummary
functionSummary = Maybe FunctionSummary
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateFunctionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateFunctionResponse_eTag :: Lens.Lens' UpdateFunctionResponse (Prelude.Maybe Prelude.Text)
updateFunctionResponse_eTag :: (Maybe Text -> f (Maybe Text))
-> UpdateFunctionResponse -> f UpdateFunctionResponse
updateFunctionResponse_eTag = (UpdateFunctionResponse -> Maybe Text)
-> (UpdateFunctionResponse -> Maybe Text -> UpdateFunctionResponse)
-> Lens
UpdateFunctionResponse
UpdateFunctionResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFunctionResponse' {Maybe Text
eTag :: Maybe Text
$sel:eTag:UpdateFunctionResponse' :: UpdateFunctionResponse -> Maybe Text
eTag} -> Maybe Text
eTag) (\s :: UpdateFunctionResponse
s@UpdateFunctionResponse' {} Maybe Text
a -> UpdateFunctionResponse
s {$sel:eTag:UpdateFunctionResponse' :: Maybe Text
eTag = Maybe Text
a} :: UpdateFunctionResponse)
updateFunctionResponse_functionSummary :: Lens.Lens' UpdateFunctionResponse (Prelude.Maybe FunctionSummary)
updateFunctionResponse_functionSummary :: (Maybe FunctionSummary -> f (Maybe FunctionSummary))
-> UpdateFunctionResponse -> f UpdateFunctionResponse
updateFunctionResponse_functionSummary = (UpdateFunctionResponse -> Maybe FunctionSummary)
-> (UpdateFunctionResponse
-> Maybe FunctionSummary -> UpdateFunctionResponse)
-> Lens
UpdateFunctionResponse
UpdateFunctionResponse
(Maybe FunctionSummary)
(Maybe FunctionSummary)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFunctionResponse' {Maybe FunctionSummary
functionSummary :: Maybe FunctionSummary
$sel:functionSummary:UpdateFunctionResponse' :: UpdateFunctionResponse -> Maybe FunctionSummary
functionSummary} -> Maybe FunctionSummary
functionSummary) (\s :: UpdateFunctionResponse
s@UpdateFunctionResponse' {} Maybe FunctionSummary
a -> UpdateFunctionResponse
s {$sel:functionSummary:UpdateFunctionResponse' :: Maybe FunctionSummary
functionSummary = Maybe FunctionSummary
a} :: UpdateFunctionResponse)
updateFunctionResponse_httpStatus :: Lens.Lens' UpdateFunctionResponse Prelude.Int
updateFunctionResponse_httpStatus :: (Int -> f Int)
-> UpdateFunctionResponse -> f UpdateFunctionResponse
updateFunctionResponse_httpStatus = (UpdateFunctionResponse -> Int)
-> (UpdateFunctionResponse -> Int -> UpdateFunctionResponse)
-> Lens UpdateFunctionResponse UpdateFunctionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFunctionResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateFunctionResponse' :: UpdateFunctionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateFunctionResponse
s@UpdateFunctionResponse' {} Int
a -> UpdateFunctionResponse
s {$sel:httpStatus:UpdateFunctionResponse' :: Int
httpStatus = Int
a} :: UpdateFunctionResponse)
instance Prelude.NFData UpdateFunctionResponse