{-# 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.ElasticSearch.DescribeReservedElasticsearchInstanceOfferings
-- 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)
--
-- Lists available reserved Elasticsearch instance offerings.
--
-- This operation returns paginated results.
module Amazonka.ElasticSearch.DescribeReservedElasticsearchInstanceOfferings
  ( -- * Creating a Request
    DescribeReservedElasticsearchInstanceOfferings (..),
    newDescribeReservedElasticsearchInstanceOfferings,

    -- * Request Lenses
    describeReservedElasticsearchInstanceOfferings_reservedElasticsearchInstanceOfferingId,
    describeReservedElasticsearchInstanceOfferings_nextToken,
    describeReservedElasticsearchInstanceOfferings_maxResults,

    -- * Destructuring the Response
    DescribeReservedElasticsearchInstanceOfferingsResponse (..),
    newDescribeReservedElasticsearchInstanceOfferingsResponse,

    -- * Response Lenses
    describeReservedElasticsearchInstanceOfferingsResponse_reservedElasticsearchInstanceOfferings,
    describeReservedElasticsearchInstanceOfferingsResponse_nextToken,
    describeReservedElasticsearchInstanceOfferingsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.ElasticSearch.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | Container for parameters to
-- @DescribeReservedElasticsearchInstanceOfferings@
--
-- /See:/ 'newDescribeReservedElasticsearchInstanceOfferings' smart constructor.
data DescribeReservedElasticsearchInstanceOfferings = DescribeReservedElasticsearchInstanceOfferings'
  { -- | The offering identifier filter value. Use this parameter to show only
    -- the available offering that matches the specified reservation
    -- identifier.
    DescribeReservedElasticsearchInstanceOfferings -> Maybe Text
reservedElasticsearchInstanceOfferingId :: Prelude.Maybe Prelude.Text,
    -- | NextToken should be sent in case if earlier API call produced result
    -- containing NextToken. It is used for pagination.
    DescribeReservedElasticsearchInstanceOfferings -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Set this value to limit the number of results returned. If not
    -- specified, defaults to 100.
    DescribeReservedElasticsearchInstanceOfferings -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int
  }
  deriving (DescribeReservedElasticsearchInstanceOfferings
-> DescribeReservedElasticsearchInstanceOfferings -> Bool
(DescribeReservedElasticsearchInstanceOfferings
 -> DescribeReservedElasticsearchInstanceOfferings -> Bool)
-> (DescribeReservedElasticsearchInstanceOfferings
    -> DescribeReservedElasticsearchInstanceOfferings -> Bool)
-> Eq DescribeReservedElasticsearchInstanceOfferings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeReservedElasticsearchInstanceOfferings
-> DescribeReservedElasticsearchInstanceOfferings -> Bool
$c/= :: DescribeReservedElasticsearchInstanceOfferings
-> DescribeReservedElasticsearchInstanceOfferings -> Bool
== :: DescribeReservedElasticsearchInstanceOfferings
-> DescribeReservedElasticsearchInstanceOfferings -> Bool
$c== :: DescribeReservedElasticsearchInstanceOfferings
-> DescribeReservedElasticsearchInstanceOfferings -> Bool
Prelude.Eq, ReadPrec [DescribeReservedElasticsearchInstanceOfferings]
ReadPrec DescribeReservedElasticsearchInstanceOfferings
Int -> ReadS DescribeReservedElasticsearchInstanceOfferings
ReadS [DescribeReservedElasticsearchInstanceOfferings]
(Int -> ReadS DescribeReservedElasticsearchInstanceOfferings)
-> ReadS [DescribeReservedElasticsearchInstanceOfferings]
-> ReadPrec DescribeReservedElasticsearchInstanceOfferings
-> ReadPrec [DescribeReservedElasticsearchInstanceOfferings]
-> Read DescribeReservedElasticsearchInstanceOfferings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeReservedElasticsearchInstanceOfferings]
$creadListPrec :: ReadPrec [DescribeReservedElasticsearchInstanceOfferings]
readPrec :: ReadPrec DescribeReservedElasticsearchInstanceOfferings
$creadPrec :: ReadPrec DescribeReservedElasticsearchInstanceOfferings
readList :: ReadS [DescribeReservedElasticsearchInstanceOfferings]
$creadList :: ReadS [DescribeReservedElasticsearchInstanceOfferings]
readsPrec :: Int -> ReadS DescribeReservedElasticsearchInstanceOfferings
$creadsPrec :: Int -> ReadS DescribeReservedElasticsearchInstanceOfferings
Prelude.Read, Int -> DescribeReservedElasticsearchInstanceOfferings -> ShowS
[DescribeReservedElasticsearchInstanceOfferings] -> ShowS
DescribeReservedElasticsearchInstanceOfferings -> String
(Int -> DescribeReservedElasticsearchInstanceOfferings -> ShowS)
-> (DescribeReservedElasticsearchInstanceOfferings -> String)
-> ([DescribeReservedElasticsearchInstanceOfferings] -> ShowS)
-> Show DescribeReservedElasticsearchInstanceOfferings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeReservedElasticsearchInstanceOfferings] -> ShowS
$cshowList :: [DescribeReservedElasticsearchInstanceOfferings] -> ShowS
show :: DescribeReservedElasticsearchInstanceOfferings -> String
$cshow :: DescribeReservedElasticsearchInstanceOfferings -> String
showsPrec :: Int -> DescribeReservedElasticsearchInstanceOfferings -> ShowS
$cshowsPrec :: Int -> DescribeReservedElasticsearchInstanceOfferings -> ShowS
Prelude.Show, (forall x.
 DescribeReservedElasticsearchInstanceOfferings
 -> Rep DescribeReservedElasticsearchInstanceOfferings x)
