{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Redshift.GetReservedNodeExchangeOfferings
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns an array of DC2 ReservedNodeOfferings that matches the payment
-- type, term, and usage price of the given DC1 reserved node.
--
-- This operation returns paginated results.
module Amazonka.Redshift.GetReservedNodeExchangeOfferings
  ( -- * Creating a Request
    GetReservedNodeExchangeOfferings (..),
    newGetReservedNodeExchangeOfferings,

    -- * Request Lenses
    getReservedNodeExchangeOfferings_marker,
    getReservedNodeExchangeOfferings_maxRecords,
    getReservedNodeExchangeOfferings_reservedNodeId,

    -- * Destructuring the Response
    GetReservedNodeExchangeOfferingsResponse (..),
    newGetReservedNodeExchangeOfferingsResponse,

    -- * Response Lenses
    getReservedNodeExchangeOfferingsResponse_reservedNodeOfferings,
    getReservedNodeExchangeOfferingsResponse_marker,
    getReservedNodeExchangeOfferingsResponse_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

-- |
--
-- /See:/ 'newGetReservedNodeExchangeOfferings' smart constructor.
data GetReservedNodeExchangeOfferings = GetReservedNodeExchangeOfferings'
  { -- | A value that indicates the starting point for the next set of
    -- ReservedNodeOfferings.
    GetReservedNodeExchangeOfferings -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | An integer setting the maximum number of ReservedNodeOfferings to
    -- retrieve.
    GetReservedNodeExchangeOfferings -> Maybe Int
maxRecords :: Prelude.Maybe Prelude.Int,
    -- | A string representing the node identifier for the DC1 Reserved Node to
    -- be exchanged.
    GetReservedNodeExchangeOfferings -> Text
reservedNodeId :: Prelude.Text
  }
  deriving (GetReservedNodeExchangeOfferings
-> GetReservedNodeExchangeOfferings -> Bool
(GetReservedNodeExchangeOfferings
 -> GetReservedNodeExchangeOfferings -> Bool)
-> (GetReservedNodeExchangeOfferings
    -> GetReservedNodeExchangeOfferings -> Bool)
-> Eq GetReservedNodeExchangeOfferings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetReservedNodeExchangeOfferings
-> GetReservedNodeExchangeOfferings -> Bool
$c/= :: GetReservedNodeExchangeOfferings
-> GetReservedNodeExchangeOfferings -> Bool
== :: GetReservedNodeExchangeOfferings
-> GetReservedNodeExchangeOfferings -> Bool
$c== :: GetReservedNodeExchangeOfferings
-> GetReservedNodeExchangeOfferings -> Bool
Prelude.Eq, ReadPrec [GetReservedNodeExchangeOfferings]
ReadPrec GetReservedNodeExchangeOfferings
Int -> ReadS GetReservedNodeExchangeOfferings
ReadS [GetReservedNodeExchangeOfferings]
(Int -> ReadS GetReservedNodeExchangeOfferings)
-> ReadS [GetReservedNodeExchangeOfferings]
-> ReadPrec GetReservedNodeExchangeOfferings
-> ReadPrec [GetReservedNodeExchangeOfferings]
-> Read GetReservedNodeExchangeOfferings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetReservedNodeExchangeOfferings]
$creadListPrec :: ReadPrec [GetReservedNodeExchangeOfferings]
readPrec :: ReadPrec GetReservedNodeExchangeOfferings
$creadPrec :: ReadPrec GetReservedNodeExchangeOfferings
readList :: ReadS [GetReservedNodeExchangeOfferings]
$creadList :: ReadS [GetReservedNodeExchangeOfferings]
readsPrec :: Int -> ReadS GetReservedNodeExchangeOfferings
$creadsPrec :: Int -> ReadS GetReservedNodeExchangeOfferings
Prelude.Read, Int -> GetReservedNodeExchangeOfferings -> ShowS
[GetReservedNodeExchangeOfferings] -> ShowS
GetReservedNodeExchangeOfferings -> String
(Int -> GetReservedNodeExchangeOfferings -> ShowS)
-> (GetReservedNodeExchangeOfferings -> String)
-> ([GetReservedNodeExchangeOfferings] -> ShowS)
-> Show GetReservedNodeExchangeOfferings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetReservedNodeExchangeOfferings] -> ShowS
$cshowList :: [GetReservedNodeExchangeOfferings] -> ShowS
show :: GetReservedNodeExchangeOfferings -> String
$cshow :: GetReservedNodeExchangeOfferings -> String
showsPrec :: Int -> GetReservedNodeExchangeOfferings -> ShowS
$cshowsPrec :: Int -> GetReservedNodeExchangeOfferings -> ShowS
Prelude.Show, (forall x.
 GetReservedNodeExchangeOfferings
 -> Rep GetReservedNodeExchangeOfferings x)
-> (forall x.
    Rep GetReservedNodeExchangeOfferings x
    -> GetReservedNodeExchangeOfferings)
-> Generic GetReservedNodeExchangeOfferings
forall x.
Rep GetReservedNodeExchangeOfferings x
-> GetReservedNodeExchangeOfferings
forall x.
GetReservedNodeExchangeOfferings
-> Rep GetReservedNodeExchangeOfferings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetReservedNodeExchangeOfferings x
-> GetReservedNodeExchangeOfferings
$cfrom :: forall x.
GetReservedNodeExchangeOfferings
-> Rep GetReservedNodeExchangeOfferings x
Prelude.Generic)

-- |
-- Create a value of 'GetReservedNodeExchangeOfferings' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'marker', 'getReservedNodeExchangeOfferings_marker' - A value that indicates the starting point for the next set of
-- ReservedNodeOfferings.
--
-- 'maxRecords', 'getReservedNodeExchangeOfferings_maxRecords' - An integer setting the maximum number of ReservedNodeOfferings to
-- retrieve.
--
-- 'reservedNodeId', 'getReservedNodeExchangeOfferings_reservedNodeId' - A string representing the node identifier for the DC1 Reserved Node to
-- be exchanged.
newGetReservedNodeExchangeOfferings ::
  -- | 'reservedNodeId'
  Prelude.Text ->
  GetReservedNodeExchangeOfferings
newGetReservedNodeExchangeOfferings :: Text -> GetReservedNodeExchangeOfferings
newGetReservedNodeExchangeOfferings Text
pReservedNodeId_ =
  GetReservedNodeExchangeOfferings' :: Maybe Text -> Maybe Int -> Text -> GetReservedNodeExchangeOfferings
GetReservedNodeExchangeOfferings'
    { $sel:marker:GetReservedNodeExchangeOfferings' :: Maybe Text
marker =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxRecords:GetReservedNodeExchangeOfferings' :: Maybe Int
maxRecords = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:reservedNodeId:GetReservedNodeExchangeOfferings' :: Text
reservedNodeId = Text
pReservedNodeId_
    }

-- | A value that indicates the starting point for the next set of
-- ReservedNodeOfferings.
getReservedNodeExchangeOfferings_marker :: Lens.Lens' GetReservedNodeExchangeOfferings (Prelude.Maybe Prelude.Text)
getReservedNodeExchangeOfferings_marker :: (Maybe Text -> f (Maybe Text))
-> GetReservedNodeExchangeOfferings
-> f GetReservedNodeExchangeOfferings
getReservedNodeExchangeOfferings_marker = (GetReservedNodeExchangeOfferings -> Maybe Text)
-> (GetReservedNodeExchangeOfferings
    -> Maybe Text -> GetReservedNodeExchangeOfferings)
-> Lens
     GetReservedNodeExchangeOfferings
     GetReservedNodeExchangeOfferings
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetReservedNodeExchangeOfferings' {Maybe Text
marker :: Maybe Text
$sel:marker:GetReservedNodeExchangeOfferings' :: GetReservedNodeExchangeOfferings -> Maybe Text
marker} -> Maybe Text
marker) (\s :: GetReservedNodeExchangeOfferings
s@GetReservedNodeExchangeOfferings' {} Maybe Text
a -> GetReservedNodeExchangeOfferings
s {$sel:marker:GetReservedNodeExchangeOfferings' :: Maybe Text
marker = Maybe Text
a} :: GetReservedNodeExchangeOfferings)

-- | An integer setting the maximum number of ReservedNodeOfferings to
-- retrieve.
getReservedNodeExchangeOfferings_maxRecords :: Lens.Lens' GetReservedNodeExchangeOfferings (Prelude.Maybe Prelude.Int)
getReservedNodeExchangeOfferings_maxRecords :: (Maybe Int -> f (Maybe Int))
-> GetReservedNodeExchangeOfferings
-> f GetReservedNodeExchangeOfferings
getReservedNodeExchangeOfferings_maxRecords = (GetReservedNodeExchangeOfferings -> Maybe Int)
-> (GetReservedNodeExchangeOfferings
    -> Maybe Int -> GetReservedNodeExchangeOfferings)
-> Lens
     GetReservedNodeExchangeOfferings
     GetReservedNodeExchangeOfferings
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetReservedNodeExchangeOfferings' {Maybe Int
maxRecords :: Maybe Int
$sel:maxRecords:GetReservedNodeExchangeOfferings' :: GetReservedNodeExchangeOfferings -> Maybe Int
maxRecords} -> Maybe Int
maxRecords) (\s :: GetReservedNodeExchangeOfferings
s@GetReservedNodeExchangeOfferings' {} Maybe Int
a -> GetReservedNodeExchangeOfferings
s {$sel:maxRecords:GetReservedNodeExchangeOfferings' :: Maybe Int
maxRecords = Maybe Int
a} :: GetReservedNodeExchangeOfferings)

-- | A string representing the node identifier for the DC1 Reserved Node to
-- be exchanged.
getReservedNodeExchangeOfferings_reservedNodeId :: Lens.Lens' GetReservedNodeExchangeOfferings Prelude.Text
getReservedNodeExchangeOfferings_reservedNodeId :: (Text -> f Text)
-> GetReservedNodeExchangeOfferings
-> f GetReservedNodeExchangeOfferings
getReservedNodeExchangeOfferings_reservedNodeId = (GetReservedNodeExchangeOfferings -> Text)
-> (GetReservedNodeExchangeOfferings
    -> Text -> GetReservedNodeExchangeOfferings)
-> Lens
     GetReservedNodeExchangeOfferings
     GetReservedNodeExchangeOfferings
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetReservedNodeExchangeOfferings' {Text
reservedNodeId :: Text
$sel:reservedNodeId:GetReservedNodeExchangeOfferings' :: GetReservedNodeExchangeOfferings -> Text
reservedNodeId} -> Text
reservedNodeId) (\s :: GetReservedNodeExchangeOfferings
s@GetReservedNodeExchangeOfferings' {} Text
a -> GetReservedNodeExchangeOfferings
s {$sel:reservedNodeId:GetReservedNodeExchangeOfferings' :: Text
reservedNodeId = Text
a} :: GetReservedNodeExchangeOfferings)

instance
  Core.AWSPager
    GetReservedNodeExchangeOfferings
  where
  page :: GetReservedNodeExchangeOfferings
-> AWSResponse GetReservedNodeExchangeOfferings
-> Maybe GetReservedNodeExchangeOfferings
page GetReservedNodeExchangeOfferings
rq AWSResponse GetReservedNodeExchangeOfferings
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse GetReservedNodeExchangeOfferings
GetReservedNodeExchangeOfferingsResponse
rs
            GetReservedNodeExchangeOfferingsResponse
-> Getting
     (First Text) GetReservedNodeExchangeOfferingsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetReservedNodeExchangeOfferingsResponse
-> Const (First Text) GetReservedNodeExchangeOfferingsResponse
Lens' GetReservedNodeExchangeOfferingsResponse (Maybe Text)
getReservedNodeExchangeOfferingsResponse_marker
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> GetReservedNodeExchangeOfferingsResponse
 -> Const (First Text) GetReservedNodeExchangeOfferingsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text) GetReservedNodeExchangeOfferingsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe GetReservedNodeExchangeOfferings
forall a. Maybe a
Prelude.Nothing
    | Maybe [ReservedNodeOffering] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse GetReservedNodeExchangeOfferings
GetReservedNodeExchangeOfferingsResponse
rs
            GetReservedNodeExchangeOfferingsResponse
-> Getting
     (First [ReservedNodeOffering])
     GetReservedNodeExchangeOfferingsResponse
     [ReservedNodeOffering]
-> Maybe [ReservedNodeOffering]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [ReservedNodeOffering]
 -> Const
      (First [ReservedNodeOffering]) (Maybe [ReservedNodeOffering]))
-> GetReservedNodeExchangeOfferingsResponse
-> Const
     (First [ReservedNodeOffering])
     GetReservedNodeExchangeOfferingsResponse
Lens'
  GetReservedNodeExchangeOfferingsResponse
  (Maybe [ReservedNodeOffering])
getReservedNodeExchangeOfferingsResponse_reservedNodeOfferings
              ((Maybe [ReservedNodeOffering]
  -> Const
       (First [ReservedNodeOffering]) (Maybe [ReservedNodeOffering]))
 -> GetReservedNodeExchangeOfferingsResponse
 -> Const
      (First [ReservedNodeOffering])
      GetReservedNodeExchangeOfferingsResponse)
-> (([ReservedNodeOffering]
     -> Const (First [ReservedNodeOffering]) [ReservedNodeOffering])
    -> Maybe [ReservedNodeOffering]
    -> Const
         (First [ReservedNodeOffering]) (Maybe [ReservedNodeOffering]))
-> Getting
     (First [ReservedNodeOffering])
     GetReservedNodeExchangeOfferingsResponse
     [ReservedNodeOffering]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ReservedNodeOffering]
 -> Const (First [ReservedNodeOffering]) [ReservedNodeOffering])
-> Maybe [ReservedNodeOffering]
-> Const
     (First [ReservedNodeOffering]) (Maybe [ReservedNodeOffering])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe GetReservedNodeExchangeOfferings
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      GetReservedNodeExchangeOfferings
-> Maybe GetReservedNodeExchangeOfferings
forall a. a -> Maybe a
Prelude.Just (GetReservedNodeExchangeOfferings
 -> Maybe GetReservedNodeExchangeOfferings)
-> GetReservedNodeExchangeOfferings
-> Maybe GetReservedNodeExchangeOfferings
forall a b. (a -> b) -> a -> b
Prelude.$
        GetReservedNodeExchangeOfferings
rq
          GetReservedNodeExchangeOfferings
-> (GetReservedNodeExchangeOfferings
    -> GetReservedNodeExchangeOfferings)
-> GetReservedNodeExchangeOfferings
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> GetReservedNodeExchangeOfferings
-> Identity GetReservedNodeExchangeOfferings
Lens
  GetReservedNodeExchangeOfferings
  GetReservedNodeExchangeOfferings
  (Maybe Text)
  (Maybe Text)
getReservedNodeExchangeOfferings_marker
          ((Maybe Text -> Identity (Maybe Text))
 -> GetReservedNodeExchangeOfferings
 -> Identity GetReservedNodeExchangeOfferings)
-> Maybe Text
-> GetReservedNodeExchangeOfferings
-> GetReservedNodeExchangeOfferings
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse GetReservedNodeExchangeOfferings
GetReservedNodeExchangeOfferingsResponse
rs
          GetReservedNodeExchangeOfferingsResponse
-> Getting
     (First Text) GetReservedNodeExchangeOfferingsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetReservedNodeExchangeOfferingsResponse
-> Const (First Text) GetReservedNodeExchangeOfferingsResponse
Lens' GetReservedNodeExchangeOfferingsResponse (Maybe Text)
getReservedNodeExchangeOfferingsResponse_marker
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> GetReservedNodeExchangeOfferingsResponse
 -> Const (First Text) GetReservedNodeExchangeOfferingsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text) GetReservedNodeExchangeOfferingsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance
  Core.AWSRequest
    GetReservedNodeExchangeOfferings
  where
  type
    AWSResponse GetReservedNodeExchangeOfferings =
      GetReservedNodeExchangeOfferingsResponse
  request :: GetReservedNodeExchangeOfferings
-> Request GetReservedNodeExchangeOfferings
request = Service
-> GetReservedNodeExchangeOfferings
-> Request GetReservedNodeExchangeOfferings
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy GetReservedNodeExchangeOfferings
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse GetReservedNodeExchangeOfferings)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse GetReservedNodeExchangeOfferings))
-> Logger
-> Service
-> Proxy GetReservedNodeExchangeOfferings
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse GetReservedNodeExchangeOfferings)))
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
"GetReservedNodeExchangeOfferingsResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe [ReservedNodeOffering]
-> Maybe Text -> Int -> GetReservedNodeExchangeOfferingsResponse
GetReservedNodeExchangeOfferingsResponse'
            (Maybe [ReservedNodeOffering]
 -> Maybe Text -> Int -> GetReservedNodeExchangeOfferingsResponse)
-> Either String (Maybe [ReservedNodeOffering])
-> Either
     String
     (Maybe Text -> Int -> GetReservedNodeExchangeOfferingsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ReservedNodeOfferings"
                            Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                            Either String [Node]
-> ([Node] -> Either String (Maybe [ReservedNodeOffering]))
-> Either String (Maybe [ReservedNodeOffering])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [ReservedNodeOffering])
-> [Node] -> Either String (Maybe [ReservedNodeOffering])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [ReservedNodeOffering]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"ReservedNodeOffering")
                        )
            Either
  String
  (Maybe Text -> Int -> GetReservedNodeExchangeOfferingsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetReservedNodeExchangeOfferingsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Marker")
            Either String (Int -> GetReservedNodeExchangeOfferingsResponse)
-> Either String Int
-> Either String GetReservedNodeExchangeOfferingsResponse
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
    GetReservedNodeExchangeOfferings

instance
  Prelude.NFData
    GetReservedNodeExchangeOfferings

instance
  Core.ToHeaders
    GetReservedNodeExchangeOfferings
  where
  toHeaders :: GetReservedNodeExchangeOfferings -> ResponseHeaders
toHeaders = ResponseHeaders
-> GetReservedNodeExchangeOfferings -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToPath GetReservedNodeExchangeOfferings where
  toPath :: GetReservedNodeExchangeOfferings -> ByteString
toPath = ByteString -> GetReservedNodeExchangeOfferings -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance
  Core.ToQuery
    GetReservedNodeExchangeOfferings
  where
  toQuery :: GetReservedNodeExchangeOfferings -> QueryString
toQuery GetReservedNodeExchangeOfferings' {Maybe Int
Maybe Text
Text
reservedNodeId :: Text
maxRecords :: Maybe Int
marker :: Maybe Text
$sel:reservedNodeId:GetReservedNodeExchangeOfferings' :: GetReservedNodeExchangeOfferings -> Text
$sel:maxRecords:GetReservedNodeExchangeOfferings' :: GetReservedNodeExchangeOfferings -> Maybe Int
$sel:marker:GetReservedNodeExchangeOfferings' :: GetReservedNodeExchangeOfferings -> Maybe 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
"GetReservedNodeExchangeOfferings" ::
                      Prelude.ByteString
                  ),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2012-12-01" :: Prelude.ByteString),
        ByteString
"Marker" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
marker,
        ByteString
"MaxRecords" ByteString -> Maybe Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Int
maxRecords,
        ByteString
"ReservedNodeId" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
reservedNodeId
      ]

-- | /See:/ 'newGetReservedNodeExchangeOfferingsResponse' smart constructor.
data GetReservedNodeExchangeOfferingsResponse = GetReservedNodeExchangeOfferingsResponse'
  { -- | Returns an array of ReservedNodeOffering objects.
    GetReservedNodeExchangeOfferingsResponse
-> Maybe [ReservedNodeOffering]
reservedNodeOfferings :: Prelude.Maybe [ReservedNodeOffering],
    -- | An optional parameter that specifies the starting point for returning a
    -- set of response records. When the results of a
    -- @GetReservedNodeExchangeOfferings@ request exceed the value specified in
    -- MaxRecords, Amazon Redshift returns a value in the marker field of the
    -- response. You can retrieve the next set of response records by providing
    -- the returned marker value in the marker parameter and retrying the
    -- request.
    GetReservedNodeExchangeOfferingsResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    GetReservedNodeExchangeOfferingsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetReservedNodeExchangeOfferingsResponse
-> GetReservedNodeExchangeOfferingsResponse -> Bool
(GetReservedNodeExchangeOfferingsResponse
 -> GetReservedNodeExchangeOfferingsResponse -> Bool)
-> (GetReservedNodeExchangeOfferingsResponse
    -> GetReservedNodeExchangeOfferingsResponse -> Bool)
-> Eq GetReservedNodeExchangeOfferingsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetReservedNodeExchangeOfferingsResponse
-> GetReservedNodeExchangeOfferingsResponse -> Bool
$c/= :: GetReservedNodeExchangeOfferingsResponse
-> GetReservedNodeExchangeOfferingsResponse -> Bool
== :: GetReservedNodeExchangeOfferingsResponse
-> GetReservedNodeExchangeOfferingsResponse -> Bool
$c== :: GetReservedNodeExchangeOfferingsResponse
-> GetReservedNodeExchangeOfferingsResponse -> Bool
Prelude.Eq, ReadPrec [GetReservedNodeExchangeOfferingsResponse]
ReadPrec GetReservedNodeExchangeOfferingsResponse
Int -> ReadS GetReservedNodeExchangeOfferingsResponse
ReadS [GetReservedNodeExchangeOfferingsResponse]
(Int -> ReadS GetReservedNodeExchangeOfferingsResponse)
-> ReadS [GetReservedNodeExchangeOfferingsResponse]
-> ReadPrec GetReservedNodeExchangeOfferingsResponse
-> ReadPrec [GetReservedNodeExchangeOfferingsResponse]
-> Read GetReservedNodeExchangeOfferingsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetReservedNodeExchangeOfferingsResponse]
$creadListPrec :: ReadPrec [GetReservedNodeExchangeOfferingsResponse]
readPrec :: ReadPrec GetReservedNodeExchangeOfferingsResponse
$creadPrec :: ReadPrec GetReservedNodeExchangeOfferingsResponse
readList :: ReadS [GetReservedNodeExchangeOfferingsResponse]
$creadList :: ReadS [GetReservedNodeExchangeOfferingsResponse]
readsPrec :: Int -> ReadS GetReservedNodeExchangeOfferingsResponse
$creadsPrec :: Int -> ReadS GetReservedNodeExchangeOfferingsResponse
Prelude.Read, Int -> GetReservedNodeExchangeOfferingsResponse -> ShowS
[GetReservedNodeExchangeOfferingsResponse] -> ShowS
GetReservedNodeExchangeOfferingsResponse -> String
(Int -> GetReservedNodeExchangeOfferingsResponse -> ShowS)
-> (GetReservedNodeExchangeOfferingsResponse -> String)
-> ([GetReservedNodeExchangeOfferingsResponse] -> ShowS)
-> Show GetReservedNodeExchangeOfferingsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetReservedNodeExchangeOfferingsResponse] -> ShowS
$cshowList :: [GetReservedNodeExchangeOfferingsResponse] -> ShowS
show :: GetReservedNodeExchangeOfferingsResponse -> String
$cshow :: GetReservedNodeExchangeOfferingsResponse -> String
showsPrec :: Int -> GetReservedNodeExchangeOfferingsResponse -> ShowS
$cshowsPrec :: Int -> GetReservedNodeExchangeOfferingsResponse -> ShowS
Prelude.Show, (forall x.
 GetReservedNodeExchangeOfferingsResponse
 -> Rep GetReservedNodeExchangeOfferingsResponse x)
-> (forall x.
    Rep GetReservedNodeExchangeOfferingsResponse x
    -> GetReservedNodeExchangeOfferingsResponse)
-> Generic GetReservedNodeExchangeOfferingsResponse
forall x.
Rep GetReservedNodeExchangeOfferingsResponse x
-> GetReservedNodeExchangeOfferingsResponse
forall x.
GetReservedNodeExchangeOfferingsResponse
-> Rep GetReservedNodeExchangeOfferingsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetReservedNodeExchangeOfferingsResponse x
-> GetReservedNodeExchangeOfferingsResponse
$cfrom :: forall x.
GetReservedNodeExchangeOfferingsResponse
-> Rep GetReservedNodeExchangeOfferingsResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetReservedNodeExchangeOfferingsResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'reservedNodeOfferings', 'getReservedNodeExchangeOfferingsResponse_reservedNodeOfferings' - Returns an array of ReservedNodeOffering objects.
--
-- 'marker', 'getReservedNodeExchangeOfferingsResponse_marker' - An optional parameter that specifies the starting point for returning a
-- set of response records. When the results of a
-- @GetReservedNodeExchangeOfferings@ request exceed the value specified in
-- MaxRecords, Amazon Redshift returns a value in the marker field of the
-- response. You can retrieve the next set of response records by providing
-- the returned marker value in the marker parameter and retrying the
-- request.
--
-- 'httpStatus', 'getReservedNodeExchangeOfferingsResponse_httpStatus' - The response's http status code.
newGetReservedNodeExchangeOfferingsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetReservedNodeExchangeOfferingsResponse
newGetReservedNodeExchangeOfferingsResponse :: Int -> GetReservedNodeExchangeOfferingsResponse
newGetReservedNodeExchangeOfferingsResponse
  Int
pHttpStatus_ =
    GetReservedNodeExchangeOfferingsResponse' :: Maybe [ReservedNodeOffering]
-> Maybe Text -> Int -> GetReservedNodeExchangeOfferingsResponse
GetReservedNodeExchangeOfferingsResponse'
      { $sel:reservedNodeOfferings:GetReservedNodeExchangeOfferingsResponse' :: Maybe [ReservedNodeOffering]
reservedNodeOfferings =
          Maybe [ReservedNodeOffering]
forall a. Maybe a
Prelude.Nothing,
        $sel:marker:GetReservedNodeExchangeOfferingsResponse' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:GetReservedNodeExchangeOfferingsResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | Returns an array of ReservedNodeOffering objects.
getReservedNodeExchangeOfferingsResponse_reservedNodeOfferings :: Lens.Lens' GetReservedNodeExchangeOfferingsResponse (Prelude.Maybe [ReservedNodeOffering])
getReservedNodeExchangeOfferingsResponse_reservedNodeOfferings :: (Maybe [ReservedNodeOffering] -> f (Maybe [ReservedNodeOffering]))
-> GetReservedNodeExchangeOfferingsResponse
-> f GetReservedNodeExchangeOfferingsResponse
getReservedNodeExchangeOfferingsResponse_reservedNodeOfferings = (GetReservedNodeExchangeOfferingsResponse
 -> Maybe [ReservedNodeOffering])
-> (GetReservedNodeExchangeOfferingsResponse
    -> Maybe [ReservedNodeOffering]
    -> GetReservedNodeExchangeOfferingsResponse)
-> Lens'
     GetReservedNodeExchangeOfferingsResponse
     (Maybe [ReservedNodeOffering])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetReservedNodeExchangeOfferingsResponse' {Maybe [ReservedNodeOffering]
reservedNodeOfferings :: Maybe [ReservedNodeOffering]
$sel:reservedNodeOfferings:GetReservedNodeExchangeOfferingsResponse' :: GetReservedNodeExchangeOfferingsResponse
-> Maybe [ReservedNodeOffering]
reservedNodeOfferings} -> Maybe [ReservedNodeOffering]
reservedNodeOfferings) (\s :: GetReservedNodeExchangeOfferingsResponse
s@GetReservedNodeExchangeOfferingsResponse' {} Maybe [ReservedNodeOffering]
a -> GetReservedNodeExchangeOfferingsResponse
s {$sel:reservedNodeOfferings:GetReservedNodeExchangeOfferingsResponse' :: Maybe [ReservedNodeOffering]
reservedNodeOfferings = Maybe [ReservedNodeOffering]
a} :: GetReservedNodeExchangeOfferingsResponse) ((Maybe [ReservedNodeOffering] -> f (Maybe [ReservedNodeOffering]))
 -> GetReservedNodeExchangeOfferingsResponse
 -> f GetReservedNodeExchangeOfferingsResponse)
-> ((Maybe [ReservedNodeOffering]
     -> f (Maybe [ReservedNodeOffering]))
    -> Maybe [ReservedNodeOffering]
    -> f (Maybe [ReservedNodeOffering]))
-> (Maybe [ReservedNodeOffering]
    -> f (Maybe [ReservedNodeOffering]))
-> GetReservedNodeExchangeOfferingsResponse
-> f GetReservedNodeExchangeOfferingsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ReservedNodeOffering]
  [ReservedNodeOffering]
  [ReservedNodeOffering]
  [ReservedNodeOffering]
-> Iso
     (Maybe [ReservedNodeOffering])
     (Maybe [ReservedNodeOffering])
     (Maybe [ReservedNodeOffering])
     (Maybe [ReservedNodeOffering])
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
  [ReservedNodeOffering]
  [ReservedNodeOffering]
  [ReservedNodeOffering]
  [ReservedNodeOffering]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An optional parameter that specifies the starting point for returning a
-- set of response records. When the results of a
-- @GetReservedNodeExchangeOfferings@ request exceed the value specified in
-- MaxRecords, Amazon Redshift returns a value in the marker field of the
-- response. You can retrieve the next set of response records by providing
-- the returned marker value in the marker parameter and retrying the
-- request.
getReservedNodeExchangeOfferingsResponse_marker :: Lens.Lens' GetReservedNodeExchangeOfferingsResponse (Prelude.Maybe Prelude.Text)
getReservedNodeExchangeOfferingsResponse_marker :: (Maybe Text -> f (Maybe Text))
-> GetReservedNodeExchangeOfferingsResponse
-> f GetReservedNodeExchangeOfferingsResponse
getReservedNodeExchangeOfferingsResponse_marker = (GetReservedNodeExchangeOfferingsResponse -> Maybe Text)
-> (GetReservedNodeExchangeOfferingsResponse
    -> Maybe Text -> GetReservedNodeExchangeOfferingsResponse)
-> Lens' GetReservedNodeExchangeOfferingsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetReservedNodeExchangeOfferingsResponse' {Maybe Text
marker :: Maybe Text
$sel:marker:GetReservedNodeExchangeOfferingsResponse' :: GetReservedNodeExchangeOfferingsResponse -> Maybe Text
marker} -> Maybe Text
marker) (\s :: GetReservedNodeExchangeOfferingsResponse
s@GetReservedNodeExchangeOfferingsResponse' {} Maybe Text
a -> GetReservedNodeExchangeOfferingsResponse
s {$sel:marker:GetReservedNodeExchangeOfferingsResponse' :: Maybe Text
marker = Maybe Text
a} :: GetReservedNodeExchangeOfferingsResponse)

-- | The response's http status code.
getReservedNodeExchangeOfferingsResponse_httpStatus :: Lens.Lens' GetReservedNodeExchangeOfferingsResponse Prelude.Int
getReservedNodeExchangeOfferingsResponse_httpStatus :: (Int -> f Int)
-> GetReservedNodeExchangeOfferingsResponse
-> f GetReservedNodeExchangeOfferingsResponse
getReservedNodeExchangeOfferingsResponse_httpStatus = (GetReservedNodeExchangeOfferingsResponse -> Int)
-> (GetReservedNodeExchangeOfferingsResponse
    -> Int -> GetReservedNodeExchangeOfferingsResponse)
-> Lens
     GetReservedNodeExchangeOfferingsResponse
     GetReservedNodeExchangeOfferingsResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetReservedNodeExchangeOfferingsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetReservedNodeExchangeOfferingsResponse' :: GetReservedNodeExchangeOfferingsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetReservedNodeExchangeOfferingsResponse
s@GetReservedNodeExchangeOfferingsResponse' {} Int
a -> GetReservedNodeExchangeOfferingsResponse
s {$sel:httpStatus:GetReservedNodeExchangeOfferingsResponse' :: Int
httpStatus = Int
a} :: GetReservedNodeExchangeOfferingsResponse)

instance
  Prelude.NFData
    GetReservedNodeExchangeOfferingsResponse