{-# 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 Amazonka.ElastiCache.Types
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 CreateCacheSecurityGroup = CreateCacheSecurityGroup'
{
CreateCacheSecurityGroup -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateCacheSecurityGroup -> Text
cacheSecurityGroupName :: Prelude.Text,
CreateCacheSecurityGroup -> Text
description :: Prelude.Text
}
deriving (CreateCacheSecurityGroup -> CreateCacheSecurityGroup -> Bool
(CreateCacheSecurityGroup -> CreateCacheSecurityGroup -> Bool)
-> (CreateCacheSecurityGroup -> CreateCacheSecurityGroup -> Bool)
-> Eq CreateCacheSecurityGroup
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]
(Int -> ReadS CreateCacheSecurityGroup)
-> ReadS [CreateCacheSecurityGroup]
-> ReadPrec CreateCacheSecurityGroup
-> ReadPrec [CreateCacheSecurityGroup]
-> Read 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
(Int -> CreateCacheSecurityGroup -> ShowS)
-> (CreateCacheSecurityGroup -> String)
-> ([CreateCacheSecurityGroup] -> ShowS)
-> Show CreateCacheSecurityGroup
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.
CreateCacheSecurityGroup -> Rep CreateCacheSecurityGroup x)
-> (forall x.
Rep CreateCacheSecurityGroup x -> CreateCacheSecurityGroup)
-> Generic CreateCacheSecurityGroup
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' :: Maybe [Tag] -> Text -> Text -> CreateCacheSecurityGroup
CreateCacheSecurityGroup'
{ $sel:tags:CreateCacheSecurityGroup' :: Maybe [Tag]
tags = Maybe [Tag]
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 :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateCacheSecurityGroup -> f CreateCacheSecurityGroup
createCacheSecurityGroup_tags = (CreateCacheSecurityGroup -> Maybe [Tag])
-> (CreateCacheSecurityGroup
-> Maybe [Tag] -> CreateCacheSecurityGroup)
-> Lens
CreateCacheSecurityGroup
CreateCacheSecurityGroup
(Maybe [Tag])
(Maybe [Tag])
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) ((Maybe [Tag] -> f (Maybe [Tag]))
-> CreateCacheSecurityGroup -> f CreateCacheSecurityGroup)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateCacheSecurityGroup
-> f CreateCacheSecurityGroup
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 AnIso [Tag] [Tag] [Tag] [Tag]
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 :: (Text -> f Text)
-> CreateCacheSecurityGroup -> f CreateCacheSecurityGroup
createCacheSecurityGroup_cacheSecurityGroupName = (CreateCacheSecurityGroup -> Text)
-> (CreateCacheSecurityGroup -> Text -> CreateCacheSecurityGroup)
-> Lens CreateCacheSecurityGroup CreateCacheSecurityGroup Text Text
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 :: (Text -> f Text)
-> CreateCacheSecurityGroup -> f CreateCacheSecurityGroup
createCacheSecurityGroup_description = (CreateCacheSecurityGroup -> Text)
-> (CreateCacheSecurityGroup -> Text -> CreateCacheSecurityGroup)
-> Lens CreateCacheSecurityGroup CreateCacheSecurityGroup Text Text
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 :: CreateCacheSecurityGroup -> Request CreateCacheSecurityGroup
request = Service
-> CreateCacheSecurityGroup -> Request CreateCacheSecurityGroup
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy CreateCacheSecurityGroup
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateCacheSecurityGroup)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse CreateCacheSecurityGroup))
-> Logger
-> Service
-> Proxy CreateCacheSecurityGroup
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateCacheSecurityGroup)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> 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'
(Maybe CacheSecurityGroup
-> Int -> CreateCacheSecurityGroupResponse)
-> Either String (Maybe CacheSecurityGroup)
-> Either String (Int -> CreateCacheSecurityGroupResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe CacheSecurityGroup)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"CacheSecurityGroup")
Either String (Int -> CreateCacheSecurityGroupResponse)
-> Either String Int
-> Either String CreateCacheSecurityGroupResponse
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 CreateCacheSecurityGroup
instance Prelude.NFData CreateCacheSecurityGroup
instance Core.ToHeaders CreateCacheSecurityGroup where
toHeaders :: CreateCacheSecurityGroup -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateCacheSecurityGroup -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath CreateCacheSecurityGroup where
toPath :: CreateCacheSecurityGroup -> ByteString
toPath = ByteString -> CreateCacheSecurityGroup -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.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]
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"CreateCacheSecurityGroup" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2015-02-02" :: Prelude.ByteString),
ByteString
"Tags"
ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
(ByteString -> [Tag] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"Tag" ([Tag] -> QueryString) -> Maybe [Tag] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags),
ByteString
"CacheSecurityGroupName"
ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
cacheSecurityGroupName,
ByteString
"Description" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
description
]
data CreateCacheSecurityGroupResponse = CreateCacheSecurityGroupResponse'
{ CreateCacheSecurityGroupResponse -> Maybe CacheSecurityGroup
cacheSecurityGroup :: Prelude.Maybe CacheSecurityGroup,
CreateCacheSecurityGroupResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateCacheSecurityGroupResponse
-> CreateCacheSecurityGroupResponse -> Bool
(CreateCacheSecurityGroupResponse
-> CreateCacheSecurityGroupResponse -> Bool)
-> (CreateCacheSecurityGroupResponse
-> CreateCacheSecurityGroupResponse -> Bool)
-> Eq CreateCacheSecurityGroupResponse
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]
(Int -> ReadS CreateCacheSecurityGroupResponse)
-> ReadS [CreateCacheSecurityGroupResponse]
-> ReadPrec CreateCacheSecurityGroupResponse
-> ReadPrec [CreateCacheSecurityGroupResponse]
-> Read 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
(Int -> CreateCacheSecurityGroupResponse -> ShowS)
-> (CreateCacheSecurityGroupResponse -> String)
-> ([CreateCacheSecurityGroupResponse] -> ShowS)
-> Show CreateCacheSecurityGroupResponse
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.
CreateCacheSecurityGroupResponse
-> Rep CreateCacheSecurityGroupResponse x)
-> (forall x.
Rep CreateCacheSecurityGroupResponse x
-> CreateCacheSecurityGroupResponse)
-> Generic CreateCacheSecurityGroupResponse
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' :: Maybe CacheSecurityGroup -> Int -> CreateCacheSecurityGroupResponse
CreateCacheSecurityGroupResponse'
{ $sel:cacheSecurityGroup:CreateCacheSecurityGroupResponse' :: Maybe CacheSecurityGroup
cacheSecurityGroup =
Maybe CacheSecurityGroup
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateCacheSecurityGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createCacheSecurityGroupResponse_cacheSecurityGroup :: Lens.Lens' CreateCacheSecurityGroupResponse (Prelude.Maybe CacheSecurityGroup)
createCacheSecurityGroupResponse_cacheSecurityGroup :: (Maybe CacheSecurityGroup -> f (Maybe CacheSecurityGroup))
-> CreateCacheSecurityGroupResponse
-> f CreateCacheSecurityGroupResponse
createCacheSecurityGroupResponse_cacheSecurityGroup = (CreateCacheSecurityGroupResponse -> Maybe CacheSecurityGroup)
-> (CreateCacheSecurityGroupResponse
-> Maybe CacheSecurityGroup -> CreateCacheSecurityGroupResponse)
-> Lens
CreateCacheSecurityGroupResponse
CreateCacheSecurityGroupResponse
(Maybe CacheSecurityGroup)
(Maybe 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 :: (Int -> f Int)
-> CreateCacheSecurityGroupResponse
-> f CreateCacheSecurityGroupResponse
createCacheSecurityGroupResponse_httpStatus = (CreateCacheSecurityGroupResponse -> Int)
-> (CreateCacheSecurityGroupResponse
-> Int -> CreateCacheSecurityGroupResponse)
-> Lens
CreateCacheSecurityGroupResponse
CreateCacheSecurityGroupResponse
Int
Int
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