-> (forall x.
    Rep DescribeReservedElasticsearchInstanceOfferings x
    -> DescribeReservedElasticsearchInstanceOfferings)
-> Generic DescribeReservedElasticsearchInstanceOfferings
forall x.
Rep DescribeReservedElasticsearchInstanceOfferings x
-> DescribeReservedElasticsearchInstanceOfferings
forall x.
DescribeReservedElasticsearchInstanceOfferings
-> Rep DescribeReservedElasticsearchInstanceOfferings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeReservedElasticsearchInstanceOfferings x
-> DescribeReservedElasticsearchInstanceOfferings
$cfrom :: forall x.
DescribeReservedElasticsearchInstanceOfferings
-> Rep DescribeReservedElasticsearchInstanceOfferings x
Prelude.Generic)

-- |
-- Create a value of 'DescribeReservedElasticsearchInstanceOfferings' 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:
--
-- 'reservedElasticsearchInstanceOfferingId', 'describeReservedElasticsearchInstanceOfferings_reservedElasticsearchInstanceOfferingId' - The offering identifier filter value. Use this parameter to show only
-- the available offering that matches the specified reservation
-- identifier.
--
-- 'nextToken', 'describeReservedElasticsearchInstanceOfferings_nextToken' - NextToken should be sent in case if earlier API call produced result
-- containing NextToken. It is used for pagination.
--
-- 'maxResults', 'describeReservedElasticsearchInstanceOfferings_maxResults' - Set this value to limit the number of results returned. If not
-- specified, defaults to 100.
newDescribeReservedElasticsearchInstanceOfferings ::
  DescribeReservedElasticsearchInstanceOfferings
newDescribeReservedElasticsearchInstanceOfferings :: DescribeReservedElasticsearchInstanceOfferings
newDescribeReservedElasticsearchInstanceOfferings =
  DescribeReservedElasticsearchInstanceOfferings' :: Maybe Text
-> Maybe Text
-> Maybe Int
-> DescribeReservedElasticsearchInstanceOfferings
DescribeReservedElasticsearchInstanceOfferings'
    { $sel:reservedElasticsearchInstanceOfferingId:DescribeReservedElasticsearchInstanceOfferings' :: Maybe Text
reservedElasticsearchInstanceOfferingId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeReservedElasticsearchInstanceOfferings' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeReservedElasticsearchInstanceOfferings' :: Maybe Int
maxResults =
        Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The offering identifier filter value. Use this parameter to show only
-- the available offering that matches the specified reservation
-- identifier.
describeReservedElasticsearchInstanceOfferings_reservedElasticsearchInstanceOfferingId :: Lens.Lens' DescribeReservedElasticsearchInstanceOfferings (Prelude.Maybe Prelude.Text)
describeReservedElasticsearchInstanceOfferings_reservedElasticsearchInstanceOfferingId :: (Maybe Text -> f (Maybe Text))
-> DescribeReservedElasticsearchInstanceOfferings
-> f DescribeReservedElasticsearchInstanceOfferings
describeReservedElasticsearchInstanceOfferings_reservedElasticsearchInstanceOfferingId = (DescribeReservedElasticsearchInstanceOfferings -> Maybe Text)
-> (DescribeReservedElasticsearchInstanceOfferings
    -> Maybe Text -> DescribeReservedElasticsearchInstanceOfferings)
-> Lens
     DescribeReservedElasticsearchInstanceOfferings
     DescribeReservedElasticsearchInstanceOfferings
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReservedElasticsearchInstanceOfferings' {Maybe Text
reservedElasticsearchInstanceOfferingId :: Maybe Text
$sel:reservedElasticsearchInstanceOfferingId:DescribeReservedElasticsearchInstanceOfferings' :: DescribeReservedElasticsearchInstanceOfferings -> Maybe Text
reservedElasticsearchInstanceOfferingId} -> Maybe Text
reservedElasticsearchInstanceOfferingId) (\s :: DescribeReservedElasticsearchInstanceOfferings
s@DescribeReservedElasticsearchInstanceOfferings' {} Maybe Text
a -> DescribeReservedElasticsearchInstanceOfferings
s {$sel:reservedElasticsearchInstanceOfferingId:DescribeReservedElasticsearchInstanceOfferings' :: Maybe Text
reservedElasticsearchInstanceOfferingId = Maybe Text
a} :: DescribeReservedElasticsearchInstanceOfferings)

