{-# 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.EMR.ListClusters
-- 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)
--
-- Provides the status of all clusters visible to this Amazon Web Services
-- account. Allows you to filter the list of clusters based on certain
-- criteria; for example, filtering by cluster creation date and time or by
-- status. This call returns a maximum of 50 clusters in unsorted order per
-- call, but returns a marker to track the paging of the cluster list
-- across multiple ListClusters calls.
--
-- This operation returns paginated results.
module Amazonka.EMR.ListClusters
  ( -- * Creating a Request
    ListClusters (..),
    newListClusters,

    -- * Request Lenses
    listClusters_createdAfter,
    listClusters_marker,
    listClusters_clusterStates,
    listClusters_createdBefore,

    -- * Destructuring the Response
    ListClustersResponse (..),
    newListClustersResponse,

    -- * Response Lenses
    listClustersResponse_marker,
    listClustersResponse_clusters,
    listClustersResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.EMR.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

-- | This input determines how the ListClusters action filters the list of
-- clusters that it returns.
--
-- /See:/ 'newListClusters' smart constructor.
data ListClusters = ListClusters'
  { -- | The creation date and time beginning value filter for listing clusters.
    ListClusters -> Maybe POSIX
createdAfter :: Prelude.Maybe Core.POSIX,
    -- | The pagination token that indicates the next set of results to retrieve.
    ListClusters -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The cluster state filters to apply when listing clusters. Clusters that
    -- change state while this action runs may be not be returned as expected
    -- in the list of clusters.
    ListClusters -> Maybe [ClusterState]
clusterStates :: Prelude.Maybe [ClusterState],
    -- | The creation date and time end value filter for listing clusters.
    ListClusters -> Maybe POSIX
createdBefore :: Prelude.Maybe Core.POSIX
  }
  deriving (ListClusters -> ListClusters -> Bool
(ListClusters -> ListClusters -> Bool)
-> (ListClusters -> ListClusters -> Bool) -> Eq ListClusters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListClusters -> ListClusters -> Bool
$c/= :: ListClusters -> ListClusters -> Bool
== :: ListClusters -> ListClusters -> Bool
$c== :: ListClusters -> ListClusters -> Bool
Prelude.Eq, ReadPrec [ListClusters]
ReadPrec ListClusters
Int -> ReadS ListClusters
ReadS [ListClusters]
(Int -> ReadS ListClusters)
-> ReadS [ListClusters]
-> ReadPrec ListClusters
-> ReadPrec [ListClusters]
-> Read ListClusters
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListClusters]
$creadListPrec :: ReadPrec [ListClusters]
readPrec :: ReadPrec ListClusters
$creadPrec :: ReadPrec ListClusters
readList :: ReadS [ListClusters]
$creadList :: ReadS [ListClusters]
readsPrec :: Int -> ReadS ListClusters
$creadsPrec :: Int -> ReadS ListClusters
Prelude.Read, Int -> ListClusters -> ShowS
[ListClusters] -> ShowS
ListClusters -> String
(Int -> ListClusters -> ShowS)
-> (ListClusters -> String)
-> ([ListClusters] -> ShowS)
-> Show ListClusters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListClusters] -> ShowS
$cshowList :: [ListClusters] -> ShowS
show :: ListClusters -> String
$cshow :: ListClusters -> String
showsPrec :: Int -> ListClusters -> ShowS
$cshowsPrec :: Int -> ListClusters -> ShowS
Prelude.Show, (forall x. ListClusters -> Rep ListClusters x)
-> (forall x. Rep ListClusters x -> ListClusters)
-> Generic ListClusters
forall x. Rep ListClusters x -> ListClusters
forall x. ListClusters -> Rep ListClusters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListClusters x -> ListClusters
$cfrom :: forall x. ListClusters -> Rep ListClusters x
Prelude.Generic)

-- |
-- Create a value of 'ListClusters' 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:
--
-- 'createdAfter', 'listClusters_createdAfter' - The creation date and time beginning value filter for listing clusters.
--
-- 'marker', 'listClusters_marker' - The pagination token that indicates the next set of results to retrieve.
--
-- 'clusterStates', 'listClusters_clusterStates' - The cluster state filters to apply when listing clusters. Clusters that
-- change state while this action runs may be not be returned as expected
-- in the list of clusters.
--
-- 'createdBefore', 'listClusters_createdBefore' - The creation date and time end value filter for listing clusters.
newListClusters ::
  ListClusters
newListClusters :: ListClusters
newListClusters =
  ListClusters' :: Maybe POSIX
-> Maybe Text
-> Maybe [ClusterState]
-> Maybe POSIX
-> ListClusters
ListClusters'
    { $sel:createdAfter:ListClusters' :: Maybe POSIX
createdAfter = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:ListClusters' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:clusterStates:ListClusters' :: Maybe [ClusterState]
clusterStates = Maybe [ClusterState]
forall a. Maybe a
Prelude.Nothing,
      $sel:createdBefore:ListClusters' :: Maybe POSIX
createdBefore = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The creation date and time beginning value filter for listing clusters.
listClusters_createdAfter :: Lens.Lens' ListClusters (Prelude.Maybe Prelude.UTCTime)
listClusters_createdAfter :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ListClusters -> f ListClusters
listClusters_createdAfter = (ListClusters -> Maybe POSIX)
-> (ListClusters -> Maybe POSIX -> ListClusters)
-> Lens ListClusters ListClusters (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListClusters' {Maybe POSIX
createdAfter :: Maybe POSIX
$sel:createdAfter:ListClusters' :: ListClusters -> Maybe POSIX
createdAfter} -> Maybe POSIX
createdAfter) (\s :: ListClusters
s@ListClusters' {} Maybe POSIX
a -> ListClusters
s {$sel:createdAfter:ListClusters' :: Maybe POSIX
createdAfter = Maybe POSIX
a} :: ListClusters) ((Maybe POSIX -> f (Maybe POSIX))
 -> ListClusters -> f ListClusters)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ListClusters
-> f ListClusters
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The pagination token that indicates the next set of results to retrieve.
listClusters_marker :: Lens.Lens' ListClusters (Prelude.Maybe Prelude.Text)
listClusters_marker :: (Maybe Text -> f (Maybe Text)) -> ListClusters -> f ListClusters
listClusters_marker = (ListClusters -> Maybe Text)
-> (ListClusters -> Maybe Text -> ListClusters)
-> Lens ListClusters ListClusters (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListClusters' {Maybe Text
marker :: Maybe Text
$sel:marker:ListClusters' :: ListClusters -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListClusters
s@ListClusters' {} Maybe Text
a -> ListClusters
s {$sel:marker:ListClusters' :: Maybe Text
marker = Maybe Text
a} :: ListClusters)

-- | The cluster state filters to apply when listing clusters. Clusters that
-- change state while this action runs may be not be returned as expected
-- in the list of clusters.
listClusters_clusterStates :: Lens.Lens' ListClusters (Prelude.Maybe [ClusterState])
listClusters_clusterStates :: (Maybe [ClusterState] -> f (Maybe [ClusterState]))
-> ListClusters -> f ListClusters
listClusters_clusterStates = (ListClusters -> Maybe [ClusterState])
-> (ListClusters -> Maybe [ClusterState] -> ListClusters)
-> Lens
     ListClusters
     ListClusters
     (Maybe [ClusterState])
     (Maybe [ClusterState])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListClusters' {Maybe [ClusterState]
clusterStates :: Maybe [ClusterState]
$sel:clusterStates:ListClusters' :: ListClusters -> Maybe [ClusterState]
clusterStates} -> Maybe [ClusterState]
clusterStates) (\s :: ListClusters
s@ListClusters' {} Maybe [ClusterState]
a -> ListClusters
s {$sel:clusterStates:ListClusters' :: Maybe [ClusterState]
clusterStates = Maybe [ClusterState]
a} :: ListClusters) ((Maybe [ClusterState] -> f (Maybe [ClusterState]))
 -> ListClusters -> f ListClusters)
-> ((Maybe [ClusterState] -> f (Maybe [ClusterState]))
    -> Maybe [ClusterState] -> f (Maybe [ClusterState]))
-> (Maybe [ClusterState] -> f (Maybe [ClusterState]))
-> ListClusters
-> f ListClusters
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [ClusterState] [ClusterState] [ClusterState] [ClusterState]
-> Iso
     (Maybe [ClusterState])
     (Maybe [ClusterState])
     (Maybe [ClusterState])
     (Maybe [ClusterState])
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 [ClusterState] [ClusterState] [ClusterState] [ClusterState]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The creation date and time end value filter for listing clusters.
listClusters_createdBefore :: Lens.Lens' ListClusters (Prelude.Maybe Prelude.UTCTime)
listClusters_createdBefore :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ListClusters -> f ListClusters
listClusters_createdBefore = (ListClusters -> Maybe POSIX)
-> (ListClusters -> Maybe POSIX -> ListClusters)
-> Lens ListClusters ListClusters (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListClusters' {Maybe POSIX
createdBefore :: Maybe POSIX
$sel:createdBefore:ListClusters' :: ListClusters -> Maybe POSIX
createdBefore} -> Maybe POSIX
createdBefore) (\s :: ListClusters
s@ListClusters' {} Maybe POSIX
a -> ListClusters
s {$sel:createdBefore:ListClusters' :: Maybe POSIX
createdBefore = Maybe POSIX
a} :: ListClusters) ((Maybe POSIX -> f (Maybe POSIX))
 -> ListClusters -> f ListClusters)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ListClusters
-> f ListClusters
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

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

instance Prelude.NFData ListClusters

instance Core.ToHeaders ListClusters where
  toHeaders :: ListClusters -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListClusters -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"ElasticMapReduce.ListClusters" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON ListClusters where
  toJSON :: ListClusters -> Value
toJSON ListClusters' {Maybe [ClusterState]
Maybe Text
Maybe POSIX
createdBefore :: Maybe POSIX
clusterStates :: Maybe [ClusterState]
marker :: Maybe Text
createdAfter :: Maybe POSIX
$sel:createdBefore:ListClusters' :: ListClusters -> Maybe POSIX
$sel:clusterStates:ListClusters' :: ListClusters -> Maybe [ClusterState]
$sel:marker:ListClusters' :: ListClusters -> Maybe Text
$sel:createdAfter:ListClusters' :: ListClusters -> Maybe POSIX
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"CreatedAfter" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
createdAfter,
            (Text
"Marker" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
marker,
            (Text
"ClusterStates" Text -> [ClusterState] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([ClusterState] -> Pair) -> Maybe [ClusterState] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [ClusterState]
clusterStates,
            (Text
"CreatedBefore" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
createdBefore
          ]
      )

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

instance Core.ToQuery ListClusters where
  toQuery :: ListClusters -> QueryString
toQuery = QueryString -> ListClusters -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | This contains a ClusterSummaryList with the cluster details; for
-- example, the cluster IDs, names, and status.
--
-- /See:/ 'newListClustersResponse' smart constructor.
data ListClustersResponse = ListClustersResponse'
  { -- | The pagination token that indicates the next set of results to retrieve.
    ListClustersResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The list of clusters for the account based on the given filters.
    ListClustersResponse -> Maybe [ClusterSummary]
clusters :: Prelude.Maybe [ClusterSummary],
    -- | The response's http status code.
    ListClustersResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListClustersResponse -> ListClustersResponse -> Bool
(ListClustersResponse -> ListClustersResponse -> Bool)
-> (ListClustersResponse -> ListClustersResponse -> Bool)
-> Eq ListClustersResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListClustersResponse -> ListClustersResponse -> Bool
$c/= :: ListClustersResponse -> ListClustersResponse -> Bool
== :: ListClustersResponse -> ListClustersResponse -> Bool
$c== :: ListClustersResponse -> ListClustersResponse -> Bool
Prelude.Eq, ReadPrec [ListClustersResponse]
ReadPrec ListClustersResponse
Int -> ReadS ListClustersResponse
ReadS [ListClustersResponse]
(Int -> ReadS ListClustersResponse)
-> ReadS [ListClustersResponse]
-> ReadPrec ListClustersResponse
-> ReadPrec [ListClustersResponse]
-> Read ListClustersResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListClustersResponse]
$creadListPrec :: ReadPrec [ListClustersResponse]
readPrec :: ReadPrec ListClustersResponse
$creadPrec :: ReadPrec ListClustersResponse
readList :: ReadS [ListClustersResponse]
$creadList :: ReadS [ListClustersResponse]
readsPrec :: Int -> ReadS ListClustersResponse
$creadsPrec :: Int -> ReadS ListClustersResponse
Prelude.Read, Int -> ListClustersResponse -> ShowS
[ListClustersResponse] -> ShowS
ListClustersResponse -> String
(Int -> ListClustersResponse -> ShowS)
-> (ListClustersResponse -> String)
-> ([ListClustersResponse] -> ShowS)
-> Show ListClustersResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListClustersResponse] -> ShowS
$cshowList :: [ListClustersResponse] -> ShowS
show :: ListClustersResponse -> String
$cshow :: ListClustersResponse -> String
showsPrec :: Int -> ListClustersResponse -> ShowS
$cshowsPrec :: Int -> ListClustersResponse -> ShowS
Prelude.Show, (forall x. ListClustersResponse -> Rep ListClustersResponse x)
-> (forall x. Rep ListClustersResponse x -> ListClustersResponse)
-> Generic ListClustersResponse
forall x. Rep ListClustersResponse x -> ListClustersResponse
forall x. ListClustersResponse -> Rep ListClustersResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListClustersResponse x -> ListClustersResponse
$cfrom :: forall x. ListClustersResponse -> Rep ListClustersResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListClustersResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'marker', 'listClustersResponse_marker' - The pagination token that indicates the next set of results to retrieve.
--
-- 'clusters', 'listClustersResponse_clusters' - The list of clusters for the account based on the given filters.
--
-- 'httpStatus', 'listClustersResponse_httpStatus' - The response's http status code.
newListClustersResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListClustersResponse
newListClustersResponse :: Int -> ListClustersResponse
newListClustersResponse Int
pHttpStatus_ =
  ListClustersResponse' :: Maybe Text -> Maybe [ClusterSummary] -> Int -> ListClustersResponse
ListClustersResponse'
    { $sel:marker:ListClustersResponse' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:clusters:ListClustersResponse' :: Maybe [ClusterSummary]
clusters = Maybe [ClusterSummary]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListClustersResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The pagination token that indicates the next set of results to retrieve.
listClustersResponse_marker :: Lens.Lens' ListClustersResponse (Prelude.Maybe Prelude.Text)
listClustersResponse_marker :: (Maybe Text -> f (Maybe Text))
-> ListClustersResponse -> f ListClustersResponse
listClustersResponse_marker = (ListClustersResponse -> Maybe Text)
-> (ListClustersResponse -> Maybe Text -> ListClustersResponse)
-> Lens' ListClustersResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListClustersResponse' {Maybe Text
marker :: Maybe Text
$sel:marker:ListClustersResponse' :: ListClustersResponse -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListClustersResponse
s@ListClustersResponse' {} Maybe Text
a -> ListClustersResponse
s {$sel:marker:ListClustersResponse' :: Maybe Text
marker = Maybe Text
a} :: ListClustersResponse)

-- | The list of clusters for the account based on the given filters.
listClustersResponse_clusters :: Lens.Lens' ListClustersResponse (Prelude.Maybe [ClusterSummary])
listClustersResponse_clusters :: (Maybe [ClusterSummary] -> f (Maybe [ClusterSummary]))
-> ListClustersResponse -> f ListClustersResponse
listClustersResponse_clusters = (ListClustersResponse -> Maybe [ClusterSummary])
-> (ListClustersResponse
    -> Maybe [ClusterSummary] -> ListClustersResponse)
-> Lens' ListClustersResponse (Maybe [ClusterSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListClustersResponse' {Maybe [ClusterSummary]
clusters :: Maybe [ClusterSummary]
$sel:clusters:ListClustersResponse' :: ListClustersResponse -> Maybe [ClusterSummary]
clusters} -> Maybe [ClusterSummary]
clusters) (\s :: ListClustersResponse
s@ListClustersResponse' {} Maybe [ClusterSummary]
a -> ListClustersResponse
s {$sel:clusters:ListClustersResponse' :: Maybe [ClusterSummary]
clusters = Maybe [ClusterSummary]
a} :: ListClustersResponse) ((Maybe [ClusterSummary] -> f (Maybe [ClusterSummary]))
 -> ListClustersResponse -> f ListClustersResponse)
-> ((Maybe [ClusterSummary] -> f (Maybe [ClusterSummary]))
    -> Maybe [ClusterSummary] -> f (Maybe [ClusterSummary]))
-> (Maybe [ClusterSummary] -> f (Maybe [ClusterSummary]))
-> ListClustersResponse
-> f ListClustersResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ClusterSummary] [ClusterSummary] [ClusterSummary] [ClusterSummary]
-> Iso
     (Maybe [ClusterSummary])
     (Maybe [ClusterSummary])
     (Maybe [ClusterSummary])
     (Maybe [ClusterSummary])
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
  [ClusterSummary] [ClusterSummary] [ClusterSummary] [ClusterSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData ListClustersResponse