{-# 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.PurchaseReservedNodeOffering
(
PurchaseReservedNodeOffering (..),
newPurchaseReservedNodeOffering,
purchaseReservedNodeOffering_nodeCount,
purchaseReservedNodeOffering_reservedNodeOfferingId,
PurchaseReservedNodeOfferingResponse (..),
newPurchaseReservedNodeOfferingResponse,
purchaseReservedNodeOfferingResponse_reservedNode,
purchaseReservedNodeOfferingResponse_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 PurchaseReservedNodeOffering = PurchaseReservedNodeOffering'
{
PurchaseReservedNodeOffering -> Maybe Int
nodeCount :: Prelude.Maybe Prelude.Int,
PurchaseReservedNodeOffering -> Text
reservedNodeOfferingId :: Prelude.Text
}
deriving (PurchaseReservedNodeOffering
-> PurchaseReservedNodeOffering -> Bool
(PurchaseReservedNodeOffering
-> PurchaseReservedNodeOffering -> Bool)
-> (PurchaseReservedNodeOffering
-> PurchaseReservedNodeOffering -> Bool)
-> Eq PurchaseReservedNodeOffering
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PurchaseReservedNodeOffering
-> PurchaseReservedNodeOffering -> Bool
$c/= :: PurchaseReservedNodeOffering
-> PurchaseReservedNodeOffering -> Bool
== :: PurchaseReservedNodeOffering
-> PurchaseReservedNodeOffering -> Bool
$c== :: PurchaseReservedNodeOffering
-> PurchaseReservedNodeOffering -> Bool
Prelude.Eq, ReadPrec [PurchaseReservedNodeOffering]
ReadPrec PurchaseReservedNodeOffering
Int -> ReadS PurchaseReservedNodeOffering
ReadS [PurchaseReservedNodeOffering]
(Int -> ReadS PurchaseReservedNodeOffering)
-> ReadS [PurchaseReservedNodeOffering]
-> ReadPrec PurchaseReservedNodeOffering
-> ReadPrec [PurchaseReservedNodeOffering]
-> Read PurchaseReservedNodeOffering
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PurchaseReservedNodeOffering]
$creadListPrec :: ReadPrec [PurchaseReservedNodeOffering]
readPrec :: ReadPrec PurchaseReservedNodeOffering
$creadPrec :: ReadPrec PurchaseReservedNodeOffering
readList :: ReadS [PurchaseReservedNodeOffering]
$creadList :: ReadS [PurchaseReservedNodeOffering]
readsPrec :: Int -> ReadS PurchaseReservedNodeOffering
$creadsPrec :: Int -> ReadS PurchaseReservedNodeOffering
Prelude.Read, Int -> PurchaseReservedNodeOffering -> ShowS
[PurchaseReservedNodeOffering] -> ShowS
PurchaseReservedNodeOffering -> String
(Int -> PurchaseReservedNodeOffering -> ShowS)
-> (PurchaseReservedNodeOffering -> String)
-> ([PurchaseReservedNodeOffering] -> ShowS)
-> Show PurchaseReservedNodeOffering
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PurchaseReservedNodeOffering] -> ShowS
$cshowList :: [PurchaseReservedNodeOffering] -> ShowS
show :: PurchaseReservedNodeOffering -> String
$cshow :: PurchaseReservedNodeOffering -> String
showsPrec :: Int -> PurchaseReservedNodeOffering -> ShowS
$cshowsPrec :: Int -> PurchaseReservedNodeOffering -> ShowS
Prelude.Show, (forall x.
PurchaseReservedNodeOffering -> Rep PurchaseReservedNodeOffering x)
-> (forall x.
Rep PurchaseReservedNodeOffering x -> PurchaseReservedNodeOffering)
-> Generic PurchaseReservedNodeOffering
forall x.
Rep PurchaseReservedNodeOffering x -> PurchaseReservedNodeOffering
forall x.
PurchaseReservedNodeOffering -> Rep PurchaseReservedNodeOffering x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PurchaseReservedNodeOffering x -> PurchaseReservedNodeOffering
$cfrom :: forall x.
PurchaseReservedNodeOffering -> Rep PurchaseReservedNodeOffering x
Prelude.Generic)
newPurchaseReservedNodeOffering ::
Prelude.Text ->
PurchaseReservedNodeOffering
newPurchaseReservedNodeOffering :: Text -> PurchaseReservedNodeOffering
newPurchaseReservedNodeOffering
Text
pReservedNodeOfferingId_ =
PurchaseReservedNodeOffering' :: Maybe Int -> Text -> PurchaseReservedNodeOffering
PurchaseReservedNodeOffering'
{ $sel:nodeCount:PurchaseReservedNodeOffering' :: Maybe Int
nodeCount =
Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:reservedNodeOfferingId:PurchaseReservedNodeOffering' :: Text
reservedNodeOfferingId =
Text
pReservedNodeOfferingId_
}
purchaseReservedNodeOffering_nodeCount :: Lens.Lens' PurchaseReservedNodeOffering (Prelude.Maybe Prelude.Int)
purchaseReservedNodeOffering_nodeCount :: (Maybe Int -> f (Maybe Int))
-> PurchaseReservedNodeOffering -> f PurchaseReservedNodeOffering
purchaseReservedNodeOffering_nodeCount = (PurchaseReservedNodeOffering -> Maybe Int)
-> (PurchaseReservedNodeOffering
-> Maybe Int -> PurchaseReservedNodeOffering)
-> Lens
PurchaseReservedNodeOffering
PurchaseReservedNodeOffering
(Maybe Int)
(Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PurchaseReservedNodeOffering' {Maybe Int
nodeCount :: Maybe Int
$sel:nodeCount:PurchaseReservedNodeOffering' :: PurchaseReservedNodeOffering -> Maybe Int
nodeCount} -> Maybe Int
nodeCount) (\s :: PurchaseReservedNodeOffering
s@PurchaseReservedNodeOffering' {} Maybe Int
a -> PurchaseReservedNodeOffering
s {$sel:nodeCount:PurchaseReservedNodeOffering' :: Maybe Int
nodeCount = Maybe Int
a} :: PurchaseReservedNodeOffering)
purchaseReservedNodeOffering_reservedNodeOfferingId :: Lens.Lens' PurchaseReservedNodeOffering Prelude.Text
purchaseReservedNodeOffering_reservedNodeOfferingId :: (Text -> f Text)
-> PurchaseReservedNodeOffering -> f PurchaseReservedNodeOffering
purchaseReservedNodeOffering_reservedNodeOfferingId = (PurchaseReservedNodeOffering -> Text)
-> (PurchaseReservedNodeOffering
-> Text -> PurchaseReservedNodeOffering)
-> Lens
PurchaseReservedNodeOffering PurchaseReservedNodeOffering Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PurchaseReservedNodeOffering' {Text
reservedNodeOfferingId :: Text
$sel:reservedNodeOfferingId:PurchaseReservedNodeOffering' :: PurchaseReservedNodeOffering -> Text
reservedNodeOfferingId} -> Text
reservedNodeOfferingId) (\s :: PurchaseReservedNodeOffering
s@PurchaseReservedNodeOffering' {} Text
a -> PurchaseReservedNodeOffering
s {$sel:reservedNodeOfferingId:PurchaseReservedNodeOffering' :: Text
reservedNodeOfferingId = Text
a} :: PurchaseReservedNodeOffering)
instance Core.AWSRequest PurchaseReservedNodeOffering where
type
AWSResponse PurchaseReservedNodeOffering =
PurchaseReservedNodeOfferingResponse
request :: PurchaseReservedNodeOffering
-> Request PurchaseReservedNodeOffering
request = Service
-> PurchaseReservedNodeOffering
-> Request PurchaseReservedNodeOffering
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy PurchaseReservedNodeOffering
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PurchaseReservedNodeOffering)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse PurchaseReservedNodeOffering))
-> Logger
-> Service
-> Proxy PurchaseReservedNodeOffering
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PurchaseReservedNodeOffering)))
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
"PurchaseReservedNodeOfferingResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe ReservedNode -> Int -> PurchaseReservedNodeOfferingResponse
PurchaseReservedNodeOfferingResponse'
(Maybe ReservedNode -> Int -> PurchaseReservedNodeOfferingResponse)
-> Either String (Maybe ReservedNode)
-> Either String (Int -> PurchaseReservedNodeOfferingResponse)
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
"ReservedNode")
Either String (Int -> PurchaseReservedNodeOfferingResponse)
-> Either String Int
-> Either String PurchaseReservedNodeOfferingResponse
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
PurchaseReservedNodeOffering
instance Prelude.NFData PurchaseReservedNodeOffering
instance Core.ToHeaders PurchaseReservedNodeOffering where
toHeaders :: PurchaseReservedNodeOffering -> ResponseHeaders
toHeaders = ResponseHeaders -> PurchaseReservedNodeOffering -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath PurchaseReservedNodeOffering where
toPath :: PurchaseReservedNodeOffering -> ByteString
toPath = ByteString -> PurchaseReservedNodeOffering -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery PurchaseReservedNodeOffering where
toQuery :: PurchaseReservedNodeOffering -> QueryString
toQuery PurchaseReservedNodeOffering' {Maybe Int
Text
reservedNodeOfferingId :: Text
nodeCount :: Maybe Int
$sel:reservedNodeOfferingId:PurchaseReservedNodeOffering' :: PurchaseReservedNodeOffering -> Text
$sel:nodeCount:PurchaseReservedNodeOffering' :: PurchaseReservedNodeOffering -> Maybe Int
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ( ByteString
"PurchaseReservedNodeOffering" ::
Prelude.ByteString
),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2012-12-01" :: Prelude.ByteString),
ByteString
"NodeCount" ByteString -> Maybe Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Int
nodeCount,
ByteString
"ReservedNodeOfferingId"
ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
reservedNodeOfferingId
]
data PurchaseReservedNodeOfferingResponse = PurchaseReservedNodeOfferingResponse'
{ PurchaseReservedNodeOfferingResponse -> Maybe ReservedNode
reservedNode :: Prelude.Maybe ReservedNode,
PurchaseReservedNodeOfferingResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PurchaseReservedNodeOfferingResponse
-> PurchaseReservedNodeOfferingResponse -> Bool
(PurchaseReservedNodeOfferingResponse
-> PurchaseReservedNodeOfferingResponse -> Bool)
-> (PurchaseReservedNodeOfferingResponse
-> PurchaseReservedNodeOfferingResponse -> Bool)
-> Eq PurchaseReservedNodeOfferingResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PurchaseReservedNodeOfferingResponse
-> PurchaseReservedNodeOfferingResponse -> Bool
$c/= :: PurchaseReservedNodeOfferingResponse
-> PurchaseReservedNodeOfferingResponse -> Bool
== :: PurchaseReservedNodeOfferingResponse
-> PurchaseReservedNodeOfferingResponse -> Bool
$c== :: PurchaseReservedNodeOfferingResponse
-> PurchaseReservedNodeOfferingResponse -> Bool
Prelude.Eq, ReadPrec [PurchaseReservedNodeOfferingResponse]
ReadPrec PurchaseReservedNodeOfferingResponse
Int -> ReadS PurchaseReservedNodeOfferingResponse
ReadS [PurchaseReservedNodeOfferingResponse]
(Int -> ReadS PurchaseReservedNodeOfferingResponse)
-> ReadS [PurchaseReservedNodeOfferingResponse]
-> ReadPrec PurchaseReservedNodeOfferingResponse
-> ReadPrec [PurchaseReservedNodeOfferingResponse]
-> Read PurchaseReservedNodeOfferingResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PurchaseReservedNodeOfferingResponse]
$creadListPrec :: ReadPrec [PurchaseReservedNodeOfferingResponse]
readPrec :: ReadPrec PurchaseReservedNodeOfferingResponse
$creadPrec :: ReadPrec PurchaseReservedNodeOfferingResponse
readList :: ReadS [PurchaseReservedNodeOfferingResponse]
$creadList :: ReadS [PurchaseReservedNodeOfferingResponse]
readsPrec :: Int -> ReadS PurchaseReservedNodeOfferingResponse
$creadsPrec :: Int -> ReadS PurchaseReservedNodeOfferingResponse
Prelude.Read, Int -> PurchaseReservedNodeOfferingResponse -> ShowS
[PurchaseReservedNodeOfferingResponse] -> ShowS
PurchaseReservedNodeOfferingResponse -> String
(Int -> PurchaseReservedNodeOfferingResponse -> ShowS)
-> (PurchaseReservedNodeOfferingResponse -> String)
-> ([PurchaseReservedNodeOfferingResponse] -> ShowS)
-> Show PurchaseReservedNodeOfferingResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PurchaseReservedNodeOfferingResponse] -> ShowS
$cshowList :: [PurchaseReservedNodeOfferingResponse] -> ShowS
show :: PurchaseReservedNodeOfferingResponse -> String
$cshow :: PurchaseReservedNodeOfferingResponse -> String
showsPrec :: Int -> PurchaseReservedNodeOfferingResponse -> ShowS
$cshowsPrec :: Int -> PurchaseReservedNodeOfferingResponse -> ShowS
Prelude.Show, (forall x.
PurchaseReservedNodeOfferingResponse
-> Rep PurchaseReservedNodeOfferingResponse x)
-> (forall x.
Rep PurchaseReservedNodeOfferingResponse x
-> PurchaseReservedNodeOfferingResponse)
-> Generic PurchaseReservedNodeOfferingResponse
forall x.
Rep PurchaseReservedNodeOfferingResponse x
-> PurchaseReservedNodeOfferingResponse
forall x.
PurchaseReservedNodeOfferingResponse
-> Rep PurchaseReservedNodeOfferingResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PurchaseReservedNodeOfferingResponse x
-> PurchaseReservedNodeOfferingResponse
$cfrom :: forall x.
PurchaseReservedNodeOfferingResponse
-> Rep PurchaseReservedNodeOfferingResponse x
Prelude.Generic)
newPurchaseReservedNodeOfferingResponse ::
Prelude.Int ->
PurchaseReservedNodeOfferingResponse
newPurchaseReservedNodeOfferingResponse :: Int -> PurchaseReservedNodeOfferingResponse
newPurchaseReservedNodeOfferingResponse Int
pHttpStatus_ =
PurchaseReservedNodeOfferingResponse' :: Maybe ReservedNode -> Int -> PurchaseReservedNodeOfferingResponse
PurchaseReservedNodeOfferingResponse'
{ $sel:reservedNode:PurchaseReservedNodeOfferingResponse' :: Maybe ReservedNode
reservedNode =
Maybe ReservedNode
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:PurchaseReservedNodeOfferingResponse' :: Int
httpStatus = Int
pHttpStatus_
}
purchaseReservedNodeOfferingResponse_reservedNode :: Lens.Lens' PurchaseReservedNodeOfferingResponse (Prelude.Maybe ReservedNode)
purchaseReservedNodeOfferingResponse_reservedNode :: (Maybe ReservedNode -> f (Maybe ReservedNode))
-> PurchaseReservedNodeOfferingResponse
-> f PurchaseReservedNodeOfferingResponse
purchaseReservedNodeOfferingResponse_reservedNode = (PurchaseReservedNodeOfferingResponse -> Maybe ReservedNode)
-> (PurchaseReservedNodeOfferingResponse
-> Maybe ReservedNode -> PurchaseReservedNodeOfferingResponse)
-> Lens
PurchaseReservedNodeOfferingResponse
PurchaseReservedNodeOfferingResponse
(Maybe ReservedNode)
(Maybe ReservedNode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PurchaseReservedNodeOfferingResponse' {Maybe ReservedNode
reservedNode :: Maybe ReservedNode
$sel:reservedNode:PurchaseReservedNodeOfferingResponse' :: PurchaseReservedNodeOfferingResponse -> Maybe ReservedNode
reservedNode} -> Maybe ReservedNode
reservedNode) (\s :: PurchaseReservedNodeOfferingResponse
s@PurchaseReservedNodeOfferingResponse' {} Maybe ReservedNode
a -> PurchaseReservedNodeOfferingResponse
s {$sel:reservedNode:PurchaseReservedNodeOfferingResponse' :: Maybe ReservedNode
reservedNode = Maybe ReservedNode
a} :: PurchaseReservedNodeOfferingResponse)
purchaseReservedNodeOfferingResponse_httpStatus :: Lens.Lens' PurchaseReservedNodeOfferingResponse Prelude.Int
purchaseReservedNodeOfferingResponse_httpStatus :: (Int -> f Int)
-> PurchaseReservedNodeOfferingResponse
-> f PurchaseReservedNodeOfferingResponse
purchaseReservedNodeOfferingResponse_httpStatus = (PurchaseReservedNodeOfferingResponse -> Int)
-> (PurchaseReservedNodeOfferingResponse
-> Int -> PurchaseReservedNodeOfferingResponse)
-> Lens
PurchaseReservedNodeOfferingResponse
PurchaseReservedNodeOfferingResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PurchaseReservedNodeOfferingResponse' {Int
httpStatus :: Int
$sel:httpStatus:PurchaseReservedNodeOfferingResponse' :: PurchaseReservedNodeOfferingResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PurchaseReservedNodeOfferingResponse
s@PurchaseReservedNodeOfferingResponse' {} Int
a -> PurchaseReservedNodeOfferingResponse
s {$sel:httpStatus:PurchaseReservedNodeOfferingResponse' :: Int
httpStatus = Int
a} :: PurchaseReservedNodeOfferingResponse)
instance
Prelude.NFData
PurchaseReservedNodeOfferingResponse