-- | NextToken should be sent in case if earlier API call produced result
-- containing NextToken. It is used for pagination.
describeReservedElasticsearchInstanceOfferings_nextToken :: Lens.Lens' DescribeReservedElasticsearchInstanceOfferings (Prelude.Maybe Prelude.Text)
describeReservedElasticsearchInstanceOfferings_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeReservedElasticsearchInstanceOfferings
-> f DescribeReservedElasticsearchInstanceOfferings
describeReservedElasticsearchInstanceOfferings_nextToken = (DescribeReservedElasticsearchInstanceOfferings -> Maybe Text)
-> (DescribeReservedElasticsearchInstanceOfferings
    -> Maybe Text -> DescribeReservedElasticsearchInstanceOfferings)
-> Lens
     DescribeReservedElasticsearchInstanceOfferings
     DescribeReservedElasticsearchInstanceOfferings
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReservedElasticsearchInstanceOfferings' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeReservedElasticsearchInstanceOfferings' :: DescribeReservedElasticsearchInstanceOfferings -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeReservedElasticsearchInstanceOfferings
s@DescribeReservedElasticsearchInstanceOfferings' {} Maybe Text
a -> DescribeReservedElasticsearchInstanceOfferings
s {$sel:nextToken:DescribeReservedElasticsearchInstanceOfferings' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeReservedElasticsearchInstanceOfferings)

-- | Set this value to limit the number of results returned. If not
-- specified, defaults to 100.
describeReservedElasticsearchInstanceOfferings_maxResults :: Lens.Lens' DescribeReservedElasticsearchInstanceOfferings (Prelude.Maybe Prelude.Int)
describeReservedElasticsearchInstanceOfferings_maxResults :: (Maybe Int -> f (Maybe Int))
-> DescribeReservedElasticsearchInstanceOfferings
-> f DescribeReservedElasticsearchInstanceOfferings
describeReservedElasticsearchInstanceOfferings_maxResults = (DescribeReservedElasticsearchInstanceOfferings -> Maybe Int)
-> (DescribeReservedElasticsearchInstanceOfferings
    -> Maybe Int -> DescribeReservedElasticsearchInstanceOfferings)
-> Lens
     DescribeReservedElasticsearchInstanceOfferings
     DescribeReservedElasticsearchInstanceOfferings
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReservedElasticsearchInstanceOfferings' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:DescribeReservedElasticsearchInstanceOfferings' :: DescribeReservedElasticsearchInstanceOfferings -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: DescribeReservedElasticsearchInstanceOfferings
s@DescribeReservedElasticsearchInstanceOfferings' {} Maybe Int
a -> DescribeReservedElasticsearchInstanceOfferings
s {$sel:maxResults:DescribeReservedElasticsearchInstanceOfferings' :: Maybe Int
maxResults = Maybe Int
a} :: DescribeReservedElasticsearchInstanceOfferings)

instance
  Core.AWSPager
    DescribeReservedElasticsearchInstanceOfferings
  where
  page :: DescribeReservedElasticsearchInstanceOfferings
-> AWSResponse DescribeReservedElasticsearchInstanceOfferings
-> Maybe DescribeReservedElasticsearchInstanceOfferings
page DescribeReservedElasticsearchInstanceOfferings
rq AWSResponse DescribeReservedElasticsearchInstanceOfferings
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeReservedElasticsearchInstanceOfferings
DescribeReservedElasticsearchInstanceOfferingsResponse
rs
            DescribeReservedElasticsearchInstanceOfferingsResponse
