{-# 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.DescribeReservedElasticsearchInstances
-- 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 information about reserved Elasticsearch instances for this
-- account.
--
-- This operation returns paginated results.
module Amazonka.ElasticSearch.DescribeReservedElasticsearchInstances
  ( -- * Creating a Request
    DescribeReservedElasticsearchInstances (..),
    newDescribeReservedElasticsearchInstances,

    -- * Request Lenses
    describeReservedElasticsearchInstances_reservedElasticsearchInstanceId,
    describeReservedElasticsearchInstances_nextToken,
    describeReservedElasticsearchInstances_maxResults,

    -- * Destructuring the Response
    DescribeReservedElasticsearchInstancesResponse (..),
    newDescribeReservedElasticsearchInstancesResponse,

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

-- |
-- Create a value of 'DescribeReservedElasticsearchInstances' 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:
--
-- 'reservedElasticsearchInstanceId', 'describeReservedElasticsearchInstances_reservedElasticsearchInstanceId' - The reserved instance identifier filter value. Use this parameter to
-- show only the reservation that matches the specified reserved
-- Elasticsearch instance ID.
--
-- 'nextToken', 'describeReservedElasticsearchInstances_nextToken' - NextToken should be sent in case if earlier API call produced result
-- containing NextToken. It is used for pagination.
--
-- 'maxResults', 'describeReservedElasticsearchInstances_maxResults' - Set this value to limit the number of results returned. If not
-- specified, defaults to 100.
newDescribeReservedElasticsearchInstances ::
  DescribeReservedElasticsearchInstances
newDescribeReservedElasticsearchInstances :: DescribeReservedElasticsearchInstances
newDescribeReservedElasticsearchInstances =
  DescribeReservedElasticsearchInstances' :: Maybe Text
-> Maybe Text
-> Maybe Int
-> DescribeReservedElasticsearchInstances
DescribeReservedElasticsearchInstances'
    { $sel:reservedElasticsearchInstanceId:DescribeReservedElasticsearchInstances' :: Maybe Text
reservedElasticsearchInstanceId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeReservedElasticsearchInstances' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeReservedElasticsearchInstances' :: Maybe Int
maxResults = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The reserved instance identifier filter value. Use this parameter to
-- show only the reservation that matches the specified reserved
-- Elasticsearch instance ID.
describeReservedElasticsearchInstances_reservedElasticsearchInstanceId :: Lens.Lens' DescribeReservedElasticsearchInstances (Prelude.Maybe Prelude.Text)
describeReservedElasticsearchInstances_reservedElasticsearchInstanceId :: (Maybe Text -> f (Maybe Text))
-> DescribeReservedElasticsearchInstances
-> f DescribeReservedElasticsearchInstances
describeReservedElasticsearchInstances_reservedElasticsearchInstanceId = (DescribeReservedElasticsearchInstances -> Maybe Text)
-> (DescribeReservedElasticsearchInstances
    -> Maybe Text -> DescribeReservedElasticsearchInstances)
-> Lens
     DescribeReservedElasticsearchInstances
     DescribeReservedElasticsearchInstances
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReservedElasticsearchInstances' {Maybe Text
reservedElasticsearchInstanceId :: Maybe Text
$sel:reservedElasticsearchInstanceId:DescribeReservedElasticsearchInstances' :: DescribeReservedElasticsearchInstances -> Maybe Text
reservedElasticsearchInstanceId} -> Maybe Text
reservedElasticsearchInstanceId) (\s :: DescribeReservedElasticsearchInstances
s@DescribeReservedElasticsearchInstances' {} Maybe Text
a -> DescribeReservedElasticsearchInstances
s {$sel:reservedElasticsearchInstanceId:DescribeReservedElasticsearchInstances' :: Maybe Text
reservedElasticsearchInstanceId = Maybe Text
a} :: DescribeReservedElasticsearchInstances)

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

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

instance
  Core.AWSPager
    DescribeReservedElasticsearchInstances
  where
  page :: DescribeReservedElasticsearchInstances
-> AWSResponse DescribeReservedElasticsearchInstances
-> Maybe DescribeReservedElasticsearchInstances
page DescribeReservedElasticsearchInstances
rq AWSResponse DescribeReservedElasticsearchInstances
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeReservedElasticsearchInstances
DescribeReservedElasticsearchInstancesResponse
rs
            DescribeReservedElasticsearchInstancesResponse
-> Getting
     (First Text) DescribeReservedElasticsearchInstancesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeReservedElasticsearchInstancesResponse
-> Const
     (First Text) DescribeReservedElasticsearchInstancesResponse
Lens' DescribeReservedElasticsearchInstancesResponse (Maybe Text)
describeReservedElasticsearchInstancesResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeReservedElasticsearchInstancesResponse
 -> Const
      (First Text) DescribeReservedElasticsearchInstancesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text) DescribeReservedElasticsearchInstancesResponse 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 DescribeReservedElasticsearchInstances
