{-# 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.ElastiCache.CreateCacheSecurityGroup
(
CreateCacheSecurityGroup (..),
newCreateCacheSecurityGroup,
createCacheSecurityGroup_tags,
createCacheSecurityGroup_cacheSecurityGroupName,
createCacheSecurityGroup_description,
CreateCacheSecurityGroupResponse (..),
newCreateCacheSecurityGroupResponse,
createCacheSecurityGroupResponse_cacheSecurityGroup,
createCacheSecurityGroupResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ElastiCache.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateCacheSecurityGroup = CreateCacheSecurityGroup'
{
CreateCacheSecurityGroup -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateCacheSecurityGroup -> Text
cacheSecurityGroupName :: Prelude.Text,
CreateCacheSecurityGroup -> Text
description :: Prelude.Text
}
deriving (CreateCacheSecurityGroup -> CreateCacheSecurityGroup -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCacheSecurityGroup -> CreateCacheSecurityGroup -> Bool
$c/= :: CreateCacheSecurityGroup -> CreateCacheSecurityGroup -> Bool
== :: CreateCacheSecurityGroup -> CreateCacheSecurityGroup -> Bool
$c== :: CreateCacheSecurityGroup -> CreateCacheSecurityGroup -> Bool
Prelude.Eq, ReadPrec [CreateCacheSecurityGroup]
ReadPrec CreateCacheSecurityGroup
Int -> ReadS CreateCacheSecurityGroup
ReadS [CreateCacheSecurityGroup]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateCacheSecurityGroup]
$creadListPrec :: ReadPrec [CreateCacheSecurityGroup]
readPrec :: ReadPrec CreateCacheSecurityGroup
$creadPrec :: ReadPrec CreateCacheSecurityGroup
readList :: ReadS [CreateCacheSecurityGroup]
$creadList :: ReadS [CreateCacheSecurityGroup]
readsPrec :: Int -> ReadS CreateCacheSecurityGroup
$creadsPrec :: Int -> ReadS CreateCacheSecurityGroup
Prelude.Read, Int -> CreateCacheSecurityGroup -> ShowS
[CreateCacheSecurityGroup] -> ShowS
CreateCacheSecurityGroup -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCacheSecurityGroup] -> ShowS
$cshowList :: [CreateCacheSecurityGroup] -> ShowS
show :: CreateCacheSecurityGroup -> String
$cshow :: CreateCacheSecurityGroup -> String
showsPrec :: Int -> CreateCacheSecurityGroup -> ShowS
$cshowsPrec :: Int -> CreateCacheSecurityGroup -> ShowS
Prelude.Show, forall x.
Rep CreateCacheSecurityGroup x -> CreateCacheSecurityGroup
forall x.
CreateCacheSecurityGroup -> Rep CreateCacheSecurityGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateCacheSecurityGroup x -> CreateCacheSecurityGroup
$cfrom :: forall x.
CreateCacheSecurityGroup -> Rep CreateCacheSecurityGroup x
Prelude.Generic)
newCreateCacheSecurityGroup ::
Prelude.Text ->
Prelude.Text ->
CreateCacheSecurityGroup
newCreateCacheSecurityGroup :: Text -> Text -> CreateCacheSecurityGroup
newCreateCacheSecurityGroup
Text
pCacheSecurityGroupName_
Text
pDescription_ =
CreateCacheSecurityGroup'
{ $sel:tags:CreateCacheSecurityGroup' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
$sel:cacheSecurityGroupName:CreateCacheSecurityGroup' :: Text
cacheSecurityGroupName = Text
pCacheSecurityGroupName_,
$sel:description:CreateCacheSecurityGroup' :: Text
description = Text
pDescription_
}
createCacheSecurityGroup_tags :: Lens.Lens' CreateCacheSecurityGroup (Prelude.Maybe [Tag])
createCacheSecurityGroup_tags :: Lens' CreateCacheSecurityGroup (Maybe [Tag])
createCacheSecurityGroup_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCacheSecurityGroup' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateCacheSecurityGroup' :: CreateCacheSecurityGroup -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateCacheSecurityGroup
s@CreateCacheSecurityGroup' {} Maybe [Tag]
a -> CreateCacheSecurityGroup
s {$sel:tags:CreateCacheSecurityGroup' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateCacheSecurityGroup) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createCacheSecurityGroup_cacheSecurityGroupName :: Lens.Lens' CreateCacheSecurityGroup Prelude.Text
createCacheSecurityGroup_cacheSecurityGroupName :: Lens' CreateCacheSecurityGroup Text
createCacheSecurityGroup_cacheSecurityGroupName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCacheSecurityGroup' {Text
cacheSecurityGroupName :: Text
$sel:cacheSecurityGroupName:CreateCacheSecurityGroup' :: CreateCacheSecurityGroup -> Text
cacheSecurityGroupName} -> Text
cacheSecurityGroupName) (\s :: CreateCacheSecurityGroup
s@CreateCacheSecurityGroup' {} Text
a -> CreateCacheSecurityGroup
s {$sel:cacheSecurityGroupName:CreateCacheSecurityGroup' :: Text
cacheSecurityGroupName = Text
a} :: CreateCacheSecurityGroup)
createCacheSecurityGroup_description :: Lens.Lens' CreateCacheSecurityGroup Prelude.Text
createCacheSecurityGroup_description :: Lens' CreateCacheSecurityGroup Text
createCacheSecurityGroup_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCacheSecurityGroup' {Text
description :: Text
$sel:description:CreateCacheSecurityGroup' :: CreateCacheSecurityGroup -> Text
description} -> Text
description) (\s :: CreateCacheSecurityGroup
s@CreateCacheSecurityGroup' {} Text
a -> CreateCacheSecurityGroup
s {$sel:description:CreateCacheSecurityGroup' :: Text
description = Text
a} :: CreateCacheSecurityGroup)
instance Core.AWSRequest CreateCacheSecurityGroup where
type
AWSResponse CreateCacheSecurityGroup =
CreateCacheSecurityGroupResponse
request :: (Service -> Service)
-> CreateCacheSecurityGroup -> Request CreateCacheSecurityGroup
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateCacheSecurityGroup
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateCacheSecurityGroup)))
response =
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
Text
"CreateCacheSecurityGroupResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe CacheSecurityGroup -> Int -> CreateCacheSecurityGroupResponse
CreateCacheSecurityGroupResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"CacheSecurityGroup")
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 CreateCacheSecurityGroup where
hashWithSalt :: Int -> CreateCacheSecurityGroup -> Int
hashWithSalt Int
_salt CreateCacheSecurityGroup' {Maybe [Tag]
Text
description :: Text
cacheSecurityGroupName :: Text
tags :: Maybe [Tag]
$sel:description:CreateCacheSecurityGroup' :: CreateCacheSecurityGroup -> Text
$sel:cacheSecurityGroupName:CreateCacheSecurityGroup' :: CreateCacheSecurityGroup -> Text
$sel:tags:CreateCacheSecurityGroup' :: CreateCacheSecurityGroup -> Maybe [Tag]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
cacheSecurityGroupName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
description
instance Prelude.NFData CreateCacheSecurityGroup where
rnf :: CreateCacheSecurityGroup -> ()
rnf CreateCacheSecurityGroup' {Maybe [Tag]
Text
description :: Text
cacheSecurityGroupName :: Text
tags :: Maybe [Tag]
$sel:description:CreateCacheSecurityGroup' :: CreateCacheSecurityGroup -> Text
$sel:cacheSecurityGroupName:CreateCacheSecurityGroup' :: CreateCacheSecurityGroup -> Text
$sel:tags:CreateCacheSecurityGroup' :: CreateCacheSecurityGroup -> Maybe [Tag]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
cacheSecurityGroupName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
description
instance Data.ToHeaders CreateCacheSecurityGroup where
toHeaders :: CreateCacheSecurityGroup -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath CreateCacheSecurityGroup where
toPath :: CreateCacheSecurityGroup -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery CreateCacheSecurityGroup where
toQuery :: CreateCacheSecurityGroup -> QueryString
toQuery CreateCacheSecurityGroup' {Maybe [Tag]
Text
description :: Text
cacheSecurityGroupName :: Text
tags :: Maybe [Tag]
$sel:description:CreateCacheSecurityGroup' :: CreateCacheSecurityGroup -> Text
$sel:cacheSecurityGroupName:CreateCacheSecurityGroup' :: CreateCacheSecurityGroup -> Text
$sel:tags:CreateCacheSecurityGroup' :: CreateCacheSecurityGroup -> Maybe [Tag]
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"CreateCacheSecurityGroup" :: Prelude.ByteString),
ByteString
"Version"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2015-02-02" :: Prelude.ByteString),
ByteString
"Tags"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: forall a. ToQuery a => a -> QueryString
Data.toQuery
(forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"Tag" forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags),
ByteString
"CacheSecurityGroupName"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
cacheSecurityGroupName,
ByteString
"Description" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
description
]
data CreateCacheSecurityGroupResponse = CreateCacheSecurityGroupResponse'
{ CreateCacheSecurityGroupResponse -> Maybe CacheSecurityGroup
cacheSecurityGroup :: Prelude.Maybe CacheSecurityGroup,
CreateCacheSecurityGroupResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateCacheSecurityGroupResponse
-> CreateCacheSecurityGroupResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCacheSecurityGroupResponse
-> CreateCacheSecurityGroupResponse -> Bool
$c/= :: CreateCacheSecurityGroupResponse
-> CreateCacheSecurityGroupResponse -> Bool
== :: CreateCacheSecurityGroupResponse
-> CreateCacheSecurityGroupResponse -> Bool
$c== :: CreateCacheSecurityGroupResponse
-> CreateCacheSecurityGroupResponse -> Bool
Prelude.Eq, ReadPrec [CreateCacheSecurityGroupResponse]
ReadPrec CreateCacheSecurityGroupResponse
Int -> ReadS CreateCacheSecurityGroupResponse
ReadS [CreateCacheSecurityGroupResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateCacheSecurityGroupResponse]
$creadListPrec :: ReadPrec [CreateCacheSecurityGroupResponse]
readPrec :: ReadPrec CreateCacheSecurityGroupResponse
$creadPrec :: ReadPrec CreateCacheSecurityGroupResponse
readList :: ReadS [CreateCacheSecurityGroupResponse]
$creadList :: ReadS [CreateCacheSecurityGroupResponse]
readsPrec :: Int -> ReadS CreateCacheSecurityGroupResponse
$creadsPrec :: Int -> ReadS CreateCacheSecurityGroupResponse
Prelude.Read, Int -> CreateCacheSecurityGroupResponse -> ShowS
[CreateCacheSecurityGroupResponse] -> ShowS
CreateCacheSecurityGroupResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCacheSecurityGroupResponse] -> ShowS
$cshowList :: [CreateCacheSecurityGroupResponse] -> ShowS
show :: CreateCacheSecurityGroupResponse -> String
$cshow :: CreateCacheSecurityGroupResponse -> String
showsPrec :: Int -> CreateCacheSecurityGroupResponse -> ShowS
$cshowsPrec :: Int -> CreateCacheSecurityGroupResponse -> ShowS
Prelude.Show, forall x.
Rep CreateCacheSecurityGroupResponse x
-> CreateCacheSecurityGroupResponse
forall x.
CreateCacheSecurityGroupResponse
-> Rep CreateCacheSecurityGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateCacheSecurityGroupResponse x
-> CreateCacheSecurityGroupResponse
$cfrom :: forall x.
CreateCacheSecurityGroupResponse
-> Rep CreateCacheSecurityGroupResponse x
Prelude.Generic)
newCreateCacheSecurityGroupResponse ::
Prelude.Int ->
CreateCacheSecurityGroupResponse
newCreateCacheSecurityGroupResponse :: Int -> CreateCacheSecurityGroupResponse
newCreateCacheSecurityGroupResponse Int
pHttpStatus_ =
CreateCacheSecurityGroupResponse'
{ $sel:cacheSecurityGroup:CreateCacheSecurityGroupResponse' :: Maybe CacheSecurityGroup
cacheSecurityGroup =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateCacheSecurityGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createCacheSecurityGroupResponse_cacheSecurityGroup :: Lens.Lens' CreateCacheSecurityGroupResponse (Prelude.Maybe CacheSecurityGroup)
createCacheSecurityGroupResponse_cacheSecurityGroup :: Lens' CreateCacheSecurityGroupResponse (Maybe CacheSecurityGroup)
createCacheSecurityGroupResponse_cacheSecurityGroup = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCacheSecurityGroupResponse' {Maybe CacheSecurityGroup
cacheSecurityGroup :: Maybe CacheSecurityGroup
$sel:cacheSecurityGroup:CreateCacheSecurityGroupResponse' :: CreateCacheSecurityGroupResponse -> Maybe CacheSecurityGroup
cacheSecurityGroup} -> Maybe CacheSecurityGroup
cacheSecurityGroup) (\s :: CreateCacheSecurityGroupResponse
s@CreateCacheSecurityGroupResponse' {} Maybe CacheSecurityGroup
a -> CreateCacheSecurityGroupResponse
s {$sel:cacheSecurityGroup:CreateCacheSecurityGroupResponse' :: Maybe CacheSecurityGroup
cacheSecurityGroup = Maybe CacheSecurityGroup
a} :: CreateCacheSecurityGroupResponse)
createCacheSecurityGroupResponse_httpStatus :: Lens.Lens' CreateCacheSecurityGroupResponse Prelude.Int
createCacheSecurityGroupResponse_httpStatus :: Lens' CreateCacheSecurityGroupResponse Int
createCacheSecurityGroupResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCacheSecurityGroupResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateCacheSecurityGroupResponse' :: CreateCacheSecurityGroupResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateCacheSecurityGroupResponse
s@CreateCacheSecurityGroupResponse' {} Int
a -> CreateCacheSecurityGroupResponse
s {$sel:httpStatus:CreateCacheSecurityGroupResponse' :: Int
httpStatus = Int
a} :: CreateCacheSecurityGroupResponse)
instance
Prelude.NFData
CreateCacheSecurityGroupResponse
where
rnf :: CreateCacheSecurityGroupResponse -> ()
rnf CreateCacheSecurityGroupResponse' {Int
Maybe CacheSecurityGroup
httpStatus :: Int
cacheSecurityGroup :: Maybe CacheSecurityGroup
$sel:httpStatus:CreateCacheSecurityGroupResponse' :: CreateCacheSecurityGroupResponse -> Int
$sel:cacheSecurityGroup:CreateCacheSecurityGroupResponse' :: CreateCacheSecurityGroupResponse -> Maybe CacheSecurityGroup
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe CacheSecurityGroup
cacheSecurityGroup
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus