{-# 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.RDS.CreateDBSecurityGroup
(
CreateDBSecurityGroup (..),
newCreateDBSecurityGroup,
createDBSecurityGroup_tags,
createDBSecurityGroup_dbSecurityGroupName,
createDBSecurityGroup_dbSecurityGroupDescription,
CreateDBSecurityGroupResponse (..),
newCreateDBSecurityGroupResponse,
createDBSecurityGroupResponse_dbSecurityGroup,
createDBSecurityGroupResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.RDS.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateDBSecurityGroup = CreateDBSecurityGroup'
{
CreateDBSecurityGroup -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateDBSecurityGroup -> Text
dbSecurityGroupName :: Prelude.Text,
CreateDBSecurityGroup -> Text
dbSecurityGroupDescription :: Prelude.Text
}
deriving (CreateDBSecurityGroup -> CreateDBSecurityGroup -> Bool
(CreateDBSecurityGroup -> CreateDBSecurityGroup -> Bool)
-> (CreateDBSecurityGroup -> CreateDBSecurityGroup -> Bool)
-> Eq CreateDBSecurityGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDBSecurityGroup -> CreateDBSecurityGroup -> Bool
$c/= :: CreateDBSecurityGroup -> CreateDBSecurityGroup -> Bool
== :: CreateDBSecurityGroup -> CreateDBSecurityGroup -> Bool
$c== :: CreateDBSecurityGroup -> CreateDBSecurityGroup -> Bool
Prelude.Eq, ReadPrec [CreateDBSecurityGroup]
ReadPrec CreateDBSecurityGroup
Int -> ReadS CreateDBSecurityGroup
ReadS [CreateDBSecurityGroup]
(Int -> ReadS CreateDBSecurityGroup)
-> ReadS [CreateDBSecurityGroup]
-> ReadPrec CreateDBSecurityGroup
-> ReadPrec [CreateDBSecurityGroup]
-> Read CreateDBSecurityGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDBSecurityGroup]
$creadListPrec :: ReadPrec [CreateDBSecurityGroup]
readPrec :: ReadPrec CreateDBSecurityGroup
$creadPrec :: ReadPrec CreateDBSecurityGroup
readList :: ReadS [CreateDBSecurityGroup]
$creadList :: ReadS [CreateDBSecurityGroup]
readsPrec :: Int -> ReadS CreateDBSecurityGroup
$creadsPrec :: Int -> ReadS CreateDBSecurityGroup
Prelude.Read, Int -> CreateDBSecurityGroup -> ShowS
[CreateDBSecurityGroup] -> ShowS
CreateDBSecurityGroup -> String
(Int -> CreateDBSecurityGroup -> ShowS)
-> (CreateDBSecurityGroup -> String)
-> ([CreateDBSecurityGroup] -> ShowS)
-> Show CreateDBSecurityGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDBSecurityGroup] -> ShowS
$cshowList :: [CreateDBSecurityGroup] -> ShowS
show :: CreateDBSecurityGroup -> String
$cshow :: CreateDBSecurityGroup -> String
showsPrec :: Int -> CreateDBSecurityGroup -> ShowS
$cshowsPrec :: Int -> CreateDBSecurityGroup -> ShowS
Prelude.Show, (forall x. CreateDBSecurityGroup -> Rep CreateDBSecurityGroup x)
-> (forall x. Rep CreateDBSecurityGroup x -> CreateDBSecurityGroup)
-> Generic CreateDBSecurityGroup
forall x. Rep CreateDBSecurityGroup x -> CreateDBSecurityGroup
forall x. CreateDBSecurityGroup -> Rep CreateDBSecurityGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateDBSecurityGroup x -> CreateDBSecurityGroup
$cfrom :: forall x. CreateDBSecurityGroup -> Rep CreateDBSecurityGroup x
Prelude.Generic)
newCreateDBSecurityGroup ::
Prelude.Text ->
Prelude.Text ->
CreateDBSecurityGroup
newCreateDBSecurityGroup :: Text -> Text -> CreateDBSecurityGroup
newCreateDBSecurityGroup
Text
pDBSecurityGroupName_
Text
pDBSecurityGroupDescription_ =
CreateDBSecurityGroup' :: Maybe [Tag] -> Text -> Text -> CreateDBSecurityGroup
CreateDBSecurityGroup'
{ $sel:tags:CreateDBSecurityGroup' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:dbSecurityGroupName:CreateDBSecurityGroup' :: Text
dbSecurityGroupName = Text
pDBSecurityGroupName_,
$sel:dbSecurityGroupDescription:CreateDBSecurityGroup' :: Text
dbSecurityGroupDescription =
Text
pDBSecurityGroupDescription_
}
createDBSecurityGroup_tags :: Lens.Lens' CreateDBSecurityGroup (Prelude.Maybe [Tag])
createDBSecurityGroup_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateDBSecurityGroup -> f CreateDBSecurityGroup
createDBSecurityGroup_tags = (CreateDBSecurityGroup -> Maybe [Tag])
-> (CreateDBSecurityGroup -> Maybe [Tag] -> CreateDBSecurityGroup)
-> Lens
CreateDBSecurityGroup
CreateDBSecurityGroup
(Maybe [Tag])
(Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDBSecurityGroup' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateDBSecurityGroup' :: CreateDBSecurityGroup -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateDBSecurityGroup
s@CreateDBSecurityGroup' {} Maybe [Tag]
a -> CreateDBSecurityGroup
s {$sel:tags:CreateDBSecurityGroup' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateDBSecurityGroup) ((Maybe [Tag] -> f (Maybe [Tag]))
-> CreateDBSecurityGroup -> f CreateDBSecurityGroup)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateDBSecurityGroup
-> f CreateDBSecurityGroup
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
createDBSecurityGroup_dbSecurityGroupName :: Lens.Lens' CreateDBSecurityGroup Prelude.Text
createDBSecurityGroup_dbSecurityGroupName :: (Text -> f Text)
-> CreateDBSecurityGroup -> f CreateDBSecurityGroup
createDBSecurityGroup_dbSecurityGroupName = (CreateDBSecurityGroup -> Text)
-> (CreateDBSecurityGroup -> Text -> CreateDBSecurityGroup)
-> Lens CreateDBSecurityGroup CreateDBSecurityGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDBSecurityGroup' {Text
dbSecurityGroupName :: Text
$sel:dbSecurityGroupName:CreateDBSecurityGroup' :: CreateDBSecurityGroup -> Text
dbSecurityGroupName} -> Text
dbSecurityGroupName) (\s :: CreateDBSecurityGroup
s@CreateDBSecurityGroup' {} Text
a -> CreateDBSecurityGroup
s {$sel:dbSecurityGroupName:CreateDBSecurityGroup' :: Text
dbSecurityGroupName = Text
a} :: CreateDBSecurityGroup)
createDBSecurityGroup_dbSecurityGroupDescription :: Lens.Lens' CreateDBSecurityGroup Prelude.Text
createDBSecurityGroup_dbSecurityGroupDescription :: (Text -> f Text)
-> CreateDBSecurityGroup -> f CreateDBSecurityGroup
createDBSecurityGroup_dbSecurityGroupDescription = (CreateDBSecurityGroup -> Text)
-> (CreateDBSecurityGroup -> Text -> CreateDBSecurityGroup)
-> Lens CreateDBSecurityGroup CreateDBSecurityGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDBSecurityGroup' {Text
dbSecurityGroupDescription :: Text
$sel:dbSecurityGroupDescription:CreateDBSecurityGroup' :: CreateDBSecurityGroup -> Text
dbSecurityGroupDescription} -> Text
dbSecurityGroupDescription) (\s :: CreateDBSecurityGroup
s@CreateDBSecurityGroup' {} Text
a -> CreateDBSecurityGroup
s {$sel:dbSecurityGroupDescription:CreateDBSecurityGroup' :: Text
dbSecurityGroupDescription = Text
a} :: CreateDBSecurityGroup)
instance Core.AWSRequest CreateDBSecurityGroup where
type
AWSResponse CreateDBSecurityGroup =
CreateDBSecurityGroupResponse
request :: CreateDBSecurityGroup -> Request CreateDBSecurityGroup
request = Service -> CreateDBSecurityGroup -> Request CreateDBSecurityGroup
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy CreateDBSecurityGroup
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateDBSecurityGroup)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse CreateDBSecurityGroup))
-> Logger
-> Service
-> Proxy CreateDBSecurityGroup
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateDBSecurityGroup)))
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
"CreateDBSecurityGroupResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe DBSecurityGroup -> Int -> CreateDBSecurityGroupResponse
CreateDBSecurityGroupResponse'
(Maybe DBSecurityGroup -> Int -> CreateDBSecurityGroupResponse)
-> Either String (Maybe DBSecurityGroup)
-> Either String (Int -> CreateDBSecurityGroupResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe DBSecurityGroup)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DBSecurityGroup")
Either String (Int -> CreateDBSecurityGroupResponse)
-> Either String Int -> Either String CreateDBSecurityGroupResponse
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 CreateDBSecurityGroup
instance Prelude.NFData CreateDBSecurityGroup
instance Core.ToHeaders CreateDBSecurityGroup where
toHeaders :: CreateDBSecurityGroup -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateDBSecurityGroup -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath CreateDBSecurityGroup where
toPath :: CreateDBSecurityGroup -> ByteString
toPath = ByteString -> CreateDBSecurityGroup -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateDBSecurityGroup where
toQuery :: CreateDBSecurityGroup -> QueryString
toQuery CreateDBSecurityGroup' {Maybe [Tag]
Text
dbSecurityGroupDescription :: Text
dbSecurityGroupName :: Text
tags :: Maybe [Tag]
$sel:dbSecurityGroupDescription:CreateDBSecurityGroup' :: CreateDBSecurityGroup -> Text
$sel:dbSecurityGroupName:CreateDBSecurityGroup' :: CreateDBSecurityGroup -> Text
$sel:tags:CreateDBSecurityGroup' :: CreateDBSecurityGroup -> 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
"CreateDBSecurityGroup" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2014-10-31" :: 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
"DBSecurityGroupName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
dbSecurityGroupName,
ByteString
"DBSecurityGroupDescription"
ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
dbSecurityGroupDescription
]
data CreateDBSecurityGroupResponse = CreateDBSecurityGroupResponse'
{ CreateDBSecurityGroupResponse -> Maybe DBSecurityGroup
dbSecurityGroup :: Prelude.Maybe DBSecurityGroup,
CreateDBSecurityGroupResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateDBSecurityGroupResponse
-> CreateDBSecurityGroupResponse -> Bool
(CreateDBSecurityGroupResponse
-> CreateDBSecurityGroupResponse -> Bool)
-> (CreateDBSecurityGroupResponse
-> CreateDBSecurityGroupResponse -> Bool)
-> Eq CreateDBSecurityGroupResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDBSecurityGroupResponse
-> CreateDBSecurityGroupResponse -> Bool
$c/= :: CreateDBSecurityGroupResponse
-> CreateDBSecurityGroupResponse -> Bool
== :: CreateDBSecurityGroupResponse
-> CreateDBSecurityGroupResponse -> Bool
$c== :: CreateDBSecurityGroupResponse
-> CreateDBSecurityGroupResponse -> Bool
Prelude.Eq, ReadPrec [CreateDBSecurityGroupResponse]
ReadPrec CreateDBSecurityGroupResponse
Int -> ReadS CreateDBSecurityGroupResponse
ReadS [CreateDBSecurityGroupResponse]
(Int -> ReadS CreateDBSecurityGroupResponse)
-> ReadS [CreateDBSecurityGroupResponse]
-> ReadPrec CreateDBSecurityGroupResponse
-> ReadPrec [CreateDBSecurityGroupResponse]
-> Read CreateDBSecurityGroupResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDBSecurityGroupResponse]
$creadListPrec :: ReadPrec [CreateDBSecurityGroupResponse]
readPrec :: ReadPrec CreateDBSecurityGroupResponse
$creadPrec :: ReadPrec CreateDBSecurityGroupResponse
readList :: ReadS [CreateDBSecurityGroupResponse]
$creadList :: ReadS [CreateDBSecurityGroupResponse]
readsPrec :: Int -> ReadS CreateDBSecurityGroupResponse
$creadsPrec :: Int -> ReadS CreateDBSecurityGroupResponse
Prelude.Read, Int -> CreateDBSecurityGroupResponse -> ShowS
[CreateDBSecurityGroupResponse] -> ShowS
CreateDBSecurityGroupResponse -> String
(Int -> CreateDBSecurityGroupResponse -> ShowS)
-> (CreateDBSecurityGroupResponse -> String)
-> ([CreateDBSecurityGroupResponse] -> ShowS)
-> Show CreateDBSecurityGroupResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDBSecurityGroupResponse] -> ShowS
$cshowList :: [CreateDBSecurityGroupResponse] -> ShowS
show :: CreateDBSecurityGroupResponse -> String
$cshow :: CreateDBSecurityGroupResponse -> String
showsPrec :: Int -> CreateDBSecurityGroupResponse -> ShowS
$cshowsPrec :: Int -> CreateDBSecurityGroupResponse -> ShowS
Prelude.Show, (forall x.
CreateDBSecurityGroupResponse
-> Rep CreateDBSecurityGroupResponse x)
-> (forall x.
Rep CreateDBSecurityGroupResponse x
-> CreateDBSecurityGroupResponse)
-> Generic CreateDBSecurityGroupResponse
forall x.
Rep CreateDBSecurityGroupResponse x
-> CreateDBSecurityGroupResponse
forall x.
CreateDBSecurityGroupResponse
-> Rep CreateDBSecurityGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateDBSecurityGroupResponse x
-> CreateDBSecurityGroupResponse
$cfrom :: forall x.
CreateDBSecurityGroupResponse
-> Rep CreateDBSecurityGroupResponse x
Prelude.Generic)
newCreateDBSecurityGroupResponse ::
Prelude.Int ->
CreateDBSecurityGroupResponse
newCreateDBSecurityGroupResponse :: Int -> CreateDBSecurityGroupResponse
newCreateDBSecurityGroupResponse Int
pHttpStatus_ =
CreateDBSecurityGroupResponse' :: Maybe DBSecurityGroup -> Int -> CreateDBSecurityGroupResponse
CreateDBSecurityGroupResponse'
{ $sel:dbSecurityGroup:CreateDBSecurityGroupResponse' :: Maybe DBSecurityGroup
dbSecurityGroup =
Maybe DBSecurityGroup
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateDBSecurityGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createDBSecurityGroupResponse_dbSecurityGroup :: Lens.Lens' CreateDBSecurityGroupResponse (Prelude.Maybe DBSecurityGroup)
createDBSecurityGroupResponse_dbSecurityGroup :: (Maybe DBSecurityGroup -> f (Maybe DBSecurityGroup))
-> CreateDBSecurityGroupResponse -> f CreateDBSecurityGroupResponse
createDBSecurityGroupResponse_dbSecurityGroup = (CreateDBSecurityGroupResponse -> Maybe DBSecurityGroup)
-> (CreateDBSecurityGroupResponse
-> Maybe DBSecurityGroup -> CreateDBSecurityGroupResponse)
-> Lens
CreateDBSecurityGroupResponse
CreateDBSecurityGroupResponse
(Maybe DBSecurityGroup)
(Maybe DBSecurityGroup)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDBSecurityGroupResponse' {Maybe DBSecurityGroup
dbSecurityGroup :: Maybe DBSecurityGroup
$sel:dbSecurityGroup:CreateDBSecurityGroupResponse' :: CreateDBSecurityGroupResponse -> Maybe DBSecurityGroup
dbSecurityGroup} -> Maybe DBSecurityGroup
dbSecurityGroup) (\s :: CreateDBSecurityGroupResponse
s@CreateDBSecurityGroupResponse' {} Maybe DBSecurityGroup
a -> CreateDBSecurityGroupResponse
s {$sel:dbSecurityGroup:CreateDBSecurityGroupResponse' :: Maybe DBSecurityGroup
dbSecurityGroup = Maybe DBSecurityGroup
a} :: CreateDBSecurityGroupResponse)
createDBSecurityGroupResponse_httpStatus :: Lens.Lens' CreateDBSecurityGroupResponse Prelude.Int
createDBSecurityGroupResponse_httpStatus :: (Int -> f Int)
-> CreateDBSecurityGroupResponse -> f CreateDBSecurityGroupResponse
createDBSecurityGroupResponse_httpStatus = (CreateDBSecurityGroupResponse -> Int)
-> (CreateDBSecurityGroupResponse
-> Int -> CreateDBSecurityGroupResponse)
-> Lens
CreateDBSecurityGroupResponse CreateDBSecurityGroupResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDBSecurityGroupResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateDBSecurityGroupResponse' :: CreateDBSecurityGroupResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateDBSecurityGroupResponse
s@CreateDBSecurityGroupResponse' {} Int
a -> CreateDBSecurityGroupResponse
s {$sel:httpStatus:CreateDBSecurityGroupResponse' :: Int
httpStatus = Int
a} :: CreateDBSecurityGroupResponse)
instance Prelude.NFData CreateDBSecurityGroupResponse