forall a. Maybe a
Prelude.Nothing
    | Maybe [ReservedElasticsearchInstance] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeReservedElasticsearchInstances
DescribeReservedElasticsearchInstancesResponse
rs
            DescribeReservedElasticsearchInstancesResponse
-> Getting
     (First [ReservedElasticsearchInstance])
     DescribeReservedElasticsearchInstancesResponse
     [ReservedElasticsearchInstance]
-> Maybe [ReservedElasticsearchInstance]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [ReservedElasticsearchInstance]
 -> Const
      (First [ReservedElasticsearchInstance])
      (Maybe [ReservedElasticsearchInstance]))
-> DescribeReservedElasticsearchInstancesResponse
-> Const
     (First [ReservedElasticsearchInstance])
     DescribeReservedElasticsearchInstancesResponse
Lens'
  DescribeReservedElasticsearchInstancesResponse
  (Maybe [ReservedElasticsearchInstance])
describeReservedElasticsearchInstancesResponse_reservedElasticsearchInstances
              ((Maybe [ReservedElasticsearchInstance]
  -> Const
       (First [ReservedElasticsearchInstance])
       (Maybe [ReservedElasticsearchInstance]))
 -> DescribeReservedElasticsearchInstancesResponse
 -> Const
      (First [ReservedElasticsearchInstance])
      DescribeReservedElasticsearchInstancesResponse)
-> (([ReservedElasticsearchInstance]
     -> Const
          (First [ReservedElasticsearchInstance])
          [ReservedElasticsearchInstance])
    -> Maybe [ReservedElasticsearchInstance]
    -> Const
         (First [ReservedElasticsearchInstance])
         (Maybe [ReservedElasticsearchInstance]))
-> Getting
     (First [ReservedElasticsearchInstance])
     DescribeReservedElasticsearchInstancesResponse
     [ReservedElasticsearchInstance]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ReservedElasticsearchInstance]
 -> Const
      (First [ReservedElasticsearchInstance])
      [ReservedElasticsearchInstance])
-> Maybe [ReservedElasticsearchInstance]
-> Const
     (First [ReservedElasticsearchInstance])
     (Maybe [ReservedElasticsearchInstance])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeReservedElasticsearchInstances
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeReservedElasticsearchInstances
-> Maybe DescribeReservedElasticsearchInstances
forall a. a -> Maybe a
Prelude.Just (DescribeReservedElasticsearchInstances
 -> Maybe DescribeReservedElasticsearchInstances)
-> DescribeReservedElasticsearchInstances
-> Maybe DescribeReservedElasticsearchInstances
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeReservedElasticsearchInstances
rq
          DescribeReservedElasticsearchInstances
-> (DescribeReservedElasticsearchInstances
    -> DescribeReservedElasticsearchInstances)
-> DescribeReservedElasticsearchInstances
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeReservedElasticsearchInstances
-> Identity DescribeReservedElasticsearchInstances
Lens
  DescribeReservedElasticsearchInstances
  DescribeReservedElasticsearchInstances
  (Maybe Text)
  (Maybe Text)
describeReservedElasticsearchInstances_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeReservedElasticsearchInstances
 -> Identity DescribeReservedElasticsearchInstances)
-> Maybe Text
-> DescribeReservedElasticsearchInstances
-> DescribeReservedElasticsearchInstances
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeReservedElasticsearchInstances
DescribeReservedElasticsearchInstancesResponse
rs
            DescribeReservedElasticsearchInstancesResponse
-> Getting
     (First Text) DescribeReservedElasticsearchInstancesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeReservedElasticsearchInstancesResponse
-> Const
     (First Text) DescribeReservedElasticsearchInstancesResponse
Lens' DescribeReservedElasticsearchInstancesResponse (Maybe Text)
describeReservedElasticsearchInstancesResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeReservedElasticsearchInstancesResponse
 -> Const
      (First Text) DescribeReservedElasticsearchInstancesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text) DescribeReservedElasticsearchInstancesResponse 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
    DescribeReservedElasticsearchInstances
  where
  type
    AWSResponse
      DescribeReservedElasticsearchInstances =
      DescribeReservedElasticsearchInstancesResponse
  request :: DescribeReservedElasticsearchInstances
-> Request DescribeReservedElasticsearchInstances
request = Service
-> DescribeReservedElasticsearchInstances
-> Request DescribeReservedElasticsearchInstances
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeReservedElasticsearchInstances
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse DescribeReservedElasticsearchInstances)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either
      String (AWSResponse DescribeReservedElasticsearchInstances))
-> Logger
-> Service
-> Proxy DescribeReservedElasticsearchInstances
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse DescribeReservedElasticsearchInstances)))
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 [ReservedElasticsearchInstance]
-> Maybe Text
-> Int
-> DescribeReservedElasticsearchInstancesResponse
DescribeReservedElasticsearchInstancesResponse'
            (Maybe [ReservedElasticsearchInstance]
 -> Maybe Text
 -> Int
 -> DescribeReservedElasticsearchInstancesResponse)
-> Either String (Maybe [ReservedElasticsearchInstance])
-> Either
     String
     (Maybe Text
      -> Int -> DescribeReservedElasticsearchInstancesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object
-> Text
-> Either String (Maybe (Maybe [ReservedElasticsearchInstance]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ReservedElasticsearchInstances"
                            Either String (Maybe (Maybe [ReservedElasticsearchInstance]))
-> Maybe [ReservedElasticsearchInstance]
-> Either String (Maybe [ReservedElasticsearchInstance])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ReservedElasticsearchInstance]
forall a. Monoid a => a
Prelude.mempty
                        )
              Either
  String
  (Maybe Text
   -> Int -> DescribeReservedElasticsearchInstancesResponse)
-> Either String (Maybe Text)
-> Either
     String (Int -> DescribeReservedElasticsearchInstancesResponse)
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 -> DescribeReservedElasticsearchInstancesResponse)
-> Either String Int
-> Either String DescribeReservedElasticsearchInstancesResponse
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
    DescribeReservedElasticsearchInstances

instance
  Prelude.NFData
    DescribeReservedElasticsearchInstances

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

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

instance
  Core.ToQuery
    DescribeReservedElasticsearchInstances
  where
  toQuery :: DescribeReservedElasticsearchInstances -> QueryString
toQuery DescribeReservedElasticsearchInstances' {Maybe Int
Maybe Text
maxResults :: Maybe Int
nextToken :: Maybe Text
reservedElasticsearchInstanceId :: Maybe Text
$sel:maxResults:DescribeReservedElasticsearchInstances' :: DescribeReservedElasticsearchInstances -> Maybe Int
$sel:nextToken:DescribeReservedElasticsearchInstances' :: DescribeReservedElasticsearchInstances -> Maybe Text
$sel:reservedElasticsearchInstanceId:DescribeReservedElasticsearchInstances' :: DescribeReservedElasticsearchInstances -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"reservationId"
          ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
reservedElasticsearchInstanceId,
        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 @DescribeReservedElasticsearchInstances@
