{-# 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.CreateKeyGroup
(
CreateKeyGroup (..),
newCreateKeyGroup,
createKeyGroup_keyGroupConfig,
CreateKeyGroupResponse (..),
newCreateKeyGroupResponse,
createKeyGroupResponse_eTag,
createKeyGroupResponse_location,
createKeyGroupResponse_keyGroup,
createKeyGroupResponse_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 CreateKeyGroup = CreateKeyGroup'
{
CreateKeyGroup -> KeyGroupConfig
keyGroupConfig :: KeyGroupConfig
}
deriving (CreateKeyGroup -> CreateKeyGroup -> Bool
(CreateKeyGroup -> CreateKeyGroup -> Bool)
-> (CreateKeyGroup -> CreateKeyGroup -> Bool) -> Eq CreateKeyGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateKeyGroup -> CreateKeyGroup -> Bool
$c/= :: CreateKeyGroup -> CreateKeyGroup -> Bool
== :: CreateKeyGroup -> CreateKeyGroup -> Bool
$c== :: CreateKeyGroup -> CreateKeyGroup -> Bool
Prelude.Eq, ReadPrec [CreateKeyGroup]
ReadPrec CreateKeyGroup
Int -> ReadS CreateKeyGroup
ReadS [CreateKeyGroup]
(Int -> ReadS CreateKeyGroup)
-> ReadS [CreateKeyGroup]
-> ReadPrec CreateKeyGroup
-> ReadPrec [CreateKeyGroup]
-> Read CreateKeyGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateKeyGroup]
$creadListPrec :: ReadPrec [CreateKeyGroup]
readPrec :: ReadPrec CreateKeyGroup
$creadPrec :: ReadPrec CreateKeyGroup
readList :: ReadS [CreateKeyGroup]
$creadList :: ReadS [CreateKeyGroup]
readsPrec :: Int -> ReadS CreateKeyGroup
$creadsPrec :: Int -> ReadS CreateKeyGroup
Prelude.Read, Int -> CreateKeyGroup -> ShowS
[CreateKeyGroup] -> ShowS
CreateKeyGroup -> String
(Int -> CreateKeyGroup -> ShowS)
-> (CreateKeyGroup -> String)
-> ([CreateKeyGroup] -> ShowS)
-> Show CreateKeyGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateKeyGroup] -> ShowS
$cshowList :: [CreateKeyGroup] -> ShowS
show :: CreateKeyGroup -> String
$cshow :: CreateKeyGroup -> String
showsPrec :: Int -> CreateKeyGroup -> ShowS
$cshowsPrec :: Int -> CreateKeyGroup -> ShowS
Prelude.Show, (forall x. CreateKeyGroup -> Rep CreateKeyGroup x)
-> (forall x. Rep CreateKeyGroup x -> CreateKeyGroup)
-> Generic CreateKeyGroup
forall x. Rep CreateKeyGroup x -> CreateKeyGroup
forall x. CreateKeyGroup -> Rep CreateKeyGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateKeyGroup x -> CreateKeyGroup
$cfrom :: forall x. CreateKeyGroup -> Rep CreateKeyGroup x
Prelude.Generic)
newCreateKeyGroup ::
KeyGroupConfig ->
CreateKeyGroup
newCreateKeyGroup :: KeyGroupConfig -> CreateKeyGroup
newCreateKeyGroup KeyGroupConfig
pKeyGroupConfig_ =
CreateKeyGroup' :: KeyGroupConfig -> CreateKeyGroup
CreateKeyGroup' {$sel:keyGroupConfig:CreateKeyGroup' :: KeyGroupConfig
keyGroupConfig = KeyGroupConfig
pKeyGroupConfig_}
createKeyGroup_keyGroupConfig :: Lens.Lens' CreateKeyGroup KeyGroupConfig
createKeyGroup_keyGroupConfig :: (KeyGroupConfig -> f KeyGroupConfig)
-> CreateKeyGroup -> f CreateKeyGroup
createKeyGroup_keyGroupConfig = (CreateKeyGroup -> KeyGroupConfig)
-> (CreateKeyGroup -> KeyGroupConfig -> CreateKeyGroup)
-> Lens CreateKeyGroup CreateKeyGroup KeyGroupConfig KeyGroupConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateKeyGroup' {KeyGroupConfig
keyGroupConfig :: KeyGroupConfig
$sel:keyGroupConfig:CreateKeyGroup' :: CreateKeyGroup -> KeyGroupConfig
keyGroupConfig} -> KeyGroupConfig
keyGroupConfig) (\s :: CreateKeyGroup
s@CreateKeyGroup' {} KeyGroupConfig
a -> CreateKeyGroup
s {$sel:keyGroupConfig:CreateKeyGroup' :: KeyGroupConfig
keyGroupConfig = KeyGroupConfig
a} :: CreateKeyGroup)
instance Core.AWSRequest CreateKeyGroup where
type
AWSResponse CreateKeyGroup =
CreateKeyGroupResponse
request :: CreateKeyGroup -> Request CreateKeyGroup
request = Service -> CreateKeyGroup -> Request CreateKeyGroup
forall a. (ToRequest a, ToElement a) => Service -> a -> Request a
Request.postXML Service
defaultService
response :: Logger
-> Service
-> Proxy CreateKeyGroup
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateKeyGroup)))
response =
(Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse CreateKeyGroup))
-> Logger
-> Service
-> Proxy CreateKeyGroup
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateKeyGroup)))
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 Text -> Maybe KeyGroup -> Int -> CreateKeyGroupResponse
CreateKeyGroupResponse'
(Maybe Text
-> Maybe Text -> Maybe KeyGroup -> Int -> CreateKeyGroupResponse)
-> Either String (Maybe Text)
-> Either
String
(Maybe Text -> Maybe KeyGroup -> Int -> CreateKeyGroupResponse)
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 Text -> Maybe KeyGroup -> Int -> CreateKeyGroupResponse)
-> Either String (Maybe Text)
-> Either String (Maybe KeyGroup -> Int -> CreateKeyGroupResponse)
forall (f :: * -> *) a b. Applicative f => 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
"Location")
Either String (Maybe KeyGroup -> Int -> CreateKeyGroupResponse)
-> Either String (Maybe KeyGroup)
-> Either String (Int -> CreateKeyGroupResponse)
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 -> CreateKeyGroupResponse)
-> Either String Int -> Either String CreateKeyGroupResponse
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 CreateKeyGroup
instance Prelude.NFData CreateKeyGroup
instance Core.ToElement CreateKeyGroup where
toElement :: CreateKeyGroup -> Element
toElement CreateKeyGroup' {KeyGroupConfig
keyGroupConfig :: KeyGroupConfig
$sel:keyGroupConfig:CreateKeyGroup' :: CreateKeyGroup -> KeyGroupConfig
..} =
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 CreateKeyGroup where
toHeaders :: CreateKeyGroup -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateKeyGroup -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath CreateKeyGroup where
toPath :: CreateKeyGroup -> ByteString
toPath = ByteString -> CreateKeyGroup -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/2020-05-31/key-group"
instance Core.ToQuery CreateKeyGroup where
toQuery :: CreateKeyGroup -> QueryString
toQuery = QueryString -> CreateKeyGroup -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateKeyGroupResponse = CreateKeyGroupResponse'
{
CreateKeyGroupResponse -> Maybe Text
eTag :: Prelude.Maybe Prelude.Text,
CreateKeyGroupResponse -> Maybe Text
location :: Prelude.Maybe Prelude.Text,
CreateKeyGroupResponse -> Maybe KeyGroup
keyGroup :: Prelude.Maybe KeyGroup,
CreateKeyGroupResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateKeyGroupResponse -> CreateKeyGroupResponse -> Bool
(CreateKeyGroupResponse -> CreateKeyGroupResponse -> Bool)
-> (CreateKeyGroupResponse -> CreateKeyGroupResponse -> Bool)
-> Eq CreateKeyGroupResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateKeyGroupResponse -> CreateKeyGroupResponse -> Bool
$c/= :: CreateKeyGroupResponse -> CreateKeyGroupResponse -> Bool
== :: CreateKeyGroupResponse -> CreateKeyGroupResponse -> Bool
$c== :: CreateKeyGroupResponse -> CreateKeyGroupResponse -> Bool
Prelude.Eq, ReadPrec [CreateKeyGroupResponse]
ReadPrec CreateKeyGroupResponse
Int -> ReadS CreateKeyGroupResponse
ReadS [CreateKeyGroupResponse]
(Int -> ReadS CreateKeyGroupResponse)
-> ReadS [CreateKeyGroupResponse]
-> ReadPrec CreateKeyGroupResponse
-> ReadPrec [CreateKeyGroupResponse]
-> Read CreateKeyGroupResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateKeyGroupResponse]
$creadListPrec :: ReadPrec [CreateKeyGroupResponse]
readPrec :: ReadPrec CreateKeyGroupResponse
$creadPrec :: ReadPrec CreateKeyGroupResponse
readList :: ReadS [CreateKeyGroupResponse]
$creadList :: ReadS [CreateKeyGroupResponse]
readsPrec :: Int -> ReadS CreateKeyGroupResponse
$creadsPrec :: Int -> ReadS CreateKeyGroupResponse
Prelude.Read, Int -> CreateKeyGroupResponse -> ShowS
[CreateKeyGroupResponse] -> ShowS
CreateKeyGroupResponse -> String
(Int -> CreateKeyGroupResponse -> ShowS)
-> (CreateKeyGroupResponse -> String)
-> ([CreateKeyGroupResponse] -> ShowS)
-> Show CreateKeyGroupResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateKeyGroupResponse] -> ShowS
$cshowList :: [CreateKeyGroupResponse] -> ShowS
show :: CreateKeyGroupResponse -> String
$cshow :: CreateKeyGroupResponse -> String
showsPrec :: Int -> CreateKeyGroupResponse -> ShowS
$cshowsPrec :: Int -> CreateKeyGroupResponse -> ShowS
Prelude.Show, (forall x. CreateKeyGroupResponse -> Rep CreateKeyGroupResponse x)
-> (forall x.
Rep CreateKeyGroupResponse x -> CreateKeyGroupResponse)
-> Generic CreateKeyGroupResponse
forall x. Rep CreateKeyGroupResponse x -> CreateKeyGroupResponse
forall x. CreateKeyGroupResponse -> Rep CreateKeyGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateKeyGroupResponse x -> CreateKeyGroupResponse
$cfrom :: forall x. CreateKeyGroupResponse -> Rep CreateKeyGroupResponse x
Prelude.Generic)
newCreateKeyGroupResponse ::
Prelude.Int ->
CreateKeyGroupResponse
newCreateKeyGroupResponse :: Int -> CreateKeyGroupResponse
newCreateKeyGroupResponse Int
pHttpStatus_ =
CreateKeyGroupResponse' :: Maybe Text
-> Maybe Text -> Maybe KeyGroup -> Int -> CreateKeyGroupResponse
CreateKeyGroupResponse'
{ $sel:eTag:CreateKeyGroupResponse' :: Maybe Text
eTag = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:location:CreateKeyGroupResponse' :: Maybe Text
location = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:keyGroup:CreateKeyGroupResponse' :: Maybe KeyGroup
keyGroup = Maybe KeyGroup
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateKeyGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createKeyGroupResponse_eTag :: Lens.Lens' CreateKeyGroupResponse (Prelude.Maybe Prelude.Text)
createKeyGroupResponse_eTag :: (Maybe Text -> f (Maybe Text))
-> CreateKeyGroupResponse -> f CreateKeyGroupResponse
createKeyGroupResponse_eTag = (CreateKeyGroupResponse -> Maybe Text)
-> (CreateKeyGroupResponse -> Maybe Text -> CreateKeyGroupResponse)
-> Lens
CreateKeyGroupResponse
CreateKeyGroupResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateKeyGroupResponse' {Maybe Text
eTag :: Maybe Text
$sel:eTag:CreateKeyGroupResponse' :: CreateKeyGroupResponse -> Maybe Text
eTag} -> Maybe Text
eTag) (\s :: CreateKeyGroupResponse
s@CreateKeyGroupResponse' {} Maybe Text
a -> CreateKeyGroupResponse
s {$sel:eTag:CreateKeyGroupResponse' :: Maybe Text
eTag = Maybe Text
a} :: CreateKeyGroupResponse)
createKeyGroupResponse_location :: Lens.Lens' CreateKeyGroupResponse (Prelude.Maybe Prelude.Text)
createKeyGroupResponse_location :: (Maybe Text -> f (Maybe Text))
-> CreateKeyGroupResponse -> f CreateKeyGroupResponse
createKeyGroupResponse_location = (CreateKeyGroupResponse -> Maybe Text)
-> (CreateKeyGroupResponse -> Maybe Text -> CreateKeyGroupResponse)
-> Lens
CreateKeyGroupResponse
CreateKeyGroupResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateKeyGroupResponse' {Maybe Text
location :: Maybe Text
$sel:location:CreateKeyGroupResponse' :: CreateKeyGroupResponse -> Maybe Text
location} -> Maybe Text
location) (\s :: CreateKeyGroupResponse
s@CreateKeyGroupResponse' {} Maybe Text
a -> CreateKeyGroupResponse
s {$sel:location:CreateKeyGroupResponse' :: Maybe Text
location = Maybe Text
a} :: CreateKeyGroupResponse)
createKeyGroupResponse_keyGroup :: Lens.Lens' CreateKeyGroupResponse (Prelude.Maybe KeyGroup)
createKeyGroupResponse_keyGroup :: (Maybe KeyGroup -> f (Maybe KeyGroup))
-> CreateKeyGroupResponse -> f CreateKeyGroupResponse
createKeyGroupResponse_keyGroup = (CreateKeyGroupResponse -> Maybe KeyGroup)
-> (CreateKeyGroupResponse
-> Maybe KeyGroup -> CreateKeyGroupResponse)
-> Lens
CreateKeyGroupResponse
CreateKeyGroupResponse
(Maybe KeyGroup)
(Maybe KeyGroup)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateKeyGroupResponse' {Maybe KeyGroup
keyGroup :: Maybe KeyGroup
$sel:keyGroup:CreateKeyGroupResponse' :: CreateKeyGroupResponse -> Maybe KeyGroup
keyGroup} -> Maybe KeyGroup
keyGroup) (\s :: CreateKeyGroupResponse
s@CreateKeyGroupResponse' {} Maybe KeyGroup
a -> CreateKeyGroupResponse
s {$sel:keyGroup:CreateKeyGroupResponse' :: Maybe KeyGroup
keyGroup = Maybe KeyGroup
a} :: CreateKeyGroupResponse)
createKeyGroupResponse_httpStatus :: Lens.Lens' CreateKeyGroupResponse Prelude.Int
createKeyGroupResponse_httpStatus :: (Int -> f Int)
-> CreateKeyGroupResponse -> f CreateKeyGroupResponse
createKeyGroupResponse_httpStatus = (CreateKeyGroupResponse -> Int)
-> (CreateKeyGroupResponse -> Int -> CreateKeyGroupResponse)
-> Lens CreateKeyGroupResponse CreateKeyGroupResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateKeyGroupResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateKeyGroupResponse' :: CreateKeyGroupResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateKeyGroupResponse
s@CreateKeyGroupResponse' {} Int
a -> CreateKeyGroupResponse
s {$sel:httpStatus:CreateKeyGroupResponse' :: Int
httpStatus = Int
a} :: CreateKeyGroupResponse)
instance Prelude.NFData CreateKeyGroupResponse