-> Getting
     (First Text)
     DescribeReservedElasticsearchInstanceOfferingsResponse
     Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeReservedElasticsearchInstanceOfferingsResponse
-> Const
     (First Text) DescribeReservedElasticsearchInstanceOfferingsResponse
Lens'
  DescribeReservedElasticsearchInstanceOfferingsResponse (Maybe Text)
describeReservedElasticsearchInstanceOfferingsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeReservedElasticsearchInstanceOfferingsResponse
 -> Const
      (First Text)
      DescribeReservedElasticsearchInstanceOfferingsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text)
     DescribeReservedElasticsearchInstanceOfferingsResponse
     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 DescribeReservedElasticsearchInstanceOfferings
forall a. Maybe a
Prelude.Nothing
    | Maybe [ReservedElasticsearchInstanceOffering] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeReservedElasticsearchInstanceOfferings
DescribeReservedElasticsearchInstanceOfferingsResponse
rs
            DescribeReservedElasticsearchInstanceOfferingsResponse
-> Getting
     (First [ReservedElasticsearchInstanceOffering])
     DescribeReservedElasticsearchInstanceOfferingsResponse
     [ReservedElasticsearchInstanceOffering]
-> Maybe [ReservedElasticsearchInstanceOffering]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [ReservedElasticsearchInstanceOffering]
 -> Const
      (First [ReservedElasticsearchInstanceOffering])
      (Maybe [ReservedElasticsearchInstanceOffering]))
-> DescribeReservedElasticsearchInstanceOfferingsResponse
-> Const
     (First [ReservedElasticsearchInstanceOffering])
     DescribeReservedElasticsearchInstanceOfferingsResponse
Lens'
  DescribeReservedElasticsearchInstanceOfferingsResponse
  (Maybe [ReservedElasticsearchInstanceOffering])
describeReservedElasticsearchInstanceOfferingsResponse_reservedElasticsearchInstanceOfferings
              ((Maybe [ReservedElasticsearchInstanceOffering]
  -> Const
       (First [ReservedElasticsearchInstanceOffering])
       (Maybe [ReservedElasticsearchInstanceOffering]))
 -> DescribeReservedElasticsearchInstanceOfferingsResponse
 -> Const
      (First [ReservedElasticsearchInstanceOffering])
      DescribeReservedElasticsearchInstanceOfferingsResponse)
-> (([ReservedElasticsearchInstanceOffering]
     -> Const
          (First [ReservedElasticsearchInstanceOffering])
          [ReservedElasticsearchInstanceOffering])
    -> Maybe [ReservedElasticsearchInstanceOffering]
    -> Const
         (First [ReservedElasticsearchInstanceOffering])
         (Maybe [ReservedElasticsearchInstanceOffering]))
-> Getting
     (First [ReservedElasticsearchInstanceOffering])
     DescribeReservedElasticsearchInstanceOfferingsResponse
     [ReservedElasticsearchInstanceOffering]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ReservedElasticsearchInstanceOffering]
 -> Const
      (First [ReservedElasticsearchInstanceOffering])
      [ReservedElasticsearchInstanceOffering])
-> Maybe [ReservedElasticsearchInstanceOffering]
-> Const
     (First [ReservedElasticsearchInstanceOffering])
     (Maybe [ReservedElasticsearchInstanceOffering])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeReservedElasticsearchInstanceOfferings
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeReservedElasticsearchInstanceOfferings
-> Maybe DescribeReservedElasticsearchInstanceOfferings
forall a. a -> Maybe a
Prelude.Just (DescribeReservedElasticsearchInstanceOfferings
 -> Maybe DescribeReservedElasticsearchInstanceOfferings)
-> DescribeReservedElasticsearchInstanceOfferings
-> Maybe DescribeReservedElasticsearchInstanceOfferings
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeReservedElasticsearchInstanceOfferings
rq
          DescribeReservedElasticsearchInstanceOfferings
-> (DescribeReservedElasticsearchInstanceOfferings
    -> DescribeReservedElasticsearchInstanceOfferings)
-> DescribeReservedElasticsearchInstanceOfferings
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeReservedElasticsearchInstanceOfferings
-> Identity DescribeReservedElasticsearchInstanceOfferings
Lens
  DescribeReservedElasticsearchInstanceOfferings
  DescribeReservedElasticsearchInstanceOfferings
  (Maybe Text)
  (Maybe Text)
describeReservedElasticsearchInstanceOfferings_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeReservedElasticsearchInstanceOfferings
 -> Identity DescribeReservedElasticsearchInstanceOfferings)
-> Maybe Text
-> DescribeReservedElasticsearchInstanceOfferings
-> DescribeReservedElasticsearchInstanceOfferings
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeReservedElasticsearchInstanceOfferings
DescribeReservedElasticsearchInstanceOfferingsResponse
rs
            DescribeReservedElasticsearchInstanceOfferingsResponse
-> Getting
     (First Text)
     DescribeReservedElasticsearchInstanceOfferingsResponse
     Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeReservedElasticsearchInstanceOfferingsResponse
-> Const
     (First Text) DescribeReservedElasticsearchInstanceOfferingsResponse
Lens'
  DescribeReservedElasticsearchInstanceOfferingsResponse (Maybe Text)
describeReservedElasticsearchInstanceOfferingsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeReservedElasticsearchInstanceOfferingsResponse
 -> Const
      (First Text)
      DescribeReservedElasticsearchInstanceOfferingsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text)
     DescribeReservedElasticsearchInstanceOfferingsResponse
     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
    DescribeReservedElasticsearchInstanceOfferings
  where
  type
    AWSResponse
      DescribeReservedElasticsearchInstanceOfferings =
      DescribeReservedElasticsearchInstanceOfferingsResponse
  request :: DescribeReservedElasticsearchInstanceOfferings
-> Request DescribeReservedElasticsearchInstanceOfferings
request = Service
-> DescribeReservedElasticsearchInstanceOfferings
-> Request DescribeReservedElasticsearchInstanceOfferings
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeReservedElasticsearchInstanceOfferings
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse DescribeReservedElasticsearchInstanceOfferings)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either
      String
      (AWSResponse DescribeReservedElasticsearchInstanceOfferings))
-> Logger
-> Service
-> Proxy DescribeReservedElasticsearchInstanceOfferings
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse DescribeReservedElasticsearchInstanceOfferings)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe [ReservedElasticsearchInstanceOffering]
-> Maybe Text
-> Int
-> DescribeReservedElasticsearchInstanceOfferingsResponse
DescribeReservedElasticsearchInstanceOfferingsResponse'
            (Maybe [ReservedElasticsearchInstanceOffering]
 -> Maybe Text
 -> Int
 -> DescribeReservedElasticsearchInstanceOfferingsResponse)
-> Either String (Maybe [ReservedElasticsearchInstanceOffering])
-> Either
     String
     (Maybe Text
      -> Int -> DescribeReservedElasticsearchInstanceOfferingsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object
-> Text
-> Either
     String (Maybe (Maybe [ReservedElasticsearchInstanceOffering]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ReservedElasticsearchInstanceOfferings"
                            Either
  String (Maybe (Maybe [ReservedElasticsearchInstanceOffering]))
-> Maybe [ReservedElasticsearchInstanceOffering]
-> Either String (Maybe [ReservedElasticsearchInstanceOffering])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ReservedElasticsearchInstanceOffering]
forall a. Monoid a => a
Prelude.mempty
                        )
              Either
  String
  (Maybe Text
   -> Int -> DescribeReservedElasticsearchInstanceOfferingsResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Int -> DescribeReservedElasticsearchInstanceOfferingsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextToken")
              Either
  String
  (Int -> DescribeReservedElasticsearchInstanceOfferingsResponse)
-> Either String Int
-> Either
     String DescribeReservedElasticsearchInstanceOfferingsResponse
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
    DescribeReservedElasticsearchInstanceOfferings

instance
  Prelude.NFData
    DescribeReservedElasticsearchInstanceOfferings

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

instance
  Core.ToPath
    DescribeReservedElasticsearchInstanceOfferings
  where
  toPath :: DescribeReservedElasticsearchInstanceOfferings -> ByteString
toPath =
    ByteString
-> DescribeReservedElasticsearchInstanceOfferings -> ByteString
forall a b. a -> b -> a
Prelude.const
      ByteString
"/2015-01-01/es/reservedInstanceOfferings"

instance
  Core.ToQuery
    DescribeReservedElasticsearchInstanceOfferings
  where
  toQuery :: DescribeReservedElasticsearchInstanceOfferings -> QueryString
toQuery
    DescribeReservedElasticsearchInstanceOfferings' {Maybe Int
Maybe Text
maxResults :: Maybe Int
nextToken :: Maybe Text
reservedElasticsearchInstanceOfferingId :: Maybe Text
$sel:maxResults:DescribeReservedElasticsearchInstanceOfferings' :: DescribeReservedElasticsearchInstanceOfferings -> Maybe Int
$sel:nextToken:DescribeReservedElasticsearchInstanceOfferings' :: DescribeReservedElasticsearchInstanceOfferings -> Maybe Text
$sel:reservedElasticsearchInstanceOfferingId:DescribeReservedElasticsearchInstanceOfferings' :: DescribeReservedElasticsearchInstanceOfferings -> Maybe Text
..} =
      [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
        [ ByteString
"offeringId"
            ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
reservedElasticsearchInstanceOfferingId,
          ByteString
"nextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
          ByteString
"maxResults" ByteString -> Maybe Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Int
maxResults
        ]

-- | Container for results from
-- @DescribeReservedElasticsearchInstanceOfferings@
--
-- /See:/ 'newDescribeReservedElasticsearchInstanceOfferingsResponse' smart constructor.
data DescribeReservedElasticsearchInstanceOfferingsResponse = DescribeReservedElasticsearchInstanceOfferingsResponse'
  { -- | List of reserved Elasticsearch instance offerings
    DescribeReservedElasticsearchInstanceOfferingsResponse
-> Maybe [ReservedElasticsearchInstanceOffering]
reservedElasticsearchInstanceOfferings :: Prelude.Maybe [ReservedElasticsearchInstanceOffering],
    -- | Provides an identifier to allow retrieval of paginated results.
    DescribeReservedElasticsearchInstanceOfferingsResponse
-> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeReservedElasticsearchInstanceOfferingsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeReservedElasticsearchInstanceOfferingsResponse
-> DescribeReservedElasticsearchInstanceOfferingsResponse -> Bool
(DescribeReservedElasticsearchInstanceOfferingsResponse
 -> DescribeReservedElasticsearchInstanceOfferingsResponse -> Bool)
-> (DescribeReservedElasticsearchInstanceOfferingsResponse
    -> DescribeReservedElasticsearchInstanceOfferingsResponse -> Bool)
-> Eq DescribeReservedElasticsearchInstanceOfferingsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeReservedElasticsearchInstanceOfferingsResponse
-> DescribeReservedElasticsearchInstanceOfferingsResponse -> Bool
$c/= :: DescribeReservedElasticsearchInstanceOfferingsResponse
-> DescribeReservedElasticsearchInstanceOfferingsResponse -> Bool
== :: DescribeReservedElasticsearchInstanceOfferingsResponse
-> DescribeReservedElasticsearchInstanceOfferingsResponse -> Bool
$c== :: DescribeReservedElasticsearchInstanceOfferingsResponse
-> DescribeReservedElasticsearchInstanceOfferingsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeReservedElasticsearchInstanceOfferingsResponse]
ReadPrec DescribeReservedElasticsearchInstanceOfferingsResponse
Int -> ReadS DescribeReservedElasticsearchInstanceOfferingsResponse
ReadS [DescribeReservedElasticsearchInstanceOfferingsResponse]
(Int
 -> ReadS DescribeReservedElasticsearchInstanceOfferingsResponse)
-> ReadS [DescribeReservedElasticsearchInstanceOfferingsResponse]
-> ReadPrec DescribeReservedElasticsearchInstanceOfferingsResponse
-> ReadPrec
     [DescribeReservedElasticsearchInstanceOfferingsResponse]
-> Read DescribeReservedElasticsearchInstanceOfferingsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeReservedElasticsearchInstanceOfferingsResponse]
$creadListPrec :: ReadPrec [DescribeReservedElasticsearchInstanceOfferingsResponse]
readPrec :: ReadPrec DescribeReservedElasticsearchInstanceOfferingsResponse
$creadPrec :: ReadPrec DescribeReservedElasticsearchInstanceOfferingsResponse
readList :: ReadS [DescribeReservedElasticsearchInstanceOfferingsResponse]
$creadList :: ReadS [DescribeReservedElasticsearchInstanceOfferingsResponse]
readsPrec :: Int -> ReadS DescribeReservedElasticsearchInstanceOfferingsResponse
$creadsPrec :: Int -> ReadS DescribeReservedElasticsearchInstanceOfferingsResponse
Prelude.Read, Int
-> DescribeReservedElasticsearchInstanceOfferingsResponse -> ShowS
[DescribeReservedElasticsearchInstanceOfferingsResponse] -> ShowS
DescribeReservedElasticsearchInstanceOfferingsResponse -> String
(Int
 -> DescribeReservedElasticsearchInstanceOfferingsResponse -> ShowS)
-> (DescribeReservedElasticsearchInstanceOfferingsResponse
    -> String)
-> ([DescribeReservedElasticsearchInstanceOfferingsResponse]
    -> ShowS)
-> Show DescribeReservedElasticsearchInstanceOfferingsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeReservedElasticsearchInstanceOfferingsResponse] -> ShowS
$cshowList :: [DescribeReservedElasticsearchInstanceOfferingsResponse] -> ShowS
show :: DescribeReservedElasticsearchInstanceOfferingsResponse -> String
$cshow :: DescribeReservedElasticsearchInstanceOfferingsResponse -> String
showsPrec :: Int
-> DescribeReservedElasticsearchInstanceOfferingsResponse -> ShowS
$cshowsPrec :: Int
-> DescribeReservedElasticsearchInstanceOfferingsResponse -> ShowS
Prelude.Show, (forall x.
 DescribeReservedElasticsearchInstanceOfferingsResponse
 -> Rep DescribeReservedElasticsearchInstanceOfferingsResponse x)
-> (forall x.
    Rep DescribeReservedElasticsearchInstanceOfferingsResponse x
    -> DescribeReservedElasticsearchInstanceOfferingsResponse)
-> Generic DescribeReservedElasticsearchInstanceOfferingsResponse
forall x.
Rep DescribeReservedElasticsearchInstanceOfferingsResponse x
-> DescribeReservedElasticsearchInstanceOfferingsResponse
forall x.
DescribeReservedElasticsearchInstanceOfferingsResponse
-> Rep DescribeReservedElasticsearchInstanceOfferingsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeReservedElasticsearchInstanceOfferingsResponse x
-> DescribeReservedElasticsearchInstanceOfferingsResponse
$cfrom :: forall x.
DescribeReservedElasticsearchInstanceOfferingsResponse
-> Rep DescribeReservedElasticsearchInstanceOfferingsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeReservedElasticsearchInstanceOfferingsResponse' 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:
--
-- 'reservedElasticsearchInstanceOfferings', 'describeReservedElasticsearchInstanceOfferingsResponse_reservedElasticsearchInstanceOfferings' - List of reserved Elasticsearch instance offerings
--
-- 'nextToken', 'describeReservedElasticsearchInstanceOfferingsResponse_nextToken' - Provides an identifier to allow retrieval of paginated results.
--
-- 'httpStatus', 'describeReservedElasticsearchInstanceOfferingsResponse_httpStatus' - The response's http status code.
newDescribeReservedElasticsearchInstanceOfferingsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeReservedElasticsearchInstanceOfferingsResponse
newDescribeReservedElasticsearchInstanceOfferingsResponse :: Int -> DescribeReservedElasticsearchInstanceOfferingsResponse
newDescribeReservedElasticsearchInstanceOfferingsResponse
  Int
pHttpStatus_ =
    DescribeReservedElasticsearchInstanceOfferingsResponse' :: Maybe [ReservedElasticsearchInstanceOffering]
-> Maybe Text
-> Int
-> DescribeReservedElasticsearchInstanceOfferingsResponse
DescribeReservedElasticsearchInstanceOfferingsResponse'
      { $sel:reservedElasticsearchInstanceOfferings:DescribeReservedElasticsearchInstanceOfferingsResponse' :: Maybe [ReservedElasticsearchInstanceOffering]
reservedElasticsearchInstanceOfferings =
          Maybe [ReservedElasticsearchInstanceOffering]
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:DescribeReservedElasticsearchInstanceOfferingsResponse' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:DescribeReservedElasticsearchInstanceOfferingsResponse' :: Int
httpStatus =
          Int
pHttpStatus_
      }

-- | List of reserved Elasticsearch instance offerings
describeReservedElasticsearchInstanceOfferingsResponse_reservedElasticsearchInstanceOfferings :: Lens.Lens' DescribeReservedElasticsearchInstanceOfferingsResponse (Prelude.Maybe [ReservedElasticsearchInstanceOffering])
describeReservedElasticsearchInstanceOfferingsResponse_reservedElasticsearchInstanceOfferings :: (Maybe [ReservedElasticsearchInstanceOffering]
 -> f (Maybe [ReservedElasticsearchInstanceOffering]))
-> DescribeReservedElasticsearchInstanceOfferingsResponse
-> f DescribeReservedElasticsearchInstanceOfferingsResponse
describeReservedElasticsearchInstanceOfferingsResponse_reservedElasticsearchInstanceOfferings = (DescribeReservedElasticsearchInstanceOfferingsResponse
 -> Maybe [ReservedElasticsearchInstanceOffering])
-> (DescribeReservedElasticsearchInstanceOfferingsResponse
    -> Maybe [ReservedElasticsearchInstanceOffering]
    -> DescribeReservedElasticsearchInstanceOfferingsResponse)
-> Lens'
     DescribeReservedElasticsearchInstanceOfferingsResponse
     (Maybe [ReservedElasticsearchInstanceOffering])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReservedElasticsearchInstanceOfferingsResponse' {Maybe [ReservedElasticsearchInstanceOffering]
reservedElasticsearchInstanceOfferings :: Maybe [ReservedElasticsearchInstanceOffering]
$sel:reservedElasticsearchInstanceOfferings:DescribeReservedElasticsearchInstanceOfferingsResponse' :: DescribeReservedElasticsearchInstanceOfferingsResponse
-> Maybe [ReservedElasticsearchInstanceOffering]
reservedElasticsearchInstanceOfferings} -> Maybe [ReservedElasticsearchInstanceOffering]
reservedElasticsearchInstanceOfferings) (\s :: DescribeReservedElasticsearchInstanceOfferingsResponse
s@DescribeReservedElasticsearchInstanceOfferingsResponse' {} Maybe [ReservedElasticsearchInstanceOffering]
a -> DescribeReservedElasticsearchInstanceOfferingsResponse
s {$sel:reservedElasticsearchInstanceOfferings:DescribeReservedElasticsearchInstanceOfferingsResponse' :: Maybe [ReservedElasticsearchInstanceOffering]
reservedElasticsearchInstanceOfferings = Maybe [ReservedElasticsearchInstanceOffering]
a} :: DescribeReservedElasticsearchInstanceOfferingsResponse) ((Maybe [ReservedElasticsearchInstanceOffering]
  -> f (Maybe [ReservedElasticsearchInstanceOffering]))
 -> DescribeReservedElasticsearchInstanceOfferingsResponse
 -> f DescribeReservedElasticsearchInstanceOfferingsResponse)
-> ((Maybe [ReservedElasticsearchInstanceOffering]
     -> f (Maybe [ReservedElasticsearchInstanceOffering]))
    -> Maybe [ReservedElasticsearchInstanceOffering]
    -> f (Maybe [ReservedElasticsearchInstanceOffering]))
-> (Maybe [ReservedElasticsearchInstanceOffering]
    -> f (Maybe [ReservedElasticsearchInstanceOffering]))
-> DescribeReservedElasticsearchInstanceOfferingsResponse
-> f DescribeReservedElasticsearchInstanceOfferingsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ReservedElasticsearchInstanceOffering]
  [ReservedElasticsearchInstanceOffering]
  [ReservedElasticsearchInstanceOffering]
  [ReservedElasticsearchInstanceOffering]
-> Iso
     (Maybe [ReservedElasticsearchInstanceOffering])
     (Maybe [ReservedElasticsearchInstanceOffering])
     (Maybe [ReservedElasticsearchInstanceOffering])
     (Maybe [ReservedElasticsearchInstanceOffering])
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
  [ReservedElasticsearchInstanceOffering]
  [ReservedElasticsearchInstanceOffering]
  [ReservedElasticsearchInstanceOffering]
  [ReservedElasticsearchInstanceOffering]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Provides an identifier to allow retrieval of paginated results.
describeReservedElasticsearchInstanceOfferingsResponse_nextToken :: Lens.Lens' DescribeReservedElasticsearchInstanceOfferingsResponse (Prelude.Maybe Prelude.Text)
describeReservedElasticsearchInstanceOfferingsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeReservedElasticsearchInstanceOfferingsResponse
-> f DescribeReservedElasticsearchInstanceOfferingsResponse
describeReservedElasticsearchInstanceOfferingsResponse_nextToken = (DescribeReservedElasticsearchInstanceOfferingsResponse
 -> Maybe Text)
-> (DescribeReservedElasticsearchInstanceOfferingsResponse
    -> Maybe Text
    -> DescribeReservedElasticsearchInstanceOfferingsResponse)
-> Lens'
     DescribeReservedElasticsearchInstanceOfferingsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReservedElasticsearchInstanceOfferingsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeReservedElasticsearchInstanceOfferingsResponse' :: DescribeReservedElasticsearchInstanceOfferingsResponse
-> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeReservedElasticsearchInstanceOfferingsResponse
s@DescribeReservedElasticsearchInstanceOfferingsResponse' {} Maybe Text
a -> DescribeReservedElasticsearchInstanceOfferingsResponse
s {$sel:nextToken:DescribeReservedElasticsearchInstanceOfferingsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeReservedElasticsearchInstanceOfferingsResponse)

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

instance
  Prelude.NFData
    DescribeReservedElasticsearchInstanceOfferingsResponse