{-# 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.Redshift.AcceptReservedNodeExchange
(
AcceptReservedNodeExchange (..),
newAcceptReservedNodeExchange,
acceptReservedNodeExchange_reservedNodeId,
acceptReservedNodeExchange_targetReservedNodeOfferingId,
AcceptReservedNodeExchangeResponse (..),
newAcceptReservedNodeExchangeResponse,
acceptReservedNodeExchangeResponse_exchangedReservedNode,
acceptReservedNodeExchangeResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Redshift.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data AcceptReservedNodeExchange = AcceptReservedNodeExchange'
{
AcceptReservedNodeExchange -> Text
reservedNodeId :: Prelude.Text,
AcceptReservedNodeExchange -> Text
targetReservedNodeOfferingId :: Prelude.Text
}
deriving (AcceptReservedNodeExchange -> AcceptReservedNodeExchange -> Bool
(AcceptReservedNodeExchange -> AcceptReservedNodeExchange -> Bool)
-> (AcceptReservedNodeExchange
-> AcceptReservedNodeExchange -> Bool)
-> Eq AcceptReservedNodeExchange
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AcceptReservedNodeExchange -> AcceptReservedNodeExchange -> Bool
$c/= :: AcceptReservedNodeExchange -> AcceptReservedNodeExchange -> Bool
== :: AcceptReservedNodeExchange -> AcceptReservedNodeExchange -> Bool
$c== :: AcceptReservedNodeExchange -> AcceptReservedNodeExchange -> Bool
Prelude.Eq, ReadPrec [AcceptReservedNodeExchange]
ReadPrec AcceptReservedNodeExchange
Int -> ReadS AcceptReservedNodeExchange
ReadS [AcceptReservedNodeExchange]
(Int -> ReadS AcceptReservedNodeExchange)
-> ReadS [AcceptReservedNodeExchange]
-> ReadPrec AcceptReservedNodeExchange
-> ReadPrec [AcceptReservedNodeExchange]
-> Read AcceptReservedNodeExchange
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AcceptReservedNodeExchange]
$creadListPrec :: ReadPrec [AcceptReservedNodeExchange]
readPrec :: ReadPrec AcceptReservedNodeExchange
$creadPrec :: ReadPrec AcceptReservedNodeExchange
readList :: ReadS [AcceptReservedNodeExchange]
$creadList :: ReadS [AcceptReservedNodeExchange]
readsPrec :: Int -> ReadS AcceptReservedNodeExchange
$creadsPrec :: Int -> ReadS AcceptReservedNodeExchange
Prelude.Read, Int -> AcceptReservedNodeExchange -> ShowS
[AcceptReservedNodeExchange] -> ShowS
AcceptReservedNodeExchange -> String
(Int -> AcceptReservedNodeExchange -> ShowS)
-> (AcceptReservedNodeExchange -> String)
-> ([AcceptReservedNodeExchange] -> ShowS)
-> Show AcceptReservedNodeExchange
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AcceptReservedNodeExchange] -> ShowS
$cshowList :: [AcceptReservedNodeExchange] -> ShowS
show :: AcceptReservedNodeExchange -> String
$cshow :: AcceptReservedNodeExchange -> String
showsPrec :: Int -> AcceptReservedNodeExchange -> ShowS
$cshowsPrec :: Int -> AcceptReservedNodeExchange -> ShowS
Prelude.Show, (forall x.
AcceptReservedNodeExchange -> Rep AcceptReservedNodeExchange x)
-> (forall x.
Rep AcceptReservedNodeExchange x -> AcceptReservedNodeExchange)
-> Generic AcceptReservedNodeExchange
forall x.
Rep AcceptReservedNodeExchange x -> AcceptReservedNodeExchange
forall x.
AcceptReservedNodeExchange -> Rep AcceptReservedNodeExchange x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AcceptReservedNodeExchange x -> AcceptReservedNodeExchange
$cfrom :: forall x.
AcceptReservedNodeExchange -> Rep AcceptReservedNodeExchange x
Prelude.Generic)
newAcceptReservedNodeExchange ::
Prelude.Text ->
Prelude.Text ->
AcceptReservedNodeExchange
newAcceptReservedNodeExchange :: Text -> Text -> AcceptReservedNodeExchange
newAcceptReservedNodeExchange
Text
pReservedNodeId_
Text
pTargetReservedNodeOfferingId_ =
AcceptReservedNodeExchange' :: Text -> Text -> AcceptReservedNodeExchange
AcceptReservedNodeExchange'
{ $sel:reservedNodeId:AcceptReservedNodeExchange' :: Text
reservedNodeId =
Text
pReservedNodeId_,
$sel:targetReservedNodeOfferingId:AcceptReservedNodeExchange' :: Text
targetReservedNodeOfferingId =
Text
pTargetReservedNodeOfferingId_
}
acceptReservedNodeExchange_reservedNodeId :: Lens.Lens' AcceptReservedNodeExchange Prelude.Text
acceptReservedNodeExchange_reservedNodeId :: (Text -> f Text)
-> AcceptReservedNodeExchange -> f AcceptReservedNodeExchange
acceptReservedNodeExchange_reservedNodeId = (AcceptReservedNodeExchange -> Text)
-> (AcceptReservedNodeExchange
-> Text -> AcceptReservedNodeExchange)
-> Lens
AcceptReservedNodeExchange AcceptReservedNodeExchange Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptReservedNodeExchange' {Text
reservedNodeId :: Text
$sel:reservedNodeId:AcceptReservedNodeExchange' :: AcceptReservedNodeExchange -> Text
reservedNodeId} -> Text
reservedNodeId) (\s :: AcceptReservedNodeExchange
s@AcceptReservedNodeExchange' {} Text
a -> AcceptReservedNodeExchange
s {$sel:reservedNodeId:AcceptReservedNodeExchange' :: Text
reservedNodeId = Text
a} :: AcceptReservedNodeExchange)
acceptReservedNodeExchange_targetReservedNodeOfferingId :: Lens.Lens' AcceptReservedNodeExchange Prelude.Text
acceptReservedNodeExchange_targetReservedNodeOfferingId :: (Text -> f Text)
-> AcceptReservedNodeExchange -> f AcceptReservedNodeExchange
acceptReservedNodeExchange_targetReservedNodeOfferingId = (AcceptReservedNodeExchange -> Text)
-> (AcceptReservedNodeExchange
-> Text -> AcceptReservedNodeExchange)
-> Lens
AcceptReservedNodeExchange AcceptReservedNodeExchange Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptReservedNodeExchange' {Text
targetReservedNodeOfferingId :: Text
$sel:targetReservedNodeOfferingId:AcceptReservedNodeExchange' :: AcceptReservedNodeExchange -> Text
targetReservedNodeOfferingId} -> Text
targetReservedNodeOfferingId) (\s :: AcceptReservedNodeExchange
s@AcceptReservedNodeExchange' {} Text
a -> AcceptReservedNodeExchange
s {$sel:targetReservedNodeOfferingId:AcceptReservedNodeExchange' :: Text
targetReservedNodeOfferingId = Text
a} :: AcceptReservedNodeExchange)
instance Core.AWSRequest AcceptReservedNodeExchange where
type
AWSResponse AcceptReservedNodeExchange =
AcceptReservedNodeExchangeResponse
request :: AcceptReservedNodeExchange -> Request AcceptReservedNodeExchange
request = Service
-> AcceptReservedNodeExchange -> Request AcceptReservedNodeExchange
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy AcceptReservedNodeExchange
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AcceptReservedNodeExchange)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse AcceptReservedNodeExchange))
-> Logger
-> Service
-> Proxy AcceptReservedNodeExchange
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AcceptReservedNodeExchange)))
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
"AcceptReservedNodeExchangeResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe ReservedNode -> Int -> AcceptReservedNodeExchangeResponse
AcceptReservedNodeExchangeResponse'
(Maybe ReservedNode -> Int -> AcceptReservedNodeExchangeResponse)
-> Either String (Maybe ReservedNode)
-> Either String (Int -> AcceptReservedNodeExchangeResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe ReservedNode)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ExchangedReservedNode")
Either String (Int -> AcceptReservedNodeExchangeResponse)
-> Either String Int
-> Either String AcceptReservedNodeExchangeResponse
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 AcceptReservedNodeExchange
instance Prelude.NFData AcceptReservedNodeExchange
instance Core.ToHeaders AcceptReservedNodeExchange where
toHeaders :: AcceptReservedNodeExchange -> ResponseHeaders
toHeaders = ResponseHeaders -> AcceptReservedNodeExchange -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath AcceptReservedNodeExchange where
toPath :: AcceptReservedNodeExchange -> ByteString
toPath = ByteString -> AcceptReservedNodeExchange -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery AcceptReservedNodeExchange where
toQuery :: AcceptReservedNodeExchange -> QueryString
toQuery AcceptReservedNodeExchange' {Text
targetReservedNodeOfferingId :: Text
reservedNodeId :: Text
$sel:targetReservedNodeOfferingId:AcceptReservedNodeExchange' :: AcceptReservedNodeExchange -> Text
$sel:reservedNodeId:AcceptReservedNodeExchange' :: AcceptReservedNodeExchange -> Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"AcceptReservedNodeExchange" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2012-12-01" :: Prelude.ByteString),
ByteString
"ReservedNodeId" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
reservedNodeId,
ByteString
"TargetReservedNodeOfferingId"
ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
targetReservedNodeOfferingId
]
data AcceptReservedNodeExchangeResponse = AcceptReservedNodeExchangeResponse'
{ AcceptReservedNodeExchangeResponse -> Maybe ReservedNode
exchangedReservedNode :: Prelude.Maybe ReservedNode,
AcceptReservedNodeExchangeResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AcceptReservedNodeExchangeResponse
-> AcceptReservedNodeExchangeResponse -> Bool
(AcceptReservedNodeExchangeResponse
-> AcceptReservedNodeExchangeResponse -> Bool)
-> (AcceptReservedNodeExchangeResponse
-> AcceptReservedNodeExchangeResponse -> Bool)
-> Eq AcceptReservedNodeExchangeResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AcceptReservedNodeExchangeResponse
-> AcceptReservedNodeExchangeResponse -> Bool
$c/= :: AcceptReservedNodeExchangeResponse
-> AcceptReservedNodeExchangeResponse -> Bool
== :: AcceptReservedNodeExchangeResponse
-> AcceptReservedNodeExchangeResponse -> Bool
$c== :: AcceptReservedNodeExchangeResponse
-> AcceptReservedNodeExchangeResponse -> Bool
Prelude.Eq, ReadPrec [AcceptReservedNodeExchangeResponse]
ReadPrec AcceptReservedNodeExchangeResponse
Int -> ReadS AcceptReservedNodeExchangeResponse
ReadS [AcceptReservedNodeExchangeResponse]
(Int -> ReadS AcceptReservedNodeExchangeResponse)
-> ReadS [AcceptReservedNodeExchangeResponse]
-> ReadPrec AcceptReservedNodeExchangeResponse
-> ReadPrec [AcceptReservedNodeExchangeResponse]
-> Read AcceptReservedNodeExchangeResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AcceptReservedNodeExchangeResponse]
$creadListPrec :: ReadPrec [AcceptReservedNodeExchangeResponse]
readPrec :: ReadPrec AcceptReservedNodeExchangeResponse
$creadPrec :: ReadPrec AcceptReservedNodeExchangeResponse
readList :: ReadS [AcceptReservedNodeExchangeResponse]
$creadList :: ReadS [AcceptReservedNodeExchangeResponse]
readsPrec :: Int -> ReadS AcceptReservedNodeExchangeResponse
$creadsPrec :: Int -> ReadS AcceptReservedNodeExchangeResponse
Prelude.Read, Int -> AcceptReservedNodeExchangeResponse -> ShowS
[AcceptReservedNodeExchangeResponse] -> ShowS
AcceptReservedNodeExchangeResponse -> String
(Int -> AcceptReservedNodeExchangeResponse -> ShowS)
-> (AcceptReservedNodeExchangeResponse -> String)
-> ([AcceptReservedNodeExchangeResponse] -> ShowS)
-> Show AcceptReservedNodeExchangeResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AcceptReservedNodeExchangeResponse] -> ShowS
$cshowList :: [AcceptReservedNodeExchangeResponse] -> ShowS
show :: AcceptReservedNodeExchangeResponse -> String
$cshow :: AcceptReservedNodeExchangeResponse -> String
showsPrec :: Int -> AcceptReservedNodeExchangeResponse -> ShowS
$cshowsPrec :: Int -> AcceptReservedNodeExchangeResponse -> ShowS
Prelude.Show, (forall x.
AcceptReservedNodeExchangeResponse
-> Rep AcceptReservedNodeExchangeResponse x)
-> (forall x.
Rep AcceptReservedNodeExchangeResponse x
-> AcceptReservedNodeExchangeResponse)
-> Generic AcceptReservedNodeExchangeResponse
forall x.
Rep AcceptReservedNodeExchangeResponse x
-> AcceptReservedNodeExchangeResponse
forall x.
AcceptReservedNodeExchangeResponse
-> Rep AcceptReservedNodeExchangeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AcceptReservedNodeExchangeResponse x
-> AcceptReservedNodeExchangeResponse
$cfrom :: forall x.
AcceptReservedNodeExchangeResponse
-> Rep AcceptReservedNodeExchangeResponse x
Prelude.Generic)
newAcceptReservedNodeExchangeResponse ::
Prelude.Int ->
AcceptReservedNodeExchangeResponse
newAcceptReservedNodeExchangeResponse :: Int -> AcceptReservedNodeExchangeResponse
newAcceptReservedNodeExchangeResponse Int
pHttpStatus_ =
AcceptReservedNodeExchangeResponse' :: Maybe ReservedNode -> Int -> AcceptReservedNodeExchangeResponse
AcceptReservedNodeExchangeResponse'
{ $sel:exchangedReservedNode:AcceptReservedNodeExchangeResponse' :: Maybe ReservedNode
exchangedReservedNode =
Maybe ReservedNode
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AcceptReservedNodeExchangeResponse' :: Int
httpStatus = Int
pHttpStatus_
}
acceptReservedNodeExchangeResponse_exchangedReservedNode :: Lens.Lens' AcceptReservedNodeExchangeResponse (Prelude.Maybe ReservedNode)
acceptReservedNodeExchangeResponse_exchangedReservedNode :: (Maybe ReservedNode -> f (Maybe ReservedNode))
-> AcceptReservedNodeExchangeResponse
-> f AcceptReservedNodeExchangeResponse
acceptReservedNodeExchangeResponse_exchangedReservedNode = (AcceptReservedNodeExchangeResponse -> Maybe ReservedNode)
-> (AcceptReservedNodeExchangeResponse
-> Maybe ReservedNode -> AcceptReservedNodeExchangeResponse)
-> Lens
AcceptReservedNodeExchangeResponse
AcceptReservedNodeExchangeResponse
(Maybe ReservedNode)
(Maybe ReservedNode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptReservedNodeExchangeResponse' {Maybe ReservedNode
exchangedReservedNode :: Maybe ReservedNode
$sel:exchangedReservedNode:AcceptReservedNodeExchangeResponse' :: AcceptReservedNodeExchangeResponse -> Maybe ReservedNode
exchangedReservedNode} -> Maybe ReservedNode
exchangedReservedNode) (\s :: AcceptReservedNodeExchangeResponse
s@AcceptReservedNodeExchangeResponse' {} Maybe ReservedNode
a -> AcceptReservedNodeExchangeResponse
s {$sel:exchangedReservedNode:AcceptReservedNodeExchangeResponse' :: Maybe ReservedNode
exchangedReservedNode = Maybe ReservedNode
a} :: AcceptReservedNodeExchangeResponse)
acceptReservedNodeExchangeResponse_httpStatus :: Lens.Lens' AcceptReservedNodeExchangeResponse Prelude.Int
acceptReservedNodeExchangeResponse_httpStatus :: (Int -> f Int)
-> AcceptReservedNodeExchangeResponse
-> f AcceptReservedNodeExchangeResponse
acceptReservedNodeExchangeResponse_httpStatus = (AcceptReservedNodeExchangeResponse -> Int)
-> (AcceptReservedNodeExchangeResponse
-> Int -> AcceptReservedNodeExchangeResponse)
-> Lens
AcceptReservedNodeExchangeResponse
AcceptReservedNodeExchangeResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptReservedNodeExchangeResponse' {Int
httpStatus :: Int
$sel:httpStatus:AcceptReservedNodeExchangeResponse' :: AcceptReservedNodeExchangeResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AcceptReservedNodeExchangeResponse
s@AcceptReservedNodeExchangeResponse' {} Int
a -> AcceptReservedNodeExchangeResponse
s {$sel:httpStatus:AcceptReservedNodeExchangeResponse' :: Int
httpStatus = Int
a} :: AcceptReservedNodeExchangeResponse)
instance
Prelude.NFData
AcceptReservedNodeExchangeResponse