{-# 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_keyGroup,
createKeyGroupResponse_location,
createKeyGroupResponse_httpStatus,
)
where
import Amazonka.CloudFront.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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' {$sel:keyGroupConfig:CreateKeyGroup' :: KeyGroupConfig
keyGroupConfig = KeyGroupConfig
pKeyGroupConfig_}
createKeyGroup_keyGroupConfig :: Lens.Lens' CreateKeyGroup KeyGroupConfig
createKeyGroup_keyGroupConfig :: Lens' CreateKeyGroup KeyGroupConfig
createKeyGroup_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 :: (Service -> Service) -> CreateKeyGroup -> Request CreateKeyGroup
request Service -> Service
overrides =
forall a. (ToRequest a, ToElement a) => Service -> a -> Request a
Request.postXML (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateKeyGroup
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateKeyGroup)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Text
-> Maybe KeyGroup -> Maybe Text -> Int -> CreateKeyGroupResponse
CreateKeyGroupResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (ResponseHeaders
h forall a.
FromText a =>
ResponseHeaders -> HeaderName -> Either String (Maybe a)
Data..#? HeaderName
"ETag")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall a. FromXML a => [Node] -> Either String a
Data.parseXML [Node]
x)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (ResponseHeaders
h forall a.
FromText a =>
ResponseHeaders -> HeaderName -> Either String (Maybe a)
Data..#? HeaderName
"Location")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable CreateKeyGroup where
hashWithSalt :: Int -> CreateKeyGroup -> Int
hashWithSalt Int
_salt CreateKeyGroup' {KeyGroupConfig
keyGroupConfig :: KeyGroupConfig
$sel:keyGroupConfig:CreateKeyGroup' :: CreateKeyGroup -> KeyGroupConfig
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` KeyGroupConfig
keyGroupConfig
instance Prelude.NFData CreateKeyGroup where
rnf :: CreateKeyGroup -> ()
rnf CreateKeyGroup' {KeyGroupConfig
keyGroupConfig :: KeyGroupConfig
$sel:keyGroupConfig:CreateKeyGroup' :: CreateKeyGroup -> KeyGroupConfig
..} = forall a. NFData a => a -> ()
Prelude.rnf KeyGroupConfig
keyGroupConfig
instance Data.ToElement CreateKeyGroup where
toElement :: CreateKeyGroup -> Element
toElement CreateKeyGroup' {KeyGroupConfig
keyGroupConfig :: KeyGroupConfig
$sel:keyGroupConfig:CreateKeyGroup' :: CreateKeyGroup -> KeyGroupConfig
..} =
forall a. ToXML a => Name -> a -> Element
Data.mkElement
Name
"{http://cloudfront.amazonaws.com/doc/2020-05-31/}KeyGroupConfig"
KeyGroupConfig
keyGroupConfig
instance Data.ToHeaders CreateKeyGroup where
toHeaders :: CreateKeyGroup -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath CreateKeyGroup where
toPath :: CreateKeyGroup -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/2020-05-31/key-group"
instance Data.ToQuery CreateKeyGroup where
toQuery :: CreateKeyGroup -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateKeyGroupResponse = CreateKeyGroupResponse'
{
CreateKeyGroupResponse -> Maybe Text
eTag :: Prelude.Maybe Prelude.Text,
CreateKeyGroupResponse -> Maybe KeyGroup
keyGroup :: Prelude.Maybe KeyGroup,
CreateKeyGroupResponse -> Maybe Text
location :: Prelude.Maybe Prelude.Text,
CreateKeyGroupResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateKeyGroupResponse -> CreateKeyGroupResponse -> Bool
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]
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
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. 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'
{ $sel:eTag:CreateKeyGroupResponse' :: Maybe Text
eTag = forall a. Maybe a
Prelude.Nothing,
$sel:keyGroup:CreateKeyGroupResponse' :: Maybe KeyGroup
keyGroup = forall a. Maybe a
Prelude.Nothing,
$sel:location:CreateKeyGroupResponse' :: Maybe Text
location = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateKeyGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createKeyGroupResponse_eTag :: Lens.Lens' CreateKeyGroupResponse (Prelude.Maybe Prelude.Text)
createKeyGroupResponse_eTag :: Lens' CreateKeyGroupResponse (Maybe Text)
createKeyGroupResponse_eTag = 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_keyGroup :: Lens.Lens' CreateKeyGroupResponse (Prelude.Maybe KeyGroup)
createKeyGroupResponse_keyGroup :: Lens' CreateKeyGroupResponse (Maybe KeyGroup)
createKeyGroupResponse_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_location :: Lens.Lens' CreateKeyGroupResponse (Prelude.Maybe Prelude.Text)
createKeyGroupResponse_location :: Lens' CreateKeyGroupResponse (Maybe Text)
createKeyGroupResponse_location = 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_httpStatus :: Lens.Lens' CreateKeyGroupResponse Prelude.Int
createKeyGroupResponse_httpStatus :: Lens' CreateKeyGroupResponse Int
createKeyGroupResponse_httpStatus = 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 where
rnf :: CreateKeyGroupResponse -> ()
rnf CreateKeyGroupResponse' {Int
Maybe Text
Maybe KeyGroup
httpStatus :: Int
location :: Maybe Text
keyGroup :: Maybe KeyGroup
eTag :: Maybe Text
$sel:httpStatus:CreateKeyGroupResponse' :: CreateKeyGroupResponse -> Int
$sel:location:CreateKeyGroupResponse' :: CreateKeyGroupResponse -> Maybe Text
$sel:keyGroup:CreateKeyGroupResponse' :: CreateKeyGroupResponse -> Maybe KeyGroup
$sel:eTag:CreateKeyGroupResponse' :: CreateKeyGroupResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
eTag
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe KeyGroup
keyGroup
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
location
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus