{-# 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.MemoryDb.UpdateSubnetGroup
(
UpdateSubnetGroup (..),
newUpdateSubnetGroup,
updateSubnetGroup_subnetIds,
updateSubnetGroup_description,
updateSubnetGroup_subnetGroupName,
UpdateSubnetGroupResponse (..),
newUpdateSubnetGroupResponse,
updateSubnetGroupResponse_subnetGroup,
updateSubnetGroupResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MemoryDb.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data UpdateSubnetGroup = UpdateSubnetGroup'
{
UpdateSubnetGroup -> Maybe [Text]
subnetIds :: Prelude.Maybe [Prelude.Text],
UpdateSubnetGroup -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
UpdateSubnetGroup -> Text
subnetGroupName :: Prelude.Text
}
deriving (UpdateSubnetGroup -> UpdateSubnetGroup -> Bool
(UpdateSubnetGroup -> UpdateSubnetGroup -> Bool)
-> (UpdateSubnetGroup -> UpdateSubnetGroup -> Bool)
-> Eq UpdateSubnetGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateSubnetGroup -> UpdateSubnetGroup -> Bool
$c/= :: UpdateSubnetGroup -> UpdateSubnetGroup -> Bool
== :: UpdateSubnetGroup -> UpdateSubnetGroup -> Bool
$c== :: UpdateSubnetGroup -> UpdateSubnetGroup -> Bool
Prelude.Eq, ReadPrec [UpdateSubnetGroup]
ReadPrec UpdateSubnetGroup
Int -> ReadS UpdateSubnetGroup
ReadS [UpdateSubnetGroup]
(Int -> ReadS UpdateSubnetGroup)
-> ReadS [UpdateSubnetGroup]
-> ReadPrec UpdateSubnetGroup
-> ReadPrec [UpdateSubnetGroup]
-> Read UpdateSubnetGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateSubnetGroup]
$creadListPrec :: ReadPrec [UpdateSubnetGroup]
readPrec :: ReadPrec UpdateSubnetGroup
$creadPrec :: ReadPrec UpdateSubnetGroup
readList :: ReadS [UpdateSubnetGroup]
$creadList :: ReadS [UpdateSubnetGroup]
readsPrec :: Int -> ReadS UpdateSubnetGroup
$creadsPrec :: Int -> ReadS UpdateSubnetGroup
Prelude.Read, Int -> UpdateSubnetGroup -> ShowS
[UpdateSubnetGroup] -> ShowS
UpdateSubnetGroup -> String
(Int -> UpdateSubnetGroup -> ShowS)
-> (UpdateSubnetGroup -> String)
-> ([UpdateSubnetGroup] -> ShowS)
-> Show UpdateSubnetGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateSubnetGroup] -> ShowS
$cshowList :: [UpdateSubnetGroup] -> ShowS
show :: UpdateSubnetGroup -> String
$cshow :: UpdateSubnetGroup -> String
showsPrec :: Int -> UpdateSubnetGroup -> ShowS
$cshowsPrec :: Int -> UpdateSubnetGroup -> ShowS
Prelude.Show, (forall x. UpdateSubnetGroup -> Rep UpdateSubnetGroup x)
-> (forall x. Rep UpdateSubnetGroup x -> UpdateSubnetGroup)
-> Generic UpdateSubnetGroup
forall x. Rep UpdateSubnetGroup x -> UpdateSubnetGroup
forall x. UpdateSubnetGroup -> Rep UpdateSubnetGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateSubnetGroup x -> UpdateSubnetGroup
$cfrom :: forall x. UpdateSubnetGroup -> Rep UpdateSubnetGroup x
Prelude.Generic)
newUpdateSubnetGroup ::
Prelude.Text ->
UpdateSubnetGroup
newUpdateSubnetGroup :: Text -> UpdateSubnetGroup
newUpdateSubnetGroup Text
pSubnetGroupName_ =
UpdateSubnetGroup' :: Maybe [Text] -> Maybe Text -> Text -> UpdateSubnetGroup
UpdateSubnetGroup'
{ $sel:subnetIds:UpdateSubnetGroup' :: Maybe [Text]
subnetIds = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:description:UpdateSubnetGroup' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:subnetGroupName:UpdateSubnetGroup' :: Text
subnetGroupName = Text
pSubnetGroupName_
}
updateSubnetGroup_subnetIds :: Lens.Lens' UpdateSubnetGroup (Prelude.Maybe [Prelude.Text])
updateSubnetGroup_subnetIds :: (Maybe [Text] -> f (Maybe [Text]))
-> UpdateSubnetGroup -> f UpdateSubnetGroup
updateSubnetGroup_subnetIds = (UpdateSubnetGroup -> Maybe [Text])
-> (UpdateSubnetGroup -> Maybe [Text] -> UpdateSubnetGroup)
-> Lens
UpdateSubnetGroup UpdateSubnetGroup (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSubnetGroup' {Maybe [Text]
subnetIds :: Maybe [Text]
$sel:subnetIds:UpdateSubnetGroup' :: UpdateSubnetGroup -> Maybe [Text]
subnetIds} -> Maybe [Text]
subnetIds) (\s :: UpdateSubnetGroup
s@UpdateSubnetGroup' {} Maybe [Text]
a -> UpdateSubnetGroup
s {$sel:subnetIds:UpdateSubnetGroup' :: Maybe [Text]
subnetIds = Maybe [Text]
a} :: UpdateSubnetGroup) ((Maybe [Text] -> f (Maybe [Text]))
-> UpdateSubnetGroup -> f UpdateSubnetGroup)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> UpdateSubnetGroup
-> f UpdateSubnetGroup
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
updateSubnetGroup_description :: Lens.Lens' UpdateSubnetGroup (Prelude.Maybe Prelude.Text)
updateSubnetGroup_description :: (Maybe Text -> f (Maybe Text))
-> UpdateSubnetGroup -> f UpdateSubnetGroup
updateSubnetGroup_description = (UpdateSubnetGroup -> Maybe Text)
-> (UpdateSubnetGroup -> Maybe Text -> UpdateSubnetGroup)
-> Lens
UpdateSubnetGroup UpdateSubnetGroup (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSubnetGroup' {Maybe Text
description :: Maybe Text
$sel:description:UpdateSubnetGroup' :: UpdateSubnetGroup -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateSubnetGroup
s@UpdateSubnetGroup' {} Maybe Text
a -> UpdateSubnetGroup
s {$sel:description:UpdateSubnetGroup' :: Maybe Text
description = Maybe Text
a} :: UpdateSubnetGroup)
updateSubnetGroup_subnetGroupName :: Lens.Lens' UpdateSubnetGroup Prelude.Text
updateSubnetGroup_subnetGroupName :: (Text -> f Text) -> UpdateSubnetGroup -> f UpdateSubnetGroup
updateSubnetGroup_subnetGroupName = (UpdateSubnetGroup -> Text)
-> (UpdateSubnetGroup -> Text -> UpdateSubnetGroup)
-> Lens UpdateSubnetGroup UpdateSubnetGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSubnetGroup' {Text
subnetGroupName :: Text
$sel:subnetGroupName:UpdateSubnetGroup' :: UpdateSubnetGroup -> Text
subnetGroupName} -> Text
subnetGroupName) (\s :: UpdateSubnetGroup
s@UpdateSubnetGroup' {} Text
a -> UpdateSubnetGroup
s {$sel:subnetGroupName:UpdateSubnetGroup' :: Text
subnetGroupName = Text
a} :: UpdateSubnetGroup)
instance Core.AWSRequest UpdateSubnetGroup where
type
AWSResponse UpdateSubnetGroup =
UpdateSubnetGroupResponse
request :: UpdateSubnetGroup -> Request UpdateSubnetGroup
request = Service -> UpdateSubnetGroup -> Request UpdateSubnetGroup
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateSubnetGroup
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateSubnetGroup)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateSubnetGroup))
-> Logger
-> Service
-> Proxy UpdateSubnetGroup
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateSubnetGroup)))
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 -> UpdateSubnetGroupResponse
UpdateSubnetGroupResponse'
(Maybe SubnetGroup -> Int -> UpdateSubnetGroupResponse)
-> Either String (Maybe SubnetGroup)
-> Either String (Int -> UpdateSubnetGroupResponse)
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 -> UpdateSubnetGroupResponse)
-> Either String Int -> Either String UpdateSubnetGroupResponse
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 UpdateSubnetGroup
instance Prelude.NFData UpdateSubnetGroup
instance Core.ToHeaders UpdateSubnetGroup where
toHeaders :: UpdateSubnetGroup -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateSubnetGroup -> 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
"AmazonMemoryDB.UpdateSubnetGroup" ::
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 UpdateSubnetGroup where
toJSON :: UpdateSubnetGroup -> Value
toJSON UpdateSubnetGroup' {Maybe [Text]
Maybe Text
Text
subnetGroupName :: Text
description :: Maybe Text
subnetIds :: Maybe [Text]
$sel:subnetGroupName:UpdateSubnetGroup' :: UpdateSubnetGroup -> Text
$sel:description:UpdateSubnetGroup' :: UpdateSubnetGroup -> Maybe Text
$sel:subnetIds:UpdateSubnetGroup' :: UpdateSubnetGroup -> Maybe [Text]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"SubnetIds" 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]
subnetIds,
(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)
]
)
instance Core.ToPath UpdateSubnetGroup where
toPath :: UpdateSubnetGroup -> ByteString
toPath = ByteString -> UpdateSubnetGroup -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateSubnetGroup where
toQuery :: UpdateSubnetGroup -> QueryString
toQuery = QueryString -> UpdateSubnetGroup -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateSubnetGroupResponse = UpdateSubnetGroupResponse'
{
UpdateSubnetGroupResponse -> Maybe SubnetGroup
subnetGroup :: Prelude.Maybe SubnetGroup,
UpdateSubnetGroupResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateSubnetGroupResponse -> UpdateSubnetGroupResponse -> Bool
(UpdateSubnetGroupResponse -> UpdateSubnetGroupResponse -> Bool)
-> (UpdateSubnetGroupResponse -> UpdateSubnetGroupResponse -> Bool)
-> Eq UpdateSubnetGroupResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateSubnetGroupResponse -> UpdateSubnetGroupResponse -> Bool
$c/= :: UpdateSubnetGroupResponse -> UpdateSubnetGroupResponse -> Bool
== :: UpdateSubnetGroupResponse -> UpdateSubnetGroupResponse -> Bool
$c== :: UpdateSubnetGroupResponse -> UpdateSubnetGroupResponse -> Bool
Prelude.Eq, ReadPrec [UpdateSubnetGroupResponse]
ReadPrec UpdateSubnetGroupResponse
Int -> ReadS UpdateSubnetGroupResponse
ReadS [UpdateSubnetGroupResponse]
(Int -> ReadS UpdateSubnetGroupResponse)
-> ReadS [UpdateSubnetGroupResponse]
-> ReadPrec UpdateSubnetGroupResponse
-> ReadPrec [UpdateSubnetGroupResponse]
-> Read UpdateSubnetGroupResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateSubnetGroupResponse]
$creadListPrec :: ReadPrec [UpdateSubnetGroupResponse]
readPrec :: ReadPrec UpdateSubnetGroupResponse
$creadPrec :: ReadPrec UpdateSubnetGroupResponse
readList :: ReadS [UpdateSubnetGroupResponse]
$creadList :: ReadS [UpdateSubnetGroupResponse]
readsPrec :: Int -> ReadS UpdateSubnetGroupResponse
$creadsPrec :: Int -> ReadS UpdateSubnetGroupResponse
Prelude.Read, Int -> UpdateSubnetGroupResponse -> ShowS
[UpdateSubnetGroupResponse] -> ShowS
UpdateSubnetGroupResponse -> String
(Int -> UpdateSubnetGroupResponse -> ShowS)
-> (UpdateSubnetGroupResponse -> String)
-> ([UpdateSubnetGroupResponse] -> ShowS)
-> Show UpdateSubnetGroupResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateSubnetGroupResponse] -> ShowS
$cshowList :: [UpdateSubnetGroupResponse] -> ShowS
show :: UpdateSubnetGroupResponse -> String
$cshow :: UpdateSubnetGroupResponse -> String
showsPrec :: Int -> UpdateSubnetGroupResponse -> ShowS
$cshowsPrec :: Int -> UpdateSubnetGroupResponse -> ShowS
Prelude.Show, (forall x.
UpdateSubnetGroupResponse -> Rep UpdateSubnetGroupResponse x)
-> (forall x.
Rep UpdateSubnetGroupResponse x -> UpdateSubnetGroupResponse)
-> Generic UpdateSubnetGroupResponse
forall x.
Rep UpdateSubnetGroupResponse x -> UpdateSubnetGroupResponse
forall x.
UpdateSubnetGroupResponse -> Rep UpdateSubnetGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateSubnetGroupResponse x -> UpdateSubnetGroupResponse
$cfrom :: forall x.
UpdateSubnetGroupResponse -> Rep UpdateSubnetGroupResponse x
Prelude.Generic)
newUpdateSubnetGroupResponse ::
Prelude.Int ->
UpdateSubnetGroupResponse
newUpdateSubnetGroupResponse :: Int -> UpdateSubnetGroupResponse
newUpdateSubnetGroupResponse Int
pHttpStatus_ =
UpdateSubnetGroupResponse' :: Maybe SubnetGroup -> Int -> UpdateSubnetGroupResponse
UpdateSubnetGroupResponse'
{ $sel:subnetGroup:UpdateSubnetGroupResponse' :: Maybe SubnetGroup
subnetGroup =
Maybe SubnetGroup
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateSubnetGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateSubnetGroupResponse_subnetGroup :: Lens.Lens' UpdateSubnetGroupResponse (Prelude.Maybe SubnetGroup)
updateSubnetGroupResponse_subnetGroup :: (Maybe SubnetGroup -> f (Maybe SubnetGroup))
-> UpdateSubnetGroupResponse -> f UpdateSubnetGroupResponse
updateSubnetGroupResponse_subnetGroup = (UpdateSubnetGroupResponse -> Maybe SubnetGroup)
-> (UpdateSubnetGroupResponse
-> Maybe SubnetGroup -> UpdateSubnetGroupResponse)
-> Lens
UpdateSubnetGroupResponse
UpdateSubnetGroupResponse
(Maybe SubnetGroup)
(Maybe SubnetGroup)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSubnetGroupResponse' {Maybe SubnetGroup
subnetGroup :: Maybe SubnetGroup
$sel:subnetGroup:UpdateSubnetGroupResponse' :: UpdateSubnetGroupResponse -> Maybe SubnetGroup
subnetGroup} -> Maybe SubnetGroup
subnetGroup) (\s :: UpdateSubnetGroupResponse
s@UpdateSubnetGroupResponse' {} Maybe SubnetGroup
a -> UpdateSubnetGroupResponse
s {$sel:subnetGroup:UpdateSubnetGroupResponse' :: Maybe SubnetGroup
subnetGroup = Maybe SubnetGroup
a} :: UpdateSubnetGroupResponse)
updateSubnetGroupResponse_httpStatus :: Lens.Lens' UpdateSubnetGroupResponse Prelude.Int
updateSubnetGroupResponse_httpStatus :: (Int -> f Int)
-> UpdateSubnetGroupResponse -> f UpdateSubnetGroupResponse
updateSubnetGroupResponse_httpStatus = (UpdateSubnetGroupResponse -> Int)
-> (UpdateSubnetGroupResponse -> Int -> UpdateSubnetGroupResponse)
-> Lens UpdateSubnetGroupResponse UpdateSubnetGroupResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSubnetGroupResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateSubnetGroupResponse' :: UpdateSubnetGroupResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateSubnetGroupResponse
s@UpdateSubnetGroupResponse' {} Int
a -> UpdateSubnetGroupResponse
s {$sel:httpStatus:UpdateSubnetGroupResponse' :: Int
httpStatus = Int
a} :: UpdateSubnetGroupResponse)
instance Prelude.NFData UpdateSubnetGroupResponse