--
-- /See:/ 'newDescribeReservedElasticsearchInstancesResponse' smart constructor.
data DescribeReservedElasticsearchInstancesResponse = DescribeReservedElasticsearchInstancesResponse'
  { -- | List of reserved Elasticsearch instances.
    DescribeReservedElasticsearchInstancesResponse
-> Maybe [ReservedElasticsearchInstance]
reservedElasticsearchInstances :: Prelude.Maybe [ReservedElasticsearchInstance],
    -- | Provides an identifier to allow retrieval of paginated results.
    DescribeReservedElasticsearchInstancesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeReservedElasticsearchInstancesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeReservedElasticsearchInstancesResponse
-> DescribeReservedElasticsearchInstancesResponse -> Bool
(DescribeReservedElasticsearchInstancesResponse
 -> DescribeReservedElasticsearchInstancesResponse -> Bool)
-> (DescribeReservedElasticsearchInstancesResponse
    -> DescribeReservedElasticsearchInstancesResponse -> Bool)
-> Eq DescribeReservedElasticsearchInstancesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeReservedElasticsearchInstancesResponse
-> DescribeReservedElasticsearchInstancesResponse -> Bool
$c/= :: DescribeReservedElasticsearchInstancesResponse
-> DescribeReservedElasticsearchInstancesResponse -> Bool
== :: DescribeReservedElasticsearchInstancesResponse
-> DescribeReservedElasticsearchInstancesResponse -> Bool
$c== :: DescribeReservedElasticsearchInstancesResponse
-> DescribeReservedElasticsearchInstancesResponse -> Bool
Prelude.Eq, ReadPrec [DescribeReservedElasticsearchInstancesResponse]
ReadPrec DescribeReservedElasticsearchInstancesResponse
Int -> ReadS DescribeReservedElasticsearchInstancesResponse
ReadS [DescribeReservedElasticsearchInstancesResponse]
(Int -> ReadS DescribeReservedElasticsearchInstancesResponse)
-> ReadS [DescribeReservedElasticsearchInstancesResponse]
-> ReadPrec DescribeReservedElasticsearchInstancesResponse
-> ReadPrec [DescribeReservedElasticsearchInstancesResponse]
-> Read DescribeReservedElasticsearchInstancesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeReservedElasticsearchInstancesResponse]
$creadListPrec :: ReadPrec [DescribeReservedElasticsearchInstancesResponse]
readPrec :: ReadPrec DescribeReservedElasticsearchInstancesResponse
$creadPrec :: ReadPrec DescribeReservedElasticsearchInstancesResponse
readList :: ReadS [DescribeReservedElasticsearchInstancesResponse]
$creadList :: ReadS [DescribeReservedElasticsearchInstancesResponse]
readsPrec :: Int -> ReadS DescribeReservedElasticsearchInstancesResponse
$creadsPrec :: Int -> ReadS DescribeReservedElasticsearchInstancesResponse
Prelude.Read, Int -> DescribeReservedElasticsearchInstancesResponse -> ShowS
[DescribeReservedElasticsearchInstancesResponse] -> ShowS
DescribeReservedElasticsearchInstancesResponse -> String
(Int -> DescribeReservedElasticsearchInstancesResponse -> ShowS)
-> (DescribeReservedElasticsearchInstancesResponse -> String)
-> ([DescribeReservedElasticsearchInstancesResponse] -> ShowS)
-> Show DescribeReservedElasticsearchInstancesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeReservedElasticsearchInstancesResponse] -> ShowS
$cshowList :: [DescribeReservedElasticsearchInstancesResponse] -> ShowS
show :: DescribeReservedElasticsearchInstancesResponse -> String
$cshow :: DescribeReservedElasticsearchInstancesResponse -> String
showsPrec :: Int -> DescribeReservedElasticsearchInstancesResponse -> ShowS
$cshowsPrec :: Int -> DescribeReservedElasticsearchInstancesResponse -> ShowS
Prelude.Show, (forall x.
 DescribeReservedElasticsearchInstancesResponse
 -> Rep DescribeReservedElasticsearchInstancesResponse x)
-> (forall x.
    Rep DescribeReservedElasticsearchInstancesResponse x
    -> DescribeReservedElasticsearchInstancesResponse)
-> Generic DescribeReservedElasticsearchInstancesResponse
forall x.
Rep DescribeReservedElasticsearchInstancesResponse x
-> DescribeReservedElasticsearchInstancesResponse
forall x.
DescribeReservedElasticsearchInstancesResponse
-> Rep DescribeReservedElasticsearchInstancesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeReservedElasticsearchInstancesResponse x
-> DescribeReservedElasticsearchInstancesResponse
$cfrom :: forall x.
DescribeReservedElasticsearchInstancesResponse
-> Rep DescribeReservedElasticsearchInstancesResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeReservedElasticsearchInstancesResponse' 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:
--
-- 'reservedElasticsearchInstances', 'describeReservedElasticsearchInstancesResponse_reservedElasticsearchInstances' - List of reserved Elasticsearch instances.
--
-- 'nextToken', 'describeReservedElasticsearchInstancesResponse_nextToken' - Provides an identifier to allow retrieval of paginated results.
--
-- 'httpStatus', 'describeReservedElasticsearchInstancesResponse_httpStatus' - The response's http status code.
newDescribeReservedElasticsearchInstancesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeReservedElasticsearchInstancesResponse
newDescribeReservedElasticsearchInstancesResponse :: Int -> DescribeReservedElasticsearchInstancesResponse
newDescribeReservedElasticsearchInstancesResponse
  Int
pHttpStatus_ =
    DescribeReservedElasticsearchInstancesResponse' :: Maybe [ReservedElasticsearchInstance]
-> Maybe Text
-> Int
-> DescribeReservedElasticsearchInstancesResponse
DescribeReservedElasticsearchInstancesResponse'
      { $sel:reservedElasticsearchInstances:DescribeReservedElasticsearchInstancesResponse' :: Maybe [ReservedElasticsearchInstance]
reservedElasticsearchInstances =
          Maybe [ReservedElasticsearchInstance]
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:DescribeReservedElasticsearchInstancesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:DescribeReservedElasticsearchInstancesResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | List of reserved Elasticsearch instances.
describeReservedElasticsearchInstancesResponse_reservedElasticsearchInstances :: Lens.Lens' DescribeReservedElasticsearchInstancesResponse (Prelude.Maybe [ReservedElasticsearchInstance])
describeReservedElasticsearchInstancesResponse_reservedElasticsearchInstances :: (Maybe [ReservedElasticsearchInstance]
 -> f (Maybe [ReservedElasticsearchInstance]))
-> DescribeReservedElasticsearchInstancesResponse
-> f DescribeReservedElasticsearchInstancesResponse
describeReservedElasticsearchInstancesResponse_reservedElasticsearchInstances = (DescribeReservedElasticsearchInstancesResponse
 -> Maybe [ReservedElasticsearchInstance])
-> (DescribeReservedElasticsearchInstancesResponse
    -> Maybe [ReservedElasticsearchInstance]
    -> DescribeReservedElasticsearchInstancesResponse)
-> Lens'
     DescribeReservedElasticsearchInstancesResponse
     (Maybe [ReservedElasticsearchInstance])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReservedElasticsearchInstancesResponse' {Maybe [ReservedElasticsearchInstance]
reservedElasticsearchInstances :: Maybe [ReservedElasticsearchInstance]
$sel:reservedElasticsearchInstances:DescribeReservedElasticsearchInstancesResponse' :: DescribeReservedElasticsearchInstancesResponse
-> Maybe [ReservedElasticsearchInstance]
reservedElasticsearchInstances} -> Maybe [ReservedElasticsearchInstance]
reservedElasticsearchInstances) (\s :: DescribeReservedElasticsearchInstancesResponse
s@DescribeReservedElasticsearchInstancesResponse' {} Maybe [ReservedElasticsearchInstance]
a -> DescribeReservedElasticsearchInstancesResponse
s {$sel:reservedElasticsearchInstances:DescribeReservedElasticsearchInstancesResponse' :: Maybe [ReservedElasticsearchInstance]
reservedElasticsearchInstances = Maybe [ReservedElasticsearchInstance]
a} :: DescribeReservedElasticsearchInstancesResponse) ((Maybe [ReservedElasticsearchInstance]
  -> f (Maybe [ReservedElasticsearchInstance]))
 -> DescribeReservedElasticsearchInstancesResponse
 -> f DescribeReservedElasticsearchInstancesResponse)
-> ((Maybe [ReservedElasticsearchInstance]
     -> f (Maybe [ReservedElasticsearchInstance]))
    -> Maybe [ReservedElasticsearchInstance]
    -> f (Maybe [ReservedElasticsearchInstance]))
-> (Maybe [ReservedElasticsearchInstance]
    -> f (Maybe [ReservedElasticsearchInstance]))
-> DescribeReservedElasticsearchInstancesResponse
-> f DescribeReservedElasticsearchInstancesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ReservedElasticsearchInstance]
  [ReservedElasticsearchInstance]
  [ReservedElasticsearchInstance]
  [ReservedElasticsearchInstance]
-> Iso
     (Maybe [ReservedElasticsearchInstance])
     (Maybe [ReservedElasticsearchInstance])
     (Maybe [ReservedElasticsearchInstance])
     (Maybe [ReservedElasticsearchInstance])
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
  [ReservedElasticsearchInstance]
  [ReservedElasticsearchInstance]
  [ReservedElasticsearchInstance]
  [ReservedElasticsearchInstance]
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.
describeReservedElasticsearchInstancesResponse_nextToken :: Lens.Lens' DescribeReservedElasticsearchInstancesResponse (Prelude.Maybe Prelude.Text)
describeReservedElasticsearchInstancesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeReservedElasticsearchInstancesResponse
-> f DescribeReservedElasticsearchInstancesResponse
describeReservedElasticsearchInstancesResponse_nextToken = (DescribeReservedElasticsearchInstancesResponse -> Maybe Text)
-> (DescribeReservedElasticsearchInstancesResponse
    -> Maybe Text -> DescribeReservedElasticsearchInstancesResponse)
-> Lens'
     DescribeReservedElasticsearchInstancesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReservedElasticsearchInstancesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeReservedElasticsearchInstancesResponse' :: DescribeReservedElasticsearchInstancesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeReservedElasticsearchInstancesResponse
s@DescribeReservedElasticsearchInstancesResponse' {} Maybe Text
a -> DescribeReservedElasticsearchInstancesResponse
s {$sel:nextToken:DescribeReservedElasticsearchInstancesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeReservedElasticsearchInstancesResponse)

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

instance
  Prelude.NFData
    DescribeReservedElasticsearchInstancesResponse