{-# 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.CreateOptionGroup
(
CreateOptionGroup (..),
newCreateOptionGroup,
createOptionGroup_tags,
createOptionGroup_optionGroupName,
createOptionGroup_engineName,
createOptionGroup_majorEngineVersion,
createOptionGroup_optionGroupDescription,
CreateOptionGroupResponse (..),
newCreateOptionGroupResponse,
createOptionGroupResponse_optionGroup,
createOptionGroupResponse_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 CreateOptionGroup = CreateOptionGroup'
{
CreateOptionGroup -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateOptionGroup -> Text
optionGroupName :: Prelude.Text,
CreateOptionGroup -> Text
engineName :: Prelude.Text,
CreateOptionGroup -> Text
majorEngineVersion :: Prelude.Text,
CreateOptionGroup -> Text
optionGroupDescription :: Prelude.Text
}
deriving (CreateOptionGroup -> CreateOptionGroup -> Bool
(CreateOptionGroup -> CreateOptionGroup -> Bool)
-> (CreateOptionGroup -> CreateOptionGroup -> Bool)
-> Eq CreateOptionGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateOptionGroup -> CreateOptionGroup -> Bool
$c/= :: CreateOptionGroup -> CreateOptionGroup -> Bool
== :: CreateOptionGroup -> CreateOptionGroup -> Bool
$c== :: CreateOptionGroup -> CreateOptionGroup -> Bool
Prelude.Eq, ReadPrec [CreateOptionGroup]
ReadPrec CreateOptionGroup
Int -> ReadS CreateOptionGroup
ReadS [CreateOptionGroup]
(Int -> ReadS CreateOptionGroup)
-> ReadS [CreateOptionGroup]
-> ReadPrec CreateOptionGroup
-> ReadPrec [CreateOptionGroup]
-> Read CreateOptionGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateOptionGroup]
$creadListPrec :: ReadPrec [CreateOptionGroup]
readPrec :: ReadPrec CreateOptionGroup
$creadPrec :: ReadPrec CreateOptionGroup
readList :: ReadS [CreateOptionGroup]
$creadList :: ReadS [CreateOptionGroup]
readsPrec :: Int -> ReadS CreateOptionGroup
$creadsPrec :: Int -> ReadS CreateOptionGroup
Prelude.Read, Int -> CreateOptionGroup -> ShowS
[CreateOptionGroup] -> ShowS
CreateOptionGroup -> String
(Int -> CreateOptionGroup -> ShowS)
-> (CreateOptionGroup -> String)
-> ([CreateOptionGroup] -> ShowS)
-> Show CreateOptionGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateOptionGroup] -> ShowS
$cshowList :: [CreateOptionGroup] -> ShowS
show :: CreateOptionGroup -> String
$cshow :: CreateOptionGroup -> String
showsPrec :: Int -> CreateOptionGroup -> ShowS
$cshowsPrec :: Int -> CreateOptionGroup -> ShowS
Prelude.Show, (forall x. CreateOptionGroup -> Rep CreateOptionGroup x)
-> (forall x. Rep CreateOptionGroup x -> CreateOptionGroup)
-> Generic CreateOptionGroup
forall x. Rep CreateOptionGroup x -> CreateOptionGroup
forall x. CreateOptionGroup -> Rep CreateOptionGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateOptionGroup x -> CreateOptionGroup
$cfrom :: forall x. CreateOptionGroup -> Rep CreateOptionGroup x
Prelude.Generic)
newCreateOptionGroup ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
CreateOptionGroup
newCreateOptionGroup :: Text -> Text -> Text -> Text -> CreateOptionGroup
newCreateOptionGroup
Text
pOptionGroupName_
Text
pEngineName_
Text
pMajorEngineVersion_
Text
pOptionGroupDescription_ =
CreateOptionGroup' :: Maybe [Tag] -> Text -> Text -> Text -> Text -> CreateOptionGroup
CreateOptionGroup'
{ $sel:tags:CreateOptionGroup' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:optionGroupName:CreateOptionGroup' :: Text
optionGroupName = Text
pOptionGroupName_,
$sel:engineName:CreateOptionGroup' :: Text
engineName = Text
pEngineName_,
$sel:majorEngineVersion:CreateOptionGroup' :: Text
majorEngineVersion = Text
pMajorEngineVersion_,
$sel:optionGroupDescription:CreateOptionGroup' :: Text
optionGroupDescription = Text
pOptionGroupDescription_
}
createOptionGroup_tags :: Lens.Lens' CreateOptionGroup (Prelude.Maybe [Tag])
createOptionGroup_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateOptionGroup -> f CreateOptionGroup
createOptionGroup_tags = (CreateOptionGroup -> Maybe [Tag])
-> (CreateOptionGroup -> Maybe [Tag] -> CreateOptionGroup)
-> Lens
CreateOptionGroup CreateOptionGroup (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOptionGroup' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateOptionGroup' :: CreateOptionGroup -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateOptionGroup
s@CreateOptionGroup' {} Maybe [Tag]
a -> CreateOptionGroup
s {$sel:tags:CreateOptionGroup' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateOptionGroup) ((Maybe [Tag] -> f (Maybe [Tag]))
-> CreateOptionGroup -> f CreateOptionGroup)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateOptionGroup
-> f CreateOptionGroup
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
createOptionGroup_optionGroupName :: Lens.Lens' CreateOptionGroup Prelude.Text
createOptionGroup_optionGroupName :: (Text -> f Text) -> CreateOptionGroup -> f CreateOptionGroup
createOptionGroup_optionGroupName = (CreateOptionGroup -> Text)
-> (CreateOptionGroup -> Text -> CreateOptionGroup)
-> Lens CreateOptionGroup CreateOptionGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOptionGroup' {Text
optionGroupName :: Text
$sel:optionGroupName:CreateOptionGroup' :: CreateOptionGroup -> Text
optionGroupName} -> Text
optionGroupName) (\s :: CreateOptionGroup
s@CreateOptionGroup' {} Text
a -> CreateOptionGroup
s {$sel:optionGroupName:CreateOptionGroup' :: Text
optionGroupName = Text
a} :: CreateOptionGroup)
createOptionGroup_engineName :: Lens.Lens' CreateOptionGroup Prelude.Text
createOptionGroup_engineName :: (Text -> f Text) -> CreateOptionGroup -> f CreateOptionGroup
createOptionGroup_engineName = (CreateOptionGroup -> Text)
-> (CreateOptionGroup -> Text -> CreateOptionGroup)
-> Lens CreateOptionGroup CreateOptionGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOptionGroup' {Text
engineName :: Text
$sel:engineName:CreateOptionGroup' :: CreateOptionGroup -> Text
engineName} -> Text
engineName) (\s :: CreateOptionGroup
s@CreateOptionGroup' {} Text
a -> CreateOptionGroup
s {$sel:engineName:CreateOptionGroup' :: Text
engineName = Text
a} :: CreateOptionGroup)
createOptionGroup_majorEngineVersion :: Lens.Lens' CreateOptionGroup Prelude.Text
createOptionGroup_majorEngineVersion :: (Text -> f Text) -> CreateOptionGroup -> f CreateOptionGroup
createOptionGroup_majorEngineVersion = (CreateOptionGroup -> Text)
-> (CreateOptionGroup -> Text -> CreateOptionGroup)
-> Lens CreateOptionGroup CreateOptionGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOptionGroup' {Text
majorEngineVersion :: Text
$sel:majorEngineVersion:CreateOptionGroup' :: CreateOptionGroup -> Text
majorEngineVersion} -> Text
majorEngineVersion) (\s :: CreateOptionGroup
s@CreateOptionGroup' {} Text
a -> CreateOptionGroup
s {$sel:majorEngineVersion:CreateOptionGroup' :: Text
majorEngineVersion = Text
a} :: CreateOptionGroup)
createOptionGroup_optionGroupDescription :: Lens.Lens' CreateOptionGroup Prelude.Text
createOptionGroup_optionGroupDescription :: (Text -> f Text) -> CreateOptionGroup -> f CreateOptionGroup
createOptionGroup_optionGroupDescription = (CreateOptionGroup -> Text)
-> (CreateOptionGroup -> Text -> CreateOptionGroup)
-> Lens CreateOptionGroup CreateOptionGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOptionGroup' {Text
optionGroupDescription :: Text
$sel:optionGroupDescription:CreateOptionGroup' :: CreateOptionGroup -> Text
optionGroupDescription} -> Text
optionGroupDescription) (\s :: CreateOptionGroup
s@CreateOptionGroup' {} Text
a -> CreateOptionGroup
s {$sel:optionGroupDescription:CreateOptionGroup' :: Text
optionGroupDescription = Text
a} :: CreateOptionGroup)
instance Core.AWSRequest CreateOptionGroup where
type
AWSResponse CreateOptionGroup =
CreateOptionGroupResponse
request :: CreateOptionGroup -> Request CreateOptionGroup
request = Service -> CreateOptionGroup -> Request CreateOptionGroup
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy CreateOptionGroup
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateOptionGroup)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse CreateOptionGroup))
-> Logger
-> Service
-> Proxy CreateOptionGroup
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateOptionGroup)))
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
"CreateOptionGroupResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe OptionGroup -> Int -> CreateOptionGroupResponse
CreateOptionGroupResponse'
(Maybe OptionGroup -> Int -> CreateOptionGroupResponse)
-> Either String (Maybe OptionGroup)
-> Either String (Int -> CreateOptionGroupResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe OptionGroup)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"OptionGroup")
Either String (Int -> CreateOptionGroupResponse)
-> Either String Int -> Either String CreateOptionGroupResponse
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 CreateOptionGroup
instance Prelude.NFData CreateOptionGroup
instance Core.ToHeaders CreateOptionGroup where
toHeaders :: CreateOptionGroup -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateOptionGroup -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath CreateOptionGroup where
toPath :: CreateOptionGroup -> ByteString
toPath = ByteString -> CreateOptionGroup -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateOptionGroup where
toQuery :: CreateOptionGroup -> QueryString
toQuery CreateOptionGroup' {Maybe [Tag]
Text
optionGroupDescription :: Text
majorEngineVersion :: Text
engineName :: Text
optionGroupName :: Text
tags :: Maybe [Tag]
$sel:optionGroupDescription:CreateOptionGroup' :: CreateOptionGroup -> Text
$sel:majorEngineVersion:CreateOptionGroup' :: CreateOptionGroup -> Text
$sel:engineName:CreateOptionGroup' :: CreateOptionGroup -> Text
$sel:optionGroupName:CreateOptionGroup' :: CreateOptionGroup -> Text
$sel:tags:CreateOptionGroup' :: CreateOptionGroup -> 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
"CreateOptionGroup" :: 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
"OptionGroupName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
optionGroupName,
ByteString
"EngineName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
engineName,
ByteString
"MajorEngineVersion" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
majorEngineVersion,
ByteString
"OptionGroupDescription"
ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
optionGroupDescription
]
data CreateOptionGroupResponse = CreateOptionGroupResponse'
{ CreateOptionGroupResponse -> Maybe OptionGroup
optionGroup :: Prelude.Maybe OptionGroup,
CreateOptionGroupResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateOptionGroupResponse -> CreateOptionGroupResponse -> Bool
(CreateOptionGroupResponse -> CreateOptionGroupResponse -> Bool)
-> (CreateOptionGroupResponse -> CreateOptionGroupResponse -> Bool)
-> Eq CreateOptionGroupResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateOptionGroupResponse -> CreateOptionGroupResponse -> Bool
$c/= :: CreateOptionGroupResponse -> CreateOptionGroupResponse -> Bool
== :: CreateOptionGroupResponse -> CreateOptionGroupResponse -> Bool
$c== :: CreateOptionGroupResponse -> CreateOptionGroupResponse -> Bool
Prelude.Eq, ReadPrec [CreateOptionGroupResponse]
ReadPrec CreateOptionGroupResponse
Int -> ReadS CreateOptionGroupResponse
ReadS [CreateOptionGroupResponse]
(Int -> ReadS CreateOptionGroupResponse)
-> ReadS [CreateOptionGroupResponse]
-> ReadPrec CreateOptionGroupResponse
-> ReadPrec [CreateOptionGroupResponse]
-> Read CreateOptionGroupResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateOptionGroupResponse]
$creadListPrec :: ReadPrec [CreateOptionGroupResponse]
readPrec :: ReadPrec CreateOptionGroupResponse
$creadPrec :: ReadPrec CreateOptionGroupResponse
readList :: ReadS [CreateOptionGroupResponse]
$creadList :: ReadS [CreateOptionGroupResponse]
readsPrec :: Int -> ReadS CreateOptionGroupResponse
$creadsPrec :: Int -> ReadS CreateOptionGroupResponse
Prelude.Read, Int -> CreateOptionGroupResponse -> ShowS
[CreateOptionGroupResponse] -> ShowS
CreateOptionGroupResponse -> String
(Int -> CreateOptionGroupResponse -> ShowS)
-> (CreateOptionGroupResponse -> String)
-> ([CreateOptionGroupResponse] -> ShowS)
-> Show CreateOptionGroupResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateOptionGroupResponse] -> ShowS
$cshowList :: [CreateOptionGroupResponse] -> ShowS
show :: CreateOptionGroupResponse -> String
$cshow :: CreateOptionGroupResponse -> String
showsPrec :: Int -> CreateOptionGroupResponse -> ShowS
$cshowsPrec :: Int -> CreateOptionGroupResponse -> ShowS
Prelude.Show, (forall x.
CreateOptionGroupResponse -> Rep CreateOptionGroupResponse x)
-> (forall x.
Rep CreateOptionGroupResponse x -> CreateOptionGroupResponse)
-> Generic CreateOptionGroupResponse
forall x.
Rep CreateOptionGroupResponse x -> CreateOptionGroupResponse
forall x.
CreateOptionGroupResponse -> Rep CreateOptionGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateOptionGroupResponse x -> CreateOptionGroupResponse
$cfrom :: forall x.
CreateOptionGroupResponse -> Rep CreateOptionGroupResponse x
Prelude.Generic)
newCreateOptionGroupResponse ::
Prelude.Int ->
CreateOptionGroupResponse
newCreateOptionGroupResponse :: Int -> CreateOptionGroupResponse
newCreateOptionGroupResponse Int
pHttpStatus_ =
CreateOptionGroupResponse' :: Maybe OptionGroup -> Int -> CreateOptionGroupResponse
CreateOptionGroupResponse'
{ $sel:optionGroup:CreateOptionGroupResponse' :: Maybe OptionGroup
optionGroup =
Maybe OptionGroup
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateOptionGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createOptionGroupResponse_optionGroup :: Lens.Lens' CreateOptionGroupResponse (Prelude.Maybe OptionGroup)
createOptionGroupResponse_optionGroup :: (Maybe OptionGroup -> f (Maybe OptionGroup))
-> CreateOptionGroupResponse -> f CreateOptionGroupResponse
createOptionGroupResponse_optionGroup = (CreateOptionGroupResponse -> Maybe OptionGroup)
-> (CreateOptionGroupResponse
-> Maybe OptionGroup -> CreateOptionGroupResponse)
-> Lens
CreateOptionGroupResponse
CreateOptionGroupResponse
(Maybe OptionGroup)
(Maybe OptionGroup)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOptionGroupResponse' {Maybe OptionGroup
optionGroup :: Maybe OptionGroup
$sel:optionGroup:CreateOptionGroupResponse' :: CreateOptionGroupResponse -> Maybe OptionGroup
optionGroup} -> Maybe OptionGroup
optionGroup) (\s :: CreateOptionGroupResponse
s@CreateOptionGroupResponse' {} Maybe OptionGroup
a -> CreateOptionGroupResponse
s {$sel:optionGroup:CreateOptionGroupResponse' :: Maybe OptionGroup
optionGroup = Maybe OptionGroup
a} :: CreateOptionGroupResponse)
createOptionGroupResponse_httpStatus :: Lens.Lens' CreateOptionGroupResponse Prelude.Int
createOptionGroupResponse_httpStatus :: (Int -> f Int)
-> CreateOptionGroupResponse -> f CreateOptionGroupResponse
createOptionGroupResponse_httpStatus = (CreateOptionGroupResponse -> Int)
-> (CreateOptionGroupResponse -> Int -> CreateOptionGroupResponse)
-> Lens CreateOptionGroupResponse CreateOptionGroupResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOptionGroupResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateOptionGroupResponse' :: CreateOptionGroupResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateOptionGroupResponse
s@CreateOptionGroupResponse' {} Int
a -> CreateOptionGroupResponse
s {$sel:httpStatus:CreateOptionGroupResponse' :: Int
httpStatus = Int
a} :: CreateOptionGroupResponse)
instance Prelude.NFData CreateOptionGroupResponse