{-# 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.UpdatePublicKey
(
UpdatePublicKey (..),
newUpdatePublicKey,
updatePublicKey_ifMatch,
updatePublicKey_publicKeyConfig,
updatePublicKey_id,
UpdatePublicKeyResponse (..),
newUpdatePublicKeyResponse,
updatePublicKeyResponse_eTag,
updatePublicKeyResponse_publicKey,
updatePublicKeyResponse_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 UpdatePublicKey = UpdatePublicKey'
{
UpdatePublicKey -> Maybe Text
ifMatch :: Prelude.Maybe Prelude.Text,
UpdatePublicKey -> PublicKeyConfig
publicKeyConfig :: PublicKeyConfig,
UpdatePublicKey -> Text
id :: Prelude.Text
}
deriving (UpdatePublicKey -> UpdatePublicKey -> Bool
(UpdatePublicKey -> UpdatePublicKey -> Bool)
-> (UpdatePublicKey -> UpdatePublicKey -> Bool)
-> Eq UpdatePublicKey
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdatePublicKey -> UpdatePublicKey -> Bool
$c/= :: UpdatePublicKey -> UpdatePublicKey -> Bool
== :: UpdatePublicKey -> UpdatePublicKey -> Bool
$c== :: UpdatePublicKey -> UpdatePublicKey -> Bool
Prelude.Eq, ReadPrec [UpdatePublicKey]
ReadPrec UpdatePublicKey
Int -> ReadS UpdatePublicKey
ReadS [UpdatePublicKey]
(Int -> ReadS UpdatePublicKey)
-> ReadS [UpdatePublicKey]
-> ReadPrec UpdatePublicKey
-> ReadPrec [UpdatePublicKey]
-> Read UpdatePublicKey
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdatePublicKey]
$creadListPrec :: ReadPrec [UpdatePublicKey]
readPrec :: ReadPrec UpdatePublicKey
$creadPrec :: ReadPrec UpdatePublicKey
readList :: ReadS [UpdatePublicKey]
$creadList :: ReadS [UpdatePublicKey]
readsPrec :: Int -> ReadS UpdatePublicKey
$creadsPrec :: Int -> ReadS UpdatePublicKey
Prelude.Read, Int -> UpdatePublicKey -> ShowS
[UpdatePublicKey] -> ShowS
UpdatePublicKey -> String
(Int -> UpdatePublicKey -> ShowS)
-> (UpdatePublicKey -> String)
-> ([UpdatePublicKey] -> ShowS)
-> Show UpdatePublicKey
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdatePublicKey] -> ShowS
$cshowList :: [UpdatePublicKey] -> ShowS
show :: UpdatePublicKey -> String
$cshow :: UpdatePublicKey -> String
showsPrec :: Int -> UpdatePublicKey -> ShowS
$cshowsPrec :: Int -> UpdatePublicKey -> ShowS
Prelude.Show, (forall x. UpdatePublicKey -> Rep UpdatePublicKey x)
-> (forall x. Rep UpdatePublicKey x -> UpdatePublicKey)
-> Generic UpdatePublicKey
forall x. Rep UpdatePublicKey x -> UpdatePublicKey
forall x. UpdatePublicKey -> Rep UpdatePublicKey x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdatePublicKey x -> UpdatePublicKey
$cfrom :: forall x. UpdatePublicKey -> Rep UpdatePublicKey x
Prelude.Generic)
newUpdatePublicKey ::
PublicKeyConfig ->
Prelude.Text ->
UpdatePublicKey
newUpdatePublicKey :: PublicKeyConfig -> Text -> UpdatePublicKey
newUpdatePublicKey PublicKeyConfig
pPublicKeyConfig_ Text
pId_ =
UpdatePublicKey' :: Maybe Text -> PublicKeyConfig -> Text -> UpdatePublicKey
UpdatePublicKey'
{ $sel:ifMatch:UpdatePublicKey' :: Maybe Text
ifMatch = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:publicKeyConfig:UpdatePublicKey' :: PublicKeyConfig
publicKeyConfig = PublicKeyConfig
pPublicKeyConfig_,
$sel:id:UpdatePublicKey' :: Text
id = Text
pId_
}
updatePublicKey_ifMatch :: Lens.Lens' UpdatePublicKey (Prelude.Maybe Prelude.Text)
updatePublicKey_ifMatch :: (Maybe Text -> f (Maybe Text))
-> UpdatePublicKey -> f UpdatePublicKey
updatePublicKey_ifMatch = (UpdatePublicKey -> Maybe Text)
-> (UpdatePublicKey -> Maybe Text -> UpdatePublicKey)
-> Lens UpdatePublicKey UpdatePublicKey (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePublicKey' {Maybe Text
ifMatch :: Maybe Text
$sel:ifMatch:UpdatePublicKey' :: UpdatePublicKey -> Maybe Text
ifMatch} -> Maybe Text
ifMatch) (\s :: UpdatePublicKey
s@UpdatePublicKey' {} Maybe Text
a -> UpdatePublicKey
s {$sel:ifMatch:UpdatePublicKey' :: Maybe Text
ifMatch = Maybe Text
a} :: UpdatePublicKey)
updatePublicKey_publicKeyConfig :: Lens.Lens' UpdatePublicKey PublicKeyConfig
updatePublicKey_publicKeyConfig :: (PublicKeyConfig -> f PublicKeyConfig)
-> UpdatePublicKey -> f UpdatePublicKey
updatePublicKey_publicKeyConfig = (UpdatePublicKey -> PublicKeyConfig)
-> (UpdatePublicKey -> PublicKeyConfig -> UpdatePublicKey)
-> Lens
UpdatePublicKey UpdatePublicKey PublicKeyConfig PublicKeyConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePublicKey' {PublicKeyConfig
publicKeyConfig :: PublicKeyConfig
$sel:publicKeyConfig:UpdatePublicKey' :: UpdatePublicKey -> PublicKeyConfig
publicKeyConfig} -> PublicKeyConfig
publicKeyConfig) (\s :: UpdatePublicKey
s@UpdatePublicKey' {} PublicKeyConfig
a -> UpdatePublicKey
s {$sel:publicKeyConfig:UpdatePublicKey' :: PublicKeyConfig
publicKeyConfig = PublicKeyConfig
a} :: UpdatePublicKey)
updatePublicKey_id :: Lens.Lens' UpdatePublicKey Prelude.Text
updatePublicKey_id :: (Text -> f Text) -> UpdatePublicKey -> f UpdatePublicKey
updatePublicKey_id = (UpdatePublicKey -> Text)
-> (UpdatePublicKey -> Text -> UpdatePublicKey)
-> Lens UpdatePublicKey UpdatePublicKey Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePublicKey' {Text
id :: Text
$sel:id:UpdatePublicKey' :: UpdatePublicKey -> Text
id} -> Text
id) (\s :: UpdatePublicKey
s@UpdatePublicKey' {} Text
a -> UpdatePublicKey
s {$sel:id:UpdatePublicKey' :: Text
id = Text
a} :: UpdatePublicKey)
instance Core.AWSRequest UpdatePublicKey where
type
AWSResponse UpdatePublicKey =
UpdatePublicKeyResponse
request :: UpdatePublicKey -> Request UpdatePublicKey
request = Service -> UpdatePublicKey -> Request UpdatePublicKey
forall a. (ToRequest a, ToElement a) => Service -> a -> Request a
Request.putXML Service
defaultService
response :: Logger
-> Service
-> Proxy UpdatePublicKey
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdatePublicKey)))
response =
(Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse UpdatePublicKey))
-> Logger
-> Service
-> Proxy UpdatePublicKey
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdatePublicKey)))
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 PublicKey -> Int -> UpdatePublicKeyResponse
UpdatePublicKeyResponse'
(Maybe Text -> Maybe PublicKey -> Int -> UpdatePublicKeyResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe PublicKey -> Int -> UpdatePublicKeyResponse)
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 PublicKey -> Int -> UpdatePublicKeyResponse)
-> Either String (Maybe PublicKey)
-> Either String (Int -> UpdatePublicKeyResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node] -> Either String (Maybe PublicKey)
forall a. FromXML a => [Node] -> Either String a
Core.parseXML [Node]
x)
Either String (Int -> UpdatePublicKeyResponse)
-> Either String Int -> Either String UpdatePublicKeyResponse
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 UpdatePublicKey
instance Prelude.NFData UpdatePublicKey
instance Core.ToElement UpdatePublicKey where
toElement :: UpdatePublicKey -> Element
toElement UpdatePublicKey' {Maybe Text
Text
PublicKeyConfig
id :: Text
publicKeyConfig :: PublicKeyConfig
ifMatch :: Maybe Text
$sel:id:UpdatePublicKey' :: UpdatePublicKey -> Text
$sel:publicKeyConfig:UpdatePublicKey' :: UpdatePublicKey -> PublicKeyConfig
$sel:ifMatch:UpdatePublicKey' :: UpdatePublicKey -> Maybe Text
..} =
Name -> PublicKeyConfig -> Element
forall a. ToXML a => Name -> a -> Element
Core.mkElement
Name
"{http://cloudfront.amazonaws.com/doc/2020-05-31/}PublicKeyConfig"
PublicKeyConfig
publicKeyConfig
instance Core.ToHeaders UpdatePublicKey where
toHeaders :: UpdatePublicKey -> ResponseHeaders
toHeaders UpdatePublicKey' {Maybe Text
Text
PublicKeyConfig
id :: Text
publicKeyConfig :: PublicKeyConfig
ifMatch :: Maybe Text
$sel:id:UpdatePublicKey' :: UpdatePublicKey -> Text
$sel:publicKeyConfig:UpdatePublicKey' :: UpdatePublicKey -> PublicKeyConfig
$sel:ifMatch:UpdatePublicKey' :: UpdatePublicKey -> 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 UpdatePublicKey where
toPath :: UpdatePublicKey -> ByteString
toPath UpdatePublicKey' {Maybe Text
Text
PublicKeyConfig
id :: Text
publicKeyConfig :: PublicKeyConfig
ifMatch :: Maybe Text
$sel:id:UpdatePublicKey' :: UpdatePublicKey -> Text
$sel:publicKeyConfig:UpdatePublicKey' :: UpdatePublicKey -> PublicKeyConfig
$sel:ifMatch:UpdatePublicKey' :: UpdatePublicKey -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/2020-05-31/public-key/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
id, ByteString
"/config"]
instance Core.ToQuery UpdatePublicKey where
toQuery :: UpdatePublicKey -> QueryString
toQuery = QueryString -> UpdatePublicKey -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdatePublicKeyResponse = UpdatePublicKeyResponse'
{
UpdatePublicKeyResponse -> Maybe Text
eTag :: Prelude.Maybe Prelude.Text,
UpdatePublicKeyResponse -> Maybe PublicKey
publicKey :: Prelude.Maybe PublicKey,
UpdatePublicKeyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdatePublicKeyResponse -> UpdatePublicKeyResponse -> Bool
(UpdatePublicKeyResponse -> UpdatePublicKeyResponse -> Bool)
-> (UpdatePublicKeyResponse -> UpdatePublicKeyResponse -> Bool)
-> Eq UpdatePublicKeyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdatePublicKeyResponse -> UpdatePublicKeyResponse -> Bool
$c/= :: UpdatePublicKeyResponse -> UpdatePublicKeyResponse -> Bool
== :: UpdatePublicKeyResponse -> UpdatePublicKeyResponse -> Bool
$c== :: UpdatePublicKeyResponse -> UpdatePublicKeyResponse -> Bool
Prelude.Eq, ReadPrec [UpdatePublicKeyResponse]
ReadPrec UpdatePublicKeyResponse
Int -> ReadS UpdatePublicKeyResponse
ReadS [UpdatePublicKeyResponse]
(Int -> ReadS UpdatePublicKeyResponse)
-> ReadS [UpdatePublicKeyResponse]
-> ReadPrec UpdatePublicKeyResponse
-> ReadPrec [UpdatePublicKeyResponse]
-> Read UpdatePublicKeyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdatePublicKeyResponse]
$creadListPrec :: ReadPrec [UpdatePublicKeyResponse]
readPrec :: ReadPrec UpdatePublicKeyResponse
$creadPrec :: ReadPrec UpdatePublicKeyResponse
readList :: ReadS [UpdatePublicKeyResponse]
$creadList :: ReadS [UpdatePublicKeyResponse]
readsPrec :: Int -> ReadS UpdatePublicKeyResponse
$creadsPrec :: Int -> ReadS UpdatePublicKeyResponse
Prelude.Read, Int -> UpdatePublicKeyResponse -> ShowS
[UpdatePublicKeyResponse] -> ShowS
UpdatePublicKeyResponse -> String
(Int -> UpdatePublicKeyResponse -> ShowS)
-> (UpdatePublicKeyResponse -> String)
-> ([UpdatePublicKeyResponse] -> ShowS)
-> Show UpdatePublicKeyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdatePublicKeyResponse] -> ShowS
$cshowList :: [UpdatePublicKeyResponse] -> ShowS
show :: UpdatePublicKeyResponse -> String
$cshow :: UpdatePublicKeyResponse -> String
showsPrec :: Int -> UpdatePublicKeyResponse -> ShowS
$cshowsPrec :: Int -> UpdatePublicKeyResponse -> ShowS
Prelude.Show, (forall x.
UpdatePublicKeyResponse -> Rep UpdatePublicKeyResponse x)
-> (forall x.
Rep UpdatePublicKeyResponse x -> UpdatePublicKeyResponse)
-> Generic UpdatePublicKeyResponse
forall x. Rep UpdatePublicKeyResponse x -> UpdatePublicKeyResponse
forall x. UpdatePublicKeyResponse -> Rep UpdatePublicKeyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdatePublicKeyResponse x -> UpdatePublicKeyResponse
$cfrom :: forall x. UpdatePublicKeyResponse -> Rep UpdatePublicKeyResponse x
Prelude.Generic)
newUpdatePublicKeyResponse ::
Prelude.Int ->
UpdatePublicKeyResponse
newUpdatePublicKeyResponse :: Int -> UpdatePublicKeyResponse
newUpdatePublicKeyResponse Int
pHttpStatus_ =
UpdatePublicKeyResponse' :: Maybe Text -> Maybe PublicKey -> Int -> UpdatePublicKeyResponse
UpdatePublicKeyResponse'
{ $sel:eTag:UpdatePublicKeyResponse' :: Maybe Text
eTag = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:publicKey:UpdatePublicKeyResponse' :: Maybe PublicKey
publicKey = Maybe PublicKey
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdatePublicKeyResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updatePublicKeyResponse_eTag :: Lens.Lens' UpdatePublicKeyResponse (Prelude.Maybe Prelude.Text)
updatePublicKeyResponse_eTag :: (Maybe Text -> f (Maybe Text))
-> UpdatePublicKeyResponse -> f UpdatePublicKeyResponse
updatePublicKeyResponse_eTag = (UpdatePublicKeyResponse -> Maybe Text)
-> (UpdatePublicKeyResponse
-> Maybe Text -> UpdatePublicKeyResponse)
-> Lens
UpdatePublicKeyResponse
UpdatePublicKeyResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePublicKeyResponse' {Maybe Text
eTag :: Maybe Text
$sel:eTag:UpdatePublicKeyResponse' :: UpdatePublicKeyResponse -> Maybe Text
eTag} -> Maybe Text
eTag) (\s :: UpdatePublicKeyResponse
s@UpdatePublicKeyResponse' {} Maybe Text
a -> UpdatePublicKeyResponse
s {$sel:eTag:UpdatePublicKeyResponse' :: Maybe Text
eTag = Maybe Text
a} :: UpdatePublicKeyResponse)
updatePublicKeyResponse_publicKey :: Lens.Lens' UpdatePublicKeyResponse (Prelude.Maybe PublicKey)
updatePublicKeyResponse_publicKey :: (Maybe PublicKey -> f (Maybe PublicKey))
-> UpdatePublicKeyResponse -> f UpdatePublicKeyResponse
updatePublicKeyResponse_publicKey = (UpdatePublicKeyResponse -> Maybe PublicKey)
-> (UpdatePublicKeyResponse
-> Maybe PublicKey -> UpdatePublicKeyResponse)
-> Lens
UpdatePublicKeyResponse
UpdatePublicKeyResponse
(Maybe PublicKey)
(Maybe PublicKey)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePublicKeyResponse' {Maybe PublicKey
publicKey :: Maybe PublicKey
$sel:publicKey:UpdatePublicKeyResponse' :: UpdatePublicKeyResponse -> Maybe PublicKey
publicKey} -> Maybe PublicKey
publicKey) (\s :: UpdatePublicKeyResponse
s@UpdatePublicKeyResponse' {} Maybe PublicKey
a -> UpdatePublicKeyResponse
s {$sel:publicKey:UpdatePublicKeyResponse' :: Maybe PublicKey
publicKey = Maybe PublicKey
a} :: UpdatePublicKeyResponse)
updatePublicKeyResponse_httpStatus :: Lens.Lens' UpdatePublicKeyResponse Prelude.Int
updatePublicKeyResponse_httpStatus :: (Int -> f Int)
-> UpdatePublicKeyResponse -> f UpdatePublicKeyResponse
updatePublicKeyResponse_httpStatus = (UpdatePublicKeyResponse -> Int)
-> (UpdatePublicKeyResponse -> Int -> UpdatePublicKeyResponse)
-> Lens UpdatePublicKeyResponse UpdatePublicKeyResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePublicKeyResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdatePublicKeyResponse' :: UpdatePublicKeyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdatePublicKeyResponse
s@UpdatePublicKeyResponse' {} Int
a -> UpdatePublicKeyResponse
s {$sel:httpStatus:UpdatePublicKeyResponse' :: Int
httpStatus = Int
a} :: UpdatePublicKeyResponse)
instance Prelude.NFData UpdatePublicKeyResponse