{-# 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.DescribeReservedNodeOfferings
-- 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 a list of the available reserved node offerings by Amazon
-- Redshift with their descriptions including the node type, the fixed and
-- recurring costs of reserving the node and duration the node will be
-- reserved for you. These descriptions help you determine which reserve
-- node offering you want to purchase. You then use the unique offering ID
-- in you call to PurchaseReservedNodeOffering to reserve one or more nodes
-- for your Amazon Redshift cluster.
--
-- For more information about reserved node offerings, go to
-- <https://docs.aws.amazon.com/redshift/latest/mgmt/purchase-reserved-node-instance.html Purchasing Reserved Nodes>
-- in the /Amazon Redshift Cluster Management Guide/.
--
-- This operation returns paginated results.
module Amazonka.Redshift.DescribeReservedNodeOfferings
  ( -- * Creating a Request
    DescribeReservedNodeOfferings (..),
    newDescribeReservedNodeOfferings,

    -- * Request Lenses
    describeReservedNodeOfferings_reservedNodeOfferingId,
    describeReservedNodeOfferings_marker,
    describeReservedNodeOfferings_maxRecords,

    -- * Destructuring the Response
    DescribeReservedNodeOfferingsResponse (..),
    newDescribeReservedNodeOfferingsResponse,

    -- * Response Lenses
    describeReservedNodeOfferingsResponse_reservedNodeOfferings,
    describeReservedNodeOfferingsResponse_marker,
    describeReservedNodeOfferingsResponse_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:/ 'newDescribeReservedNodeOfferings' smart constructor.
data DescribeReservedNodeOfferings = DescribeReservedNodeOfferings'
  { -- | The unique identifier for the offering.
    DescribeReservedNodeOfferings -> Maybe Text
reservedNodeOfferingId :: Prelude.Maybe Prelude.Text,
    -- | An optional parameter that specifies the starting point to return a set
    -- of response records. When the results of a DescribeReservedNodeOfferings
    -- request exceed the value specified in @MaxRecords@, Amazon Web Services
    -- 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.
    DescribeReservedNodeOfferings -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of response records to return in each call. If the
    -- number of remaining response records exceeds the specified @MaxRecords@
    -- value, a value is returned in a @marker@ field of the response. You can
    -- retrieve the next set of records by retrying the command with the
    -- returned marker value.
    --
    -- Default: @100@
    --
    -- Constraints: minimum 20, maximum 100.
    DescribeReservedNodeOfferings -> Maybe Int
maxRecords :: Prelude.Maybe Prelude.Int
  }
  deriving (DescribeReservedNodeOfferings
-> DescribeReservedNodeOfferings -> Bool
(DescribeReservedNodeOfferings
 -> DescribeReservedNodeOfferings -> Bool)
-> (DescribeReservedNodeOfferings
    -> DescribeReservedNodeOfferings -> Bool)
-> Eq DescribeReservedNodeOfferings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeReservedNodeOfferings
-> DescribeReservedNodeOfferings -> Bool
$c/= :: DescribeReservedNodeOfferings
-> DescribeReservedNodeOfferings -> Bool
== :: DescribeReservedNodeOfferings
-> DescribeReservedNodeOfferings -> Bool
$c== :: DescribeReservedNodeOfferings
-> DescribeReservedNodeOfferings -> Bool
Prelude.Eq, ReadPrec [DescribeReservedNodeOfferings]
ReadPrec DescribeReservedNodeOfferings
Int -> ReadS DescribeReservedNodeOfferings
ReadS [DescribeReservedNodeOfferings]
(Int -> ReadS DescribeReservedNodeOfferings)
-> ReadS [DescribeReservedNodeOfferings]
-> ReadPrec DescribeReservedNodeOfferings
-> ReadPrec [DescribeReservedNodeOfferings]
-> Read DescribeReservedNodeOfferings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeReservedNodeOfferings]
$creadListPrec :: ReadPrec [DescribeReservedNodeOfferings]
readPrec :: ReadPrec DescribeReservedNodeOfferings
$creadPrec :: ReadPrec DescribeReservedNodeOfferings
readList :: ReadS [DescribeReservedNodeOfferings]
$creadList :: ReadS [DescribeReservedNodeOfferings]
readsPrec :: Int -> ReadS DescribeReservedNodeOfferings
$creadsPrec :: Int -> ReadS DescribeReservedNodeOfferings
Prelude.Read, Int -> DescribeReservedNodeOfferings -> ShowS
[DescribeReservedNodeOfferings] -> ShowS
DescribeReservedNodeOfferings -> String
(Int -> DescribeReservedNodeOfferings -> ShowS)
-> (DescribeReservedNodeOfferings -> String)
-> ([DescribeReservedNodeOfferings] -> ShowS)
-> Show DescribeReservedNodeOfferings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeReservedNodeOfferings] -> ShowS
$cshowList :: [DescribeReservedNodeOfferings] -> ShowS
show :: DescribeReservedNodeOfferings -> String
$cshow :: DescribeReservedNodeOfferings -> String
showsPrec :: Int -> DescribeReservedNodeOfferings -> ShowS
$cshowsPrec :: Int -> DescribeReservedNodeOfferings -> ShowS
Prelude.Show, (forall x.
 DescribeReservedNodeOfferings
 -> Rep DescribeReservedNodeOfferings x)
-> (forall x.
    Rep DescribeReservedNodeOfferings x
    -> DescribeReservedNodeOfferings)
-> Generic DescribeReservedNodeOfferings
forall x.
Rep DescribeReservedNodeOfferings x
-> DescribeReservedNodeOfferings
forall x.
DescribeReservedNodeOfferings
-> Rep DescribeReservedNodeOfferings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeReservedNodeOfferings x
-> DescribeReservedNodeOfferings
$cfrom :: forall x.
DescribeReservedNodeOfferings
-> Rep DescribeReservedNodeOfferings x
Prelude.Generic)

-- |
-- Create a value of 'DescribeReservedNodeOfferings' 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:
--
-- 'reservedNodeOfferingId', 'describeReservedNodeOfferings_reservedNodeOfferingId' - The unique identifier for the offering.
--
-- 'marker', 'describeReservedNodeOfferings_marker' - An optional parameter that specifies the starting point to return a set
-- of response records. When the results of a DescribeReservedNodeOfferings
-- request exceed the value specified in @MaxRecords@, Amazon Web Services
-- 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.
--
-- 'maxRecords', 'describeReservedNodeOfferings_maxRecords' - The maximum number of response records to return in each call. If the
-- number of remaining response records exceeds the specified @MaxRecords@
-- value, a value is returned in a @marker@ field of the response. You can
-- retrieve the next set of records by retrying the command with the
-- returned marker value.
--
-- Default: @100@
--
-- Constraints: minimum 20, maximum 100.
newDescribeReservedNodeOfferings ::
  DescribeReservedNodeOfferings
newDescribeReservedNodeOfferings :: DescribeReservedNodeOfferings
newDescribeReservedNodeOfferings =
  DescribeReservedNodeOfferings' :: Maybe Text
-> Maybe Text -> Maybe Int -> DescribeReservedNodeOfferings
DescribeReservedNodeOfferings'
    { $sel:reservedNodeOfferingId:DescribeReservedNodeOfferings' :: Maybe Text
reservedNodeOfferingId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeReservedNodeOfferings' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxRecords:DescribeReservedNodeOfferings' :: Maybe Int
maxRecords = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The unique identifier for the offering.
describeReservedNodeOfferings_reservedNodeOfferingId :: Lens.Lens' DescribeReservedNodeOfferings (Prelude.Maybe Prelude.Text)
describeReservedNodeOfferings_reservedNodeOfferingId :: (Maybe Text -> f (Maybe Text))
-> DescribeReservedNodeOfferings -> f DescribeReservedNodeOfferings
describeReservedNodeOfferings_reservedNodeOfferingId = (DescribeReservedNodeOfferings -> Maybe Text)
-> (DescribeReservedNodeOfferings
    -> Maybe Text -> DescribeReservedNodeOfferings)
-> Lens
     DescribeReservedNodeOfferings
     DescribeReservedNodeOfferings
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReservedNodeOfferings' {Maybe Text
reservedNodeOfferingId :: Maybe Text
$sel:reservedNodeOfferingId:DescribeReservedNodeOfferings' :: DescribeReservedNodeOfferings -> Maybe Text
reservedNodeOfferingId} -> Maybe Text
reservedNodeOfferingId) (\s :: DescribeReservedNodeOfferings
s@DescribeReservedNodeOfferings' {} Maybe Text
a -> DescribeReservedNodeOfferings
s {$sel:reservedNodeOfferingId:DescribeReservedNodeOfferings' :: Maybe Text
reservedNodeOfferingId = Maybe Text
a} :: DescribeReservedNodeOfferings)

-- | An optional parameter that specifies the starting point to return a set
-- of response records. When the results of a DescribeReservedNodeOfferings
-- request exceed the value specified in @MaxRecords@, Amazon Web Services
-- 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.
describeReservedNodeOfferings_marker :: Lens.Lens' DescribeReservedNodeOfferings (Prelude.Maybe Prelude.Text)
describeReservedNodeOfferings_marker :: (Maybe Text -> f (Maybe Text))
-> DescribeReservedNodeOfferings -> f DescribeReservedNodeOfferings
describeReservedNodeOfferings_marker = (DescribeReservedNodeOfferings -> Maybe Text)
-> (DescribeReservedNodeOfferings
    -> Maybe Text -> DescribeReservedNodeOfferings)
-> Lens
     DescribeReservedNodeOfferings
     DescribeReservedNodeOfferings
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReservedNodeOfferings' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeReservedNodeOfferings' :: DescribeReservedNodeOfferings -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeReservedNodeOfferings
s@DescribeReservedNodeOfferings' {} Maybe Text
a -> DescribeReservedNodeOfferings
s {$sel:marker:DescribeReservedNodeOfferings' :: Maybe Text
marker = Maybe Text
a} :: DescribeReservedNodeOfferings)

-- | The maximum number of response records to return in each call. If the
-- number of remaining response records exceeds the specified @MaxRecords@
-- value, a value is returned in a @marker@ field of the response. You can
-- retrieve the next set of records by retrying the command with the
-- returned marker value.
--
-- Default: @100@
--
-- Constraints: minimum 20, maximum 100.
describeReservedNodeOfferings_maxRecords :: Lens.Lens' DescribeReservedNodeOfferings (Prelude.Maybe Prelude.Int)
describeReservedNodeOfferings_maxRecords :: (Maybe Int -> f (Maybe Int))
-> DescribeReservedNodeOfferings -> f DescribeReservedNodeOfferings
describeReservedNodeOfferings_maxRecords = (DescribeReservedNodeOfferings -> Maybe Int)
-> (DescribeReservedNodeOfferings
    -> Maybe Int -> DescribeReservedNodeOfferings)
-> Lens
     DescribeReservedNodeOfferings
     DescribeReservedNodeOfferings
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReservedNodeOfferings' {Maybe Int
maxRecords :: Maybe Int
$sel:maxRecords:DescribeReservedNodeOfferings' :: DescribeReservedNodeOfferings -> Maybe Int
maxRecords} -> Maybe Int
maxRecords) (\s :: DescribeReservedNodeOfferings
s@DescribeReservedNodeOfferings' {} Maybe Int
a -> DescribeReservedNodeOfferings
s {$sel:maxRecords:DescribeReservedNodeOfferings' :: Maybe Int
maxRecords = Maybe Int
a} :: DescribeReservedNodeOfferings)

instance Core.AWSPager DescribeReservedNodeOfferings where
  page :: DescribeReservedNodeOfferings
-> AWSResponse DescribeReservedNodeOfferings
-> Maybe DescribeReservedNodeOfferings
page DescribeReservedNodeOfferings
rq AWSResponse DescribeReservedNodeOfferings
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeReservedNodeOfferings
DescribeReservedNodeOfferingsResponse
rs
            DescribeReservedNodeOfferingsResponse
-> Getting (First Text) DescribeReservedNodeOfferingsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeReservedNodeOfferingsResponse
-> Const (First Text) DescribeReservedNodeOfferingsResponse
Lens' DescribeReservedNodeOfferingsResponse (Maybe Text)
describeReservedNodeOfferingsResponse_marker
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeReservedNodeOfferingsResponse
 -> Const (First Text) DescribeReservedNodeOfferingsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeReservedNodeOfferingsResponse 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 DescribeReservedNodeOfferings
forall a. Maybe a
Prelude.Nothing
    | Maybe [ReservedNodeOffering] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeReservedNodeOfferings
DescribeReservedNodeOfferingsResponse
rs
            DescribeReservedNodeOfferingsResponse
-> Getting
     (First [ReservedNodeOffering])
     DescribeReservedNodeOfferingsResponse
     [ReservedNodeOffering]
-> Maybe [ReservedNodeOffering]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [ReservedNodeOffering]
 -> Const
      (First [ReservedNodeOffering]) (Maybe [ReservedNodeOffering]))
-> DescribeReservedNodeOfferingsResponse
-> Const
     (First [ReservedNodeOffering])
     DescribeReservedNodeOfferingsResponse
Lens'
  DescribeReservedNodeOfferingsResponse
  (Maybe [ReservedNodeOffering])
describeReservedNodeOfferingsResponse_reservedNodeOfferings
              ((Maybe [ReservedNodeOffering]
  -> Const
       (First [ReservedNodeOffering]) (Maybe [ReservedNodeOffering]))
 -> DescribeReservedNodeOfferingsResponse
 -> Const
      (First [ReservedNodeOffering])
      DescribeReservedNodeOfferingsResponse)
-> (([ReservedNodeOffering]
     -> Const (First [ReservedNodeOffering]) [ReservedNodeOffering])
    -> Maybe [ReservedNodeOffering]
    -> Const
         (First [ReservedNodeOffering]) (Maybe [ReservedNodeOffering]))
-> Getting
     (First [ReservedNodeOffering])
     DescribeReservedNodeOfferingsResponse
     [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 DescribeReservedNodeOfferings
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeReservedNodeOfferings
-> Maybe DescribeReservedNodeOfferings
forall a. a -> Maybe a
Prelude.Just (DescribeReservedNodeOfferings
 -> Maybe DescribeReservedNodeOfferings)
-> DescribeReservedNodeOfferings
-> Maybe DescribeReservedNodeOfferings
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeReservedNodeOfferings
rq
          DescribeReservedNodeOfferings
-> (DescribeReservedNodeOfferings -> DescribeReservedNodeOfferings)
-> DescribeReservedNodeOfferings
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeReservedNodeOfferings
-> Identity DescribeReservedNodeOfferings
Lens
  DescribeReservedNodeOfferings
  DescribeReservedNodeOfferings
  (Maybe Text)
  (Maybe Text)
describeReservedNodeOfferings_marker
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeReservedNodeOfferings
 -> Identity DescribeReservedNodeOfferings)
-> Maybe Text
-> DescribeReservedNodeOfferings
-> DescribeReservedNodeOfferings
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeReservedNodeOfferings
DescribeReservedNodeOfferingsResponse
rs
          DescribeReservedNodeOfferingsResponse
-> Getting (First Text) DescribeReservedNodeOfferingsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeReservedNodeOfferingsResponse
-> Const (First Text) DescribeReservedNodeOfferingsResponse
Lens' DescribeReservedNodeOfferingsResponse (Maybe Text)
describeReservedNodeOfferingsResponse_marker
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeReservedNodeOfferingsResponse
 -> Const (First Text) DescribeReservedNodeOfferingsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeReservedNodeOfferingsResponse 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
    DescribeReservedNodeOfferings
  where
  type
    AWSResponse DescribeReservedNodeOfferings =
      DescribeReservedNodeOfferingsResponse
  request :: DescribeReservedNodeOfferings
-> Request DescribeReservedNodeOfferings
request = Service
-> DescribeReservedNodeOfferings
-> Request DescribeReservedNodeOfferings
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeReservedNodeOfferings
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeReservedNodeOfferings)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DescribeReservedNodeOfferings))
-> Logger
-> Service
-> Proxy DescribeReservedNodeOfferings
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeReservedNodeOfferings)))
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
"DescribeReservedNodeOfferingsResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe [ReservedNodeOffering]
-> Maybe Text -> Int -> DescribeReservedNodeOfferingsResponse
DescribeReservedNodeOfferingsResponse'
            (Maybe [ReservedNodeOffering]
 -> Maybe Text -> Int -> DescribeReservedNodeOfferingsResponse)
-> Either String (Maybe [ReservedNodeOffering])
-> Either
     String (Maybe Text -> Int -> DescribeReservedNodeOfferingsResponse)
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 -> DescribeReservedNodeOfferingsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DescribeReservedNodeOfferingsResponse)
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 -> DescribeReservedNodeOfferingsResponse)
-> Either String Int
-> Either String DescribeReservedNodeOfferingsResponse
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
    DescribeReservedNodeOfferings

instance Prelude.NFData DescribeReservedNodeOfferings

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

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

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

-- |
--
-- /See:/ 'newDescribeReservedNodeOfferingsResponse' smart constructor.
data DescribeReservedNodeOfferingsResponse = DescribeReservedNodeOfferingsResponse'
  { -- | A list of @ReservedNodeOffering@ objects.
    DescribeReservedNodeOfferingsResponse
-> Maybe [ReservedNodeOffering]
reservedNodeOfferings :: Prelude.Maybe [ReservedNodeOffering],
    -- | A value that indicates the starting point for the next set of response
    -- records in a subsequent request. If a value is returned in a response,
    -- you can retrieve the next set of records by providing this returned
    -- marker value in the @Marker@ parameter and retrying the command. If the
    -- @Marker@ field is empty, all response records have been retrieved for
    -- the request.
    DescribeReservedNodeOfferingsResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeReservedNodeOfferingsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeReservedNodeOfferingsResponse
-> DescribeReservedNodeOfferingsResponse -> Bool
(DescribeReservedNodeOfferingsResponse
 -> DescribeReservedNodeOfferingsResponse -> Bool)
-> (DescribeReservedNodeOfferingsResponse
    -> DescribeReservedNodeOfferingsResponse -> Bool)
-> Eq DescribeReservedNodeOfferingsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeReservedNodeOfferingsResponse
-> DescribeReservedNodeOfferingsResponse -> Bool
$c/= :: DescribeReservedNodeOfferingsResponse
-> DescribeReservedNodeOfferingsResponse -> Bool
== :: DescribeReservedNodeOfferingsResponse
-> DescribeReservedNodeOfferingsResponse -> Bool
$c== :: DescribeReservedNodeOfferingsResponse
-> DescribeReservedNodeOfferingsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeReservedNodeOfferingsResponse]
ReadPrec DescribeReservedNodeOfferingsResponse
Int -> ReadS DescribeReservedNodeOfferingsResponse
ReadS [DescribeReservedNodeOfferingsResponse]
(Int -> ReadS DescribeReservedNodeOfferingsResponse)
-> ReadS [DescribeReservedNodeOfferingsResponse]
-> ReadPrec DescribeReservedNodeOfferingsResponse
-> ReadPrec [DescribeReservedNodeOfferingsResponse]
-> Read DescribeReservedNodeOfferingsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeReservedNodeOfferingsResponse]
$creadListPrec :: ReadPrec [DescribeReservedNodeOfferingsResponse]
readPrec :: ReadPrec DescribeReservedNodeOfferingsResponse
$creadPrec :: ReadPrec DescribeReservedNodeOfferingsResponse
readList :: ReadS [DescribeReservedNodeOfferingsResponse]
$creadList :: ReadS [DescribeReservedNodeOfferingsResponse]
readsPrec :: Int -> ReadS DescribeReservedNodeOfferingsResponse
$creadsPrec :: Int -> ReadS DescribeReservedNodeOfferingsResponse
Prelude.Read, Int -> DescribeReservedNodeOfferingsResponse -> ShowS
[DescribeReservedNodeOfferingsResponse] -> ShowS
DescribeReservedNodeOfferingsResponse -> String
(Int -> DescribeReservedNodeOfferingsResponse -> ShowS)
-> (DescribeReservedNodeOfferingsResponse -> String)
-> ([DescribeReservedNodeOfferingsResponse] -> ShowS)
-> Show DescribeReservedNodeOfferingsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeReservedNodeOfferingsResponse] -> ShowS
$cshowList :: [DescribeReservedNodeOfferingsResponse] -> ShowS
show :: DescribeReservedNodeOfferingsResponse -> String
$cshow :: DescribeReservedNodeOfferingsResponse -> String
showsPrec :: Int -> DescribeReservedNodeOfferingsResponse -> ShowS
$cshowsPrec :: Int -> DescribeReservedNodeOfferingsResponse -> ShowS
Prelude.Show, (forall x.
 DescribeReservedNodeOfferingsResponse
 -> Rep DescribeReservedNodeOfferingsResponse x)
-> (forall x.
    Rep DescribeReservedNodeOfferingsResponse x
    -> DescribeReservedNodeOfferingsResponse)
-> Generic DescribeReservedNodeOfferingsResponse
forall x.
Rep DescribeReservedNodeOfferingsResponse x
-> DescribeReservedNodeOfferingsResponse
forall x.
DescribeReservedNodeOfferingsResponse
-> Rep DescribeReservedNodeOfferingsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeReservedNodeOfferingsResponse x
-> DescribeReservedNodeOfferingsResponse
$cfrom :: forall x.
DescribeReservedNodeOfferingsResponse
-> Rep DescribeReservedNodeOfferingsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeReservedNodeOfferingsResponse' 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', 'describeReservedNodeOfferingsResponse_reservedNodeOfferings' - A list of @ReservedNodeOffering@ objects.
--
-- 'marker', 'describeReservedNodeOfferingsResponse_marker' - A value that indicates the starting point for the next set of response
-- records in a subsequent request. If a value is returned in a response,
-- you can retrieve the next set of records by providing this returned
-- marker value in the @Marker@ parameter and retrying the command. If the
-- @Marker@ field is empty, all response records have been retrieved for
-- the request.
--
-- 'httpStatus', 'describeReservedNodeOfferingsResponse_httpStatus' - The response's http status code.
newDescribeReservedNodeOfferingsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeReservedNodeOfferingsResponse
newDescribeReservedNodeOfferingsResponse :: Int -> DescribeReservedNodeOfferingsResponse
newDescribeReservedNodeOfferingsResponse Int
pHttpStatus_ =
  DescribeReservedNodeOfferingsResponse' :: Maybe [ReservedNodeOffering]
-> Maybe Text -> Int -> DescribeReservedNodeOfferingsResponse
DescribeReservedNodeOfferingsResponse'
    { $sel:reservedNodeOfferings:DescribeReservedNodeOfferingsResponse' :: Maybe [ReservedNodeOffering]
reservedNodeOfferings =
        Maybe [ReservedNodeOffering]
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeReservedNodeOfferingsResponse' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeReservedNodeOfferingsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of @ReservedNodeOffering@ objects.
describeReservedNodeOfferingsResponse_reservedNodeOfferings :: Lens.Lens' DescribeReservedNodeOfferingsResponse (Prelude.Maybe [ReservedNodeOffering])
describeReservedNodeOfferingsResponse_reservedNodeOfferings :: (Maybe [ReservedNodeOffering] -> f (Maybe [ReservedNodeOffering]))
-> DescribeReservedNodeOfferingsResponse
-> f DescribeReservedNodeOfferingsResponse
describeReservedNodeOfferingsResponse_reservedNodeOfferings = (DescribeReservedNodeOfferingsResponse
 -> Maybe [ReservedNodeOffering])
-> (DescribeReservedNodeOfferingsResponse
    -> Maybe [ReservedNodeOffering]
    -> DescribeReservedNodeOfferingsResponse)
-> Lens'
     DescribeReservedNodeOfferingsResponse
     (Maybe [ReservedNodeOffering])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReservedNodeOfferingsResponse' {Maybe [ReservedNodeOffering]
reservedNodeOfferings :: Maybe [ReservedNodeOffering]
$sel:reservedNodeOfferings:DescribeReservedNodeOfferingsResponse' :: DescribeReservedNodeOfferingsResponse
-> Maybe [ReservedNodeOffering]
reservedNodeOfferings} -> Maybe [ReservedNodeOffering]
reservedNodeOfferings) (\s :: DescribeReservedNodeOfferingsResponse
s@DescribeReservedNodeOfferingsResponse' {} Maybe [ReservedNodeOffering]
a -> DescribeReservedNodeOfferingsResponse
s {$sel:reservedNodeOfferings:DescribeReservedNodeOfferingsResponse' :: Maybe [ReservedNodeOffering]
reservedNodeOfferings = Maybe [ReservedNodeOffering]
a} :: DescribeReservedNodeOfferingsResponse) ((Maybe [ReservedNodeOffering] -> f (Maybe [ReservedNodeOffering]))
 -> DescribeReservedNodeOfferingsResponse
 -> f DescribeReservedNodeOfferingsResponse)
-> ((Maybe [ReservedNodeOffering]
     -> f (Maybe [ReservedNodeOffering]))
    -> Maybe [ReservedNodeOffering]
    -> f (Maybe [ReservedNodeOffering]))
-> (Maybe [ReservedNodeOffering]
    -> f (Maybe [ReservedNodeOffering]))
-> DescribeReservedNodeOfferingsResponse
-> f DescribeReservedNodeOfferingsResponse
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

-- | A value that indicates the starting point for the next set of response
-- records in a subsequent request. If a value is returned in a response,
-- you can retrieve the next set of records by providing this returned
-- marker value in the @Marker@ parameter and retrying the command. If the
-- @Marker@ field is empty, all response records have been retrieved for
-- the request.
describeReservedNodeOfferingsResponse_marker :: Lens.Lens' DescribeReservedNodeOfferingsResponse (Prelude.Maybe Prelude.Text)
describeReservedNodeOfferingsResponse_marker :: (Maybe Text -> f (Maybe Text))
-> DescribeReservedNodeOfferingsResponse
-> f DescribeReservedNodeOfferingsResponse
describeReservedNodeOfferingsResponse_marker = (DescribeReservedNodeOfferingsResponse -> Maybe Text)
-> (DescribeReservedNodeOfferingsResponse
    -> Maybe Text -> DescribeReservedNodeOfferingsResponse)
-> Lens' DescribeReservedNodeOfferingsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReservedNodeOfferingsResponse' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeReservedNodeOfferingsResponse' :: DescribeReservedNodeOfferingsResponse -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeReservedNodeOfferingsResponse
s@DescribeReservedNodeOfferingsResponse' {} Maybe Text
a -> DescribeReservedNodeOfferingsResponse
s {$sel:marker:DescribeReservedNodeOfferingsResponse' :: Maybe Text
marker = Maybe Text
a} :: DescribeReservedNodeOfferingsResponse)

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

instance
  Prelude.NFData
    DescribeReservedNodeOfferingsResponse