{-# 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.DAX.CreateSubnetGroup
(
CreateSubnetGroup (..),
newCreateSubnetGroup,
createSubnetGroup_description,
createSubnetGroup_subnetGroupName,
createSubnetGroup_subnetIds,
CreateSubnetGroupResponse (..),
newCreateSubnetGroupResponse,
createSubnetGroupResponse_subnetGroup,
createSubnetGroupResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.DAX.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 CreateSubnetGroup = CreateSubnetGroup'
{
CreateSubnetGroup -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
CreateSubnetGroup -> Text
subnetGroupName :: Prelude.Text,
CreateSubnetGroup -> [Text]
subnetIds :: [Prelude.Text]
}
deriving (CreateSubnetGroup -> CreateSubnetGroup -> Bool
(CreateSubnetGroup -> CreateSubnetGroup -> Bool)
-> (CreateSubnetGroup -> CreateSubnetGroup -> Bool)
-> Eq CreateSubnetGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateSubnetGroup -> CreateSubnetGroup -> Bool
$c/= :: CreateSubnetGroup -> CreateSubnetGroup -> Bool
== :: CreateSubnetGroup -> CreateSubnetGroup -> Bool
$c== :: CreateSubnetGroup -> CreateSubnetGroup -> Bool
Prelude.Eq, ReadPrec [CreateSubnetGroup]
ReadPrec CreateSubnetGroup
Int -> ReadS CreateSubnetGroup
ReadS [CreateSubnetGroup]
(Int -> ReadS CreateSubnetGroup)
-> ReadS [CreateSubnetGroup]
-> ReadPrec CreateSubnetGroup
-> ReadPrec [CreateSubnetGroup]
-> Read CreateSubnetGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateSubnetGroup]
$creadListPrec :: ReadPrec [CreateSubnetGroup]
readPrec :: ReadPrec CreateSubnetGroup
$creadPrec :: ReadPrec CreateSubnetGroup
readList :: ReadS [CreateSubnetGroup]
$creadList :: ReadS [CreateSubnetGroup]
readsPrec :: Int -> ReadS CreateSubnetGroup
$creadsPrec :: Int -> ReadS CreateSubnetGroup
Prelude.Read, Int -> CreateSubnetGroup -> ShowS
[CreateSubnetGroup] -> ShowS
CreateSubnetGroup -> String
(Int -> CreateSubnetGroup -> ShowS)
-> (CreateSubnetGroup -> String)
-> ([CreateSubnetGroup] -> ShowS)
-> Show CreateSubnetGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateSubnetGroup] -> ShowS
$cshowList :: [CreateSubnetGroup] -> ShowS
show :: CreateSubnetGroup -> String
$cshow :: CreateSubnetGroup -> String
showsPrec :: Int -> CreateSubnetGroup -> ShowS
$cshowsPrec :: Int -> CreateSubnetGroup -> ShowS
Prelude.Show, (forall x. CreateSubnetGroup -> Rep CreateSubnetGroup x)
-> (forall x. Rep CreateSubnetGroup x -> CreateSubnetGroup)
-> Generic CreateSubnetGroup
forall x. Rep CreateSubnetGroup x -> CreateSubnetGroup
forall x. CreateSubnetGroup -> Rep CreateSubnetGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateSubnetGroup x -> CreateSubnetGroup
$cfrom :: forall x. CreateSubnetGroup -> Rep CreateSubnetGroup x
Prelude.Generic)
newCreateSubnetGroup ::
Prelude.Text ->
CreateSubnetGroup
newCreateSubnetGroup :: Text -> CreateSubnetGroup
newCreateSubnetGroup Text
pSubnetGroupName_ =
CreateSubnetGroup' :: Maybe Text -> Text -> [Text] -> CreateSubnetGroup
CreateSubnetGroup'
{ $sel:description:CreateSubnetGroup' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:subnetGroupName:CreateSubnetGroup' :: Text
subnetGroupName = Text
pSubnetGroupName_,
$sel:subnetIds:CreateSubnetGroup' :: [Text]
subnetIds = [Text]
forall a. Monoid a => a
Prelude.mempty
}
createSubnetGroup_description :: Lens.Lens' CreateSubnetGroup (Prelude.Maybe Prelude.Text)
createSubnetGroup_description :: (Maybe Text -> f (Maybe Text))
-> CreateSubnetGroup -> f CreateSubnetGroup
createSubnetGroup_description = (CreateSubnetGroup -> Maybe Text)
-> (CreateSubnetGroup -> Maybe Text -> CreateSubnetGroup)
-> Lens
CreateSubnetGroup CreateSubnetGroup (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSubnetGroup' {Maybe Text
description :: Maybe Text
$sel:description:CreateSubnetGroup' :: CreateSubnetGroup -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateSubnetGroup
s@CreateSubnetGroup' {} Maybe Text
a -> CreateSubnetGroup
s {$sel:description:CreateSubnetGroup' :: Maybe Text
description = Maybe Text
a} :: CreateSubnetGroup)
createSubnetGroup_subnetGroupName :: Lens.Lens' CreateSubnetGroup Prelude.Text
createSubnetGroup_subnetGroupName :: (Text -> f Text) -> CreateSubnetGroup -> f CreateSubnetGroup
createSubnetGroup_subnetGroupName = (CreateSubnetGroup -> Text)
-> (CreateSubnetGroup -> Text -> CreateSubnetGroup)
-> Lens CreateSubnetGroup CreateSubnetGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSubnetGroup' {Text
subnetGroupName :: Text
$sel:subnetGroupName:CreateSubnetGroup' :: CreateSubnetGroup -> Text
subnetGroupName} -> Text
subnetGroupName) (\s :: CreateSubnetGroup
s@CreateSubnetGroup' {} Text
a -> CreateSubnetGroup
s {$sel:subnetGroupName:CreateSubnetGroup' :: Text
subnetGroupName = Text
a} :: CreateSubnetGroup)
createSubnetGroup_subnetIds :: Lens.Lens' CreateSubnetGroup [Prelude.Text]
createSubnetGroup_subnetIds :: ([Text] -> f [Text]) -> CreateSubnetGroup -> f CreateSubnetGroup
createSubnetGroup_subnetIds = (CreateSubnetGroup -> [Text])
-> (CreateSubnetGroup -> [Text] -> CreateSubnetGroup)
-> Lens CreateSubnetGroup CreateSubnetGroup [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSubnetGroup' {[Text]
subnetIds :: [Text]
$sel:subnetIds:CreateSubnetGroup' :: CreateSubnetGroup -> [Text]
subnetIds} -> [Text]
subnetIds) (\s :: CreateSubnetGroup
s@CreateSubnetGroup' {} [Text]
a -> CreateSubnetGroup
s {$sel:subnetIds:CreateSubnetGroup' :: [Text]
subnetIds = [Text]
a} :: CreateSubnetGroup) (([Text] -> f [Text]) -> CreateSubnetGroup -> f CreateSubnetGroup)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> CreateSubnetGroup
-> f CreateSubnetGroup
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest CreateSubnetGroup where
type
AWSResponse CreateSubnetGroup =
CreateSubnetGroupResponse
request :: CreateSubnetGroup -> Request CreateSubnetGroup
request = Service -> CreateSubnetGroup -> Request CreateSubnetGroup
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateSubnetGroup
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateSubnetGroup)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateSubnetGroup))
-> Logger
-> Service
-> Proxy CreateSubnetGroup
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateSubnetGroup)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe SubnetGroup -> Int -> CreateSubnetGroupResponse
CreateSubnetGroupResponse'
(Maybe SubnetGroup -> Int -> CreateSubnetGroupResponse)
-> Either String (Maybe SubnetGroup)
-> Either String (Int -> CreateSubnetGroupResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe SubnetGroup)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"SubnetGroup")
Either String (Int -> CreateSubnetGroupResponse)
-> Either String Int -> Either String CreateSubnetGroupResponse
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 CreateSubnetGroup
instance Prelude.NFData CreateSubnetGroup
instance Core.ToHeaders CreateSubnetGroup where
toHeaders :: CreateSubnetGroup -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateSubnetGroup -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AmazonDAXV3.CreateSubnetGroup" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON CreateSubnetGroup where
toJSON :: CreateSubnetGroup -> Value
toJSON CreateSubnetGroup' {[Text]
Maybe Text
Text
subnetIds :: [Text]
subnetGroupName :: Text
description :: Maybe Text
$sel:subnetIds:CreateSubnetGroup' :: CreateSubnetGroup -> [Text]
$sel:subnetGroupName:CreateSubnetGroup' :: CreateSubnetGroup -> Text
$sel:description:CreateSubnetGroup' :: CreateSubnetGroup -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"SubnetGroupName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
subnetGroupName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"SubnetIds" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
subnetIds)
]
)
instance Core.ToPath CreateSubnetGroup where
toPath :: CreateSubnetGroup -> ByteString
toPath = ByteString -> CreateSubnetGroup -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateSubnetGroup where
toQuery :: CreateSubnetGroup -> QueryString
toQuery = QueryString -> CreateSubnetGroup -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateSubnetGroupResponse = CreateSubnetGroupResponse'
{
CreateSubnetGroupResponse -> Maybe SubnetGroup
subnetGroup :: Prelude.Maybe SubnetGroup,
CreateSubnetGroupResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateSubnetGroupResponse -> CreateSubnetGroupResponse -> Bool
(CreateSubnetGroupResponse -> CreateSubnetGroupResponse -> Bool)
-> (CreateSubnetGroupResponse -> CreateSubnetGroupResponse -> Bool)
-> Eq CreateSubnetGroupResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateSubnetGroupResponse -> CreateSubnetGroupResponse -> Bool
$c/= :: CreateSubnetGroupResponse -> CreateSubnetGroupResponse -> Bool
== :: CreateSubnetGroupResponse -> CreateSubnetGroupResponse -> Bool
$c== :: CreateSubnetGroupResponse -> CreateSubnetGroupResponse -> Bool
Prelude.Eq, ReadPrec [CreateSubnetGroupResponse]
ReadPrec CreateSubnetGroupResponse
Int -> ReadS CreateSubnetGroupResponse
ReadS [CreateSubnetGroupResponse]
(Int -> ReadS CreateSubnetGroupResponse)
-> ReadS [CreateSubnetGroupResponse]
-> ReadPrec CreateSubnetGroupResponse
-> ReadPrec [CreateSubnetGroupResponse]
-> Read CreateSubnetGroupResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateSubnetGroupResponse]
$creadListPrec :: ReadPrec [CreateSubnetGroupResponse]
readPrec :: ReadPrec CreateSubnetGroupResponse
$creadPrec :: ReadPrec CreateSubnetGroupResponse
readList :: ReadS [CreateSubnetGroupResponse]
$creadList :: ReadS [CreateSubnetGroupResponse]
readsPrec :: Int -> ReadS CreateSubnetGroupResponse
$creadsPrec :: Int -> ReadS CreateSubnetGroupResponse
Prelude.Read, Int -> CreateSubnetGroupResponse -> ShowS
[CreateSubnetGroupResponse] -> ShowS
CreateSubnetGroupResponse -> String
(Int -> CreateSubnetGroupResponse -> ShowS)
-> (CreateSubnetGroupResponse -> String)
-> ([CreateSubnetGroupResponse] -> ShowS)
-> Show CreateSubnetGroupResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateSubnetGroupResponse] -> ShowS
$cshowList :: [CreateSubnetGroupResponse] -> ShowS
show :: CreateSubnetGroupResponse -> String
$cshow :: CreateSubnetGroupResponse -> String
showsPrec :: Int -> CreateSubnetGroupResponse -> ShowS
$cshowsPrec :: Int -> CreateSubnetGroupResponse -> ShowS
Prelude.Show, (forall x.
CreateSubnetGroupResponse -> Rep CreateSubnetGroupResponse x)
-> (forall x.
Rep CreateSubnetGroupResponse x -> CreateSubnetGroupResponse)
-> Generic CreateSubnetGroupResponse
forall x.
Rep CreateSubnetGroupResponse x -> CreateSubnetGroupResponse
forall x.
CreateSubnetGroupResponse -> Rep CreateSubnetGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateSubnetGroupResponse x -> CreateSubnetGroupResponse
$cfrom :: forall x.
CreateSubnetGroupResponse -> Rep CreateSubnetGroupResponse x
Prelude.Generic)
newCreateSubnetGroupResponse ::
Prelude.Int ->
CreateSubnetGroupResponse
newCreateSubnetGroupResponse :: Int -> CreateSubnetGroupResponse
newCreateSubnetGroupResponse Int
pHttpStatus_ =
CreateSubnetGroupResponse' :: Maybe SubnetGroup -> Int -> CreateSubnetGroupResponse
CreateSubnetGroupResponse'
{ $sel:subnetGroup:CreateSubnetGroupResponse' :: Maybe SubnetGroup
subnetGroup =
Maybe SubnetGroup
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateSubnetGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createSubnetGroupResponse_subnetGroup :: Lens.Lens' CreateSubnetGroupResponse (Prelude.Maybe SubnetGroup)
createSubnetGroupResponse_subnetGroup :: (Maybe SubnetGroup -> f (Maybe SubnetGroup))
-> CreateSubnetGroupResponse -> f CreateSubnetGroupResponse
createSubnetGroupResponse_subnetGroup = (CreateSubnetGroupResponse -> Maybe SubnetGroup)
-> (CreateSubnetGroupResponse
-> Maybe SubnetGroup -> CreateSubnetGroupResponse)
-> Lens
CreateSubnetGroupResponse
CreateSubnetGroupResponse
(Maybe SubnetGroup)
(Maybe SubnetGroup)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSubnetGroupResponse' {Maybe SubnetGroup
subnetGroup :: Maybe SubnetGroup
$sel:subnetGroup:CreateSubnetGroupResponse' :: CreateSubnetGroupResponse -> Maybe SubnetGroup
subnetGroup} -> Maybe SubnetGroup
subnetGroup) (\s :: CreateSubnetGroupResponse
s@CreateSubnetGroupResponse' {} Maybe SubnetGroup
a -> CreateSubnetGroupResponse
s {$sel:subnetGroup:CreateSubnetGroupResponse' :: Maybe SubnetGroup
subnetGroup = Maybe SubnetGroup
a} :: CreateSubnetGroupResponse)
createSubnetGroupResponse_httpStatus :: Lens.Lens' CreateSubnetGroupResponse Prelude.Int
createSubnetGroupResponse_httpStatus :: (Int -> f Int)
-> CreateSubnetGroupResponse -> f CreateSubnetGroupResponse
createSubnetGroupResponse_httpStatus = (CreateSubnetGroupResponse -> Int)
-> (CreateSubnetGroupResponse -> Int -> CreateSubnetGroupResponse)
-> Lens CreateSubnetGroupResponse CreateSubnetGroupResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSubnetGroupResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateSubnetGroupResponse' :: CreateSubnetGroupResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateSubnetGroupResponse
s@CreateSubnetGroupResponse' {} Int
a -> CreateSubnetGroupResponse
s {$sel:httpStatus:CreateSubnetGroupResponse' :: Int
httpStatus = Int
a} :: CreateSubnetGroupResponse)
instance Prelude.NFData CreateSubnetGroupResponse