{-# 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.UpdateKeyGroup
(
UpdateKeyGroup (..),
newUpdateKeyGroup,
updateKeyGroup_ifMatch,
updateKeyGroup_keyGroupConfig,
updateKeyGroup_id,
UpdateKeyGroupResponse (..),
newUpdateKeyGroupResponse,
updateKeyGroupResponse_eTag,
updateKeyGroupResponse_keyGroup,
updateKeyGroupResponse_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 UpdateKeyGroup = UpdateKeyGroup'
{
UpdateKeyGroup -> Maybe Text
ifMatch :: Prelude.Maybe Prelude.Text,
UpdateKeyGroup -> KeyGroupConfig
keyGroupConfig :: KeyGroupConfig,
UpdateKeyGroup -> Text
id :: Prelude.Text
}
deriving (UpdateKeyGroup -> UpdateKeyGroup -> Bool
(UpdateKeyGroup -> UpdateKeyGroup -> Bool)
-> (UpdateKeyGroup -> UpdateKeyGroup -> Bool) -> Eq UpdateKeyGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateKeyGroup -> UpdateKeyGroup -> Bool
$c/= :: UpdateKeyGroup -> UpdateKeyGroup -> Bool
== :: UpdateKeyGroup -> UpdateKeyGroup -> Bool
$c== :: UpdateKeyGroup -> UpdateKeyGroup -> Bool
Prelude.Eq, ReadPrec [UpdateKeyGroup]
ReadPrec UpdateKeyGroup
Int -> ReadS UpdateKeyGroup
ReadS [UpdateKeyGroup]
(Int -> ReadS UpdateKeyGroup)
-> ReadS [UpdateKeyGroup]
-> ReadPrec UpdateKeyGroup
-> ReadPrec [UpdateKeyGroup]
-> Read UpdateKeyGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateKeyGroup]
$creadListPrec :: ReadPrec [UpdateKeyGroup]
readPrec :: ReadPrec UpdateKeyGroup
$creadPrec :: ReadPrec UpdateKeyGroup
readList :: ReadS [UpdateKeyGroup]
$creadList :: ReadS [UpdateKeyGroup]
readsPrec :: Int -> ReadS UpdateKeyGroup
$creadsPrec :: Int -> ReadS UpdateKeyGroup
Prelude.Read, Int -> UpdateKeyGroup -> ShowS
[UpdateKeyGroup] -> ShowS
UpdateKeyGroup -> String
(Int -> UpdateKeyGroup -> ShowS)
-> (UpdateKeyGroup -> String)
-> ([UpdateKeyGroup] -> ShowS)
-> Show UpdateKeyGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateKeyGroup] -> ShowS
$cshowList :: [UpdateKeyGroup] -> ShowS
show :: UpdateKeyGroup -> String
$cshow :: UpdateKeyGroup -> String
showsPrec :: Int -> UpdateKeyGroup -> ShowS
$cshowsPrec :: Int -> UpdateKeyGroup -> ShowS
Prelude.Show, (forall x. UpdateKeyGroup -> Rep UpdateKeyGroup x)
-> (forall x. Rep UpdateKeyGroup x -> UpdateKeyGroup)
-> Generic UpdateKeyGroup
forall x. Rep UpdateKeyGroup x -> UpdateKeyGroup
forall x. UpdateKeyGroup -> Rep UpdateKeyGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateKeyGroup x -> UpdateKeyGroup
$cfrom :: forall x. UpdateKeyGroup -> Rep UpdateKeyGroup x
Prelude.Generic)
newUpdateKeyGroup ::
KeyGroupConfig ->
Prelude.Text ->
UpdateKeyGroup
newUpdateKeyGroup :: KeyGroupConfig -> Text -> UpdateKeyGroup
newUpdateKeyGroup KeyGroupConfig
pKeyGroupConfig_ Text
pId_ =
UpdateKeyGroup' :: Maybe Text -> KeyGroupConfig -> Text -> UpdateKeyGroup
UpdateKeyGroup'
{ $sel:ifMatch:UpdateKeyGroup' :: Maybe Text
ifMatch = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:keyGroupConfig:UpdateKeyGroup' :: KeyGroupConfig
keyGroupConfig = KeyGroupConfig
pKeyGroupConfig_,
$sel:id:UpdateKeyGroup' :: Text
id = Text
pId_
}
updateKeyGroup_ifMatch :: Lens.Lens' UpdateKeyGroup (Prelude.Maybe Prelude.Text)
updateKeyGroup_ifMatch :: (Maybe Text -> f (Maybe Text))
-> UpdateKeyGroup -> f UpdateKeyGroup
updateKeyGroup_ifMatch = (UpdateKeyGroup -> Maybe Text)
-> (UpdateKeyGroup -> Maybe Text -> UpdateKeyGroup)
-> Lens UpdateKeyGroup UpdateKeyGroup (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateKeyGroup' {Maybe Text
ifMatch :: Maybe Text
$sel:ifMatch:UpdateKeyGroup' :: UpdateKeyGroup -> Maybe Text
ifMatch} -> Maybe Text
ifMatch) (\s :: UpdateKeyGroup
s@UpdateKeyGroup' {} Maybe Text
a -> UpdateKeyGroup
s {$sel:ifMatch:UpdateKeyGroup' :: Maybe Text
ifMatch = Maybe Text
a} :: UpdateKeyGroup)
updateKeyGroup_keyGroupConfig :: Lens.Lens' UpdateKeyGroup KeyGroupConfig
updateKeyGroup_keyGroupConfig :: (KeyGroupConfig -> f KeyGroupConfig)
-> UpdateKeyGroup -> f UpdateKeyGroup
updateKeyGroup_keyGroupConfig = (UpdateKeyGroup -> KeyGroupConfig)
-> (UpdateKeyGroup -> KeyGroupConfig -> UpdateKeyGroup)
-> Lens UpdateKeyGroup UpdateKeyGroup KeyGroupConfig KeyGroupConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateKeyGroup' {KeyGroupConfig
keyGroupConfig :: KeyGroupConfig
$sel:keyGroupConfig:UpdateKeyGroup' :: UpdateKeyGroup -> KeyGroupConfig
keyGroupConfig} -> KeyGroupConfig
keyGroupConfig) (\s :: UpdateKeyGroup
s@UpdateKeyGroup' {} KeyGroupConfig
a -> UpdateKeyGroup
s {$sel:keyGroupConfig:UpdateKeyGroup' :: KeyGroupConfig
keyGroupConfig = KeyGroupConfig
a} :: UpdateKeyGroup)
updateKeyGroup_id :: Lens.Lens' UpdateKeyGroup Prelude.Text
updateKeyGroup_id :: (Text -> f Text) -> UpdateKeyGroup -> f UpdateKeyGroup
updateKeyGroup_id = (UpdateKeyGroup -> Text)
-> (UpdateKeyGroup -> Text -> UpdateKeyGroup)
-> Lens UpdateKeyGroup UpdateKeyGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateKeyGroup' {Text
id :: Text
$sel:id:UpdateKeyGroup' :: UpdateKeyGroup -> Text
id} -> Text
id) (\s :: UpdateKeyGroup
s@UpdateKeyGroup' {} Text
a -> UpdateKeyGroup
s {$sel:id:UpdateKeyGroup' :: Text
id = Text
a} :: UpdateKeyGroup)
instance Core.AWSRequest UpdateKeyGroup where
type
AWSResponse UpdateKeyGroup =
UpdateKeyGroupResponse
request :: UpdateKeyGroup -> Request UpdateKeyGroup
request = Service -> UpdateKeyGroup -> Request UpdateKeyGroup
forall a. (ToRequest a, ToElement a) => Service -> a -> Request a
Request.putXML Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateKeyGroup
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateKeyGroup)))
response =
(Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse UpdateKeyGroup))
-> Logger
-> Service
-> Proxy UpdateKeyGroup
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateKeyGroup)))
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 KeyGroup -> Int -> UpdateKeyGroupResponse
UpdateKeyGroupResponse'
(Maybe Text -> Maybe KeyGroup -> Int -> UpdateKeyGroupResponse)
-> Either String (Maybe Text)
-> Either String (Maybe KeyGroup -> Int -> UpdateKeyGroupResponse)
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 KeyGroup -> Int -> UpdateKeyGroupResponse)
-> Either String (Maybe KeyGroup)
-> Either String (Int -> UpdateKeyGroupResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node] -> Either String (Maybe KeyGroup)
forall a. FromXML a => [Node] -> Either String a
Core.parseXML [Node]
x)
Either String (Int -> UpdateKeyGroupResponse)
-> Either String Int -> Either String UpdateKeyGroupResponse
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 UpdateKeyGroup
instance Prelude.NFData UpdateKeyGroup
instance Core.ToElement UpdateKeyGroup where
toElement :: UpdateKeyGroup -> Element
toElement UpdateKeyGroup' {Maybe Text
Text
KeyGroupConfig
id :: Text
keyGroupConfig :: KeyGroupConfig
ifMatch :: Maybe Text
$sel:id:UpdateKeyGroup' :: UpdateKeyGroup -> Text
$sel:keyGroupConfig:UpdateKeyGroup' :: UpdateKeyGroup -> KeyGroupConfig
$sel:ifMatch:UpdateKeyGroup' :: UpdateKeyGroup -> Maybe Text
..} =
Name -> KeyGroupConfig -> Element
forall a. ToXML a => Name -> a -> Element
Core.mkElement
Name
"{http://cloudfront.amazonaws.com/doc/2020-05-31/}KeyGroupConfig"
KeyGroupConfig
keyGroupConfig
instance Core.ToHeaders UpdateKeyGroup where
toHeaders :: UpdateKeyGroup -> ResponseHeaders
toHeaders UpdateKeyGroup' {Maybe Text
Text
KeyGroupConfig
id :: Text
keyGroupConfig :: KeyGroupConfig
ifMatch :: Maybe Text
$sel:id:UpdateKeyGroup' :: UpdateKeyGroup -> Text
$sel:keyGroupConfig:UpdateKeyGroup' :: UpdateKeyGroup -> KeyGroupConfig
$sel:ifMatch:UpdateKeyGroup' :: UpdateKeyGroup -> 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 UpdateKeyGroup where
toPath :: UpdateKeyGroup -> ByteString
toPath UpdateKeyGroup' {Maybe Text
Text
KeyGroupConfig
id :: Text
keyGroupConfig :: KeyGroupConfig
ifMatch :: Maybe Text
$sel:id:UpdateKeyGroup' :: UpdateKeyGroup -> Text
$sel:keyGroupConfig:UpdateKeyGroup' :: UpdateKeyGroup -> KeyGroupConfig
$sel:ifMatch:UpdateKeyGroup' :: UpdateKeyGroup -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/2020-05-31/key-group/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
id]
instance Core.ToQuery UpdateKeyGroup where
toQuery :: UpdateKeyGroup -> QueryString
toQuery = QueryString -> UpdateKeyGroup -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateKeyGroupResponse = UpdateKeyGroupResponse'
{
UpdateKeyGroupResponse -> Maybe Text
eTag :: Prelude.Maybe Prelude.Text,
UpdateKeyGroupResponse -> Maybe KeyGroup
keyGroup :: Prelude.Maybe KeyGroup,
UpdateKeyGroupResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateKeyGroupResponse -> UpdateKeyGroupResponse -> Bool
(UpdateKeyGroupResponse -> UpdateKeyGroupResponse -> Bool)
-> (UpdateKeyGroupResponse -> UpdateKeyGroupResponse -> Bool)
-> Eq UpdateKeyGroupResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateKeyGroupResponse -> UpdateKeyGroupResponse -> Bool
$c/= :: UpdateKeyGroupResponse -> UpdateKeyGroupResponse -> Bool
== :: UpdateKeyGroupResponse -> UpdateKeyGroupResponse -> Bool
$c== :: UpdateKeyGroupResponse -> UpdateKeyGroupResponse -> Bool
Prelude.Eq, ReadPrec [UpdateKeyGroupResponse]
ReadPrec UpdateKeyGroupResponse
Int -> ReadS UpdateKeyGroupResponse
ReadS [UpdateKeyGroupResponse]
(Int -> ReadS UpdateKeyGroupResponse)
-> ReadS [UpdateKeyGroupResponse]
-> ReadPrec UpdateKeyGroupResponse
-> ReadPrec [UpdateKeyGroupResponse]
-> Read UpdateKeyGroupResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateKeyGroupResponse]
$creadListPrec :: ReadPrec [UpdateKeyGroupResponse]
readPrec :: ReadPrec UpdateKeyGroupResponse
$creadPrec :: ReadPrec UpdateKeyGroupResponse
readList :: ReadS [UpdateKeyGroupResponse]
$creadList :: ReadS [UpdateKeyGroupResponse]
readsPrec :: Int -> ReadS UpdateKeyGroupResponse
$creadsPrec :: Int -> ReadS UpdateKeyGroupResponse
Prelude.Read, Int -> UpdateKeyGroupResponse -> ShowS
[UpdateKeyGroupResponse] -> ShowS
UpdateKeyGroupResponse -> String
(Int -> UpdateKeyGroupResponse -> ShowS)
-> (UpdateKeyGroupResponse -> String)
-> ([UpdateKeyGroupResponse] -> ShowS)
-> Show UpdateKeyGroupResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateKeyGroupResponse] -> ShowS
$cshowList :: [UpdateKeyGroupResponse] -> ShowS
show :: UpdateKeyGroupResponse -> String
$cshow :: UpdateKeyGroupResponse -> String
showsPrec :: Int -> UpdateKeyGroupResponse -> ShowS
$cshowsPrec :: Int -> UpdateKeyGroupResponse -> ShowS
Prelude.Show, (forall x. UpdateKeyGroupResponse -> Rep UpdateKeyGroupResponse x)
-> (forall x.
Rep UpdateKeyGroupResponse x -> UpdateKeyGroupResponse)
-> Generic UpdateKeyGroupResponse
forall x. Rep UpdateKeyGroupResponse x -> UpdateKeyGroupResponse
forall x. UpdateKeyGroupResponse -> Rep UpdateKeyGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateKeyGroupResponse x -> UpdateKeyGroupResponse
$cfrom :: forall x. UpdateKeyGroupResponse -> Rep UpdateKeyGroupResponse x
Prelude.Generic)
newUpdateKeyGroupResponse ::
Prelude.Int ->
UpdateKeyGroupResponse
newUpdateKeyGroupResponse :: Int -> UpdateKeyGroupResponse
newUpdateKeyGroupResponse Int
pHttpStatus_ =
UpdateKeyGroupResponse' :: Maybe Text -> Maybe KeyGroup -> Int -> UpdateKeyGroupResponse
UpdateKeyGroupResponse'
{ $sel:eTag:UpdateKeyGroupResponse' :: Maybe Text
eTag = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:keyGroup:UpdateKeyGroupResponse' :: Maybe KeyGroup
keyGroup = Maybe KeyGroup
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateKeyGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateKeyGroupResponse_eTag :: Lens.Lens' UpdateKeyGroupResponse (Prelude.Maybe Prelude.Text)
updateKeyGroupResponse_eTag :: (Maybe Text -> f (Maybe Text))
-> UpdateKeyGroupResponse -> f UpdateKeyGroupResponse
updateKeyGroupResponse_eTag = (UpdateKeyGroupResponse -> Maybe Text)
-> (UpdateKeyGroupResponse -> Maybe Text -> UpdateKeyGroupResponse)
-> Lens
UpdateKeyGroupResponse
UpdateKeyGroupResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateKeyGroupResponse' {Maybe Text
eTag :: Maybe Text
$sel:eTag:UpdateKeyGroupResponse' :: UpdateKeyGroupResponse -> Maybe Text
eTag} -> Maybe Text
eTag) (\s :: UpdateKeyGroupResponse
s@UpdateKeyGroupResponse' {} Maybe Text
a -> UpdateKeyGroupResponse
s {$sel:eTag:UpdateKeyGroupResponse' :: Maybe Text
eTag = Maybe Text
a} :: UpdateKeyGroupResponse)
updateKeyGroupResponse_keyGroup :: Lens.Lens' UpdateKeyGroupResponse (Prelude.Maybe KeyGroup)
updateKeyGroupResponse_keyGroup :: (Maybe KeyGroup -> f (Maybe KeyGroup))
-> UpdateKeyGroupResponse -> f UpdateKeyGroupResponse
updateKeyGroupResponse_keyGroup = (UpdateKeyGroupResponse -> Maybe KeyGroup)
-> (UpdateKeyGroupResponse
-> Maybe KeyGroup -> UpdateKeyGroupResponse)
-> Lens
UpdateKeyGroupResponse
UpdateKeyGroupResponse
(Maybe KeyGroup)
(Maybe KeyGroup)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateKeyGroupResponse' {Maybe KeyGroup
keyGroup :: Maybe KeyGroup
$sel:keyGroup:UpdateKeyGroupResponse' :: UpdateKeyGroupResponse -> Maybe KeyGroup
keyGroup} -> Maybe KeyGroup
keyGroup) (\s :: UpdateKeyGroupResponse
s@UpdateKeyGroupResponse' {} Maybe KeyGroup
a -> UpdateKeyGroupResponse
s {$sel:keyGroup:UpdateKeyGroupResponse' :: Maybe KeyGroup
keyGroup = Maybe KeyGroup
a} :: UpdateKeyGroupResponse)
updateKeyGroupResponse_httpStatus :: Lens.Lens' UpdateKeyGroupResponse Prelude.Int
updateKeyGroupResponse_httpStatus :: (Int -> f Int)
-> UpdateKeyGroupResponse -> f UpdateKeyGroupResponse
updateKeyGroupResponse_httpStatus = (UpdateKeyGroupResponse -> Int)
-> (UpdateKeyGroupResponse -> Int -> UpdateKeyGroupResponse)
-> Lens UpdateKeyGroupResponse UpdateKeyGroupResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateKeyGroupResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateKeyGroupResponse' :: UpdateKeyGroupResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateKeyGroupResponse
s@UpdateKeyGroupResponse' {} Int
a -> UpdateKeyGroupResponse
s {$sel:httpStatus:UpdateKeyGroupResponse' :: Int
httpStatus = Int
a} :: UpdateKeyGroupResponse)
instance Prelude.NFData UpdateKeyGroupResponse