{-# 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.EMRContainers.ListVirtualClusters
-- 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 information about the specified virtual cluster. Virtual cluster
-- is a managed entity on Amazon EMR on EKS. You can create, describe, list
-- and delete virtual clusters. They do not consume any additional resource
-- in your system. A single virtual cluster maps to a single Kubernetes
-- namespace. Given this relationship, you can model virtual clusters the
-- same way you model Kubernetes namespaces to meet your requirements.
--
-- This operation returns paginated results.
module Amazonka.EMRContainers.ListVirtualClusters
  ( -- * Creating a Request
    ListVirtualClusters (..),
    newListVirtualClusters,

    -- * Request Lenses
    listVirtualClusters_states,
    listVirtualClusters_createdAfter,
    listVirtualClusters_containerProviderType,
    listVirtualClusters_nextToken,
    listVirtualClusters_containerProviderId,
    listVirtualClusters_maxResults,
    listVirtualClusters_createdBefore,

    -- * Destructuring the Response
    ListVirtualClustersResponse (..),
    newListVirtualClustersResponse,

    -- * Response Lenses
    listVirtualClustersResponse_nextToken,
    listVirtualClustersResponse_virtualClusters,
    listVirtualClustersResponse_httpStatus,
  )
where

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

-- | /See:/ 'newListVirtualClusters' smart constructor.
data ListVirtualClusters = ListVirtualClusters'
  { -- | The states of the requested virtual clusters.
    ListVirtualClusters -> Maybe [VirtualClusterState]
states :: Prelude.Maybe [VirtualClusterState],
    -- | The date and time after which the virtual clusters are created.
    ListVirtualClusters -> Maybe POSIX
createdAfter :: Prelude.Maybe Core.POSIX,
    -- | The container provider type of the virtual cluster. EKS is the only
    -- supported type as of now.
    ListVirtualClusters -> Maybe ContainerProviderType
containerProviderType :: Prelude.Maybe ContainerProviderType,
    -- | The token for the next set of virtual clusters to return.
    ListVirtualClusters -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The container provider ID of the virtual cluster.
    ListVirtualClusters -> Maybe Text
containerProviderId :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of virtual clusters that can be listed.
    ListVirtualClusters -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int,
    -- | The date and time before which the virtual clusters are created.
    ListVirtualClusters -> Maybe POSIX
createdBefore :: Prelude.Maybe Core.POSIX
  }
  deriving (ListVirtualClusters -> ListVirtualClusters -> Bool
(ListVirtualClusters -> ListVirtualClusters -> Bool)
-> (ListVirtualClusters -> ListVirtualClusters -> Bool)
-> Eq ListVirtualClusters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListVirtualClusters -> ListVirtualClusters -> Bool
$c/= :: ListVirtualClusters -> ListVirtualClusters -> Bool
== :: ListVirtualClusters -> ListVirtualClusters -> Bool
$c== :: ListVirtualClusters -> ListVirtualClusters -> Bool
Prelude.Eq, ReadPrec [ListVirtualClusters]
ReadPrec ListVirtualClusters
Int -> ReadS ListVirtualClusters
ReadS [ListVirtualClusters]
(Int -> ReadS ListVirtualClusters)
-> ReadS [ListVirtualClusters]
-> ReadPrec ListVirtualClusters
-> ReadPrec [ListVirtualClusters]
-> Read ListVirtualClusters
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListVirtualClusters]
$creadListPrec :: ReadPrec [ListVirtualClusters]
readPrec :: ReadPrec ListVirtualClusters
$creadPrec :: ReadPrec ListVirtualClusters
readList :: ReadS [ListVirtualClusters]
$creadList :: ReadS [ListVirtualClusters]
readsPrec :: Int -> ReadS ListVirtualClusters
$creadsPrec :: Int -> ReadS ListVirtualClusters
Prelude.Read, Int -> ListVirtualClusters -> ShowS
[ListVirtualClusters] -> ShowS
ListVirtualClusters -> String
(Int -> ListVirtualClusters -> ShowS)
-> (ListVirtualClusters -> String)
-> ([ListVirtualClusters] -> ShowS)
-> Show ListVirtualClusters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListVirtualClusters] -> ShowS
$cshowList :: [ListVirtualClusters] -> ShowS
show :: ListVirtualClusters -> String
$cshow :: ListVirtualClusters -> String
showsPrec :: Int -> ListVirtualClusters -> ShowS
$cshowsPrec :: Int -> ListVirtualClusters -> ShowS
Prelude.Show, (forall x. ListVirtualClusters -> Rep ListVirtualClusters x)
-> (forall x. Rep ListVirtualClusters x -> ListVirtualClusters)
-> Generic ListVirtualClusters
forall x. Rep ListVirtualClusters x -> ListVirtualClusters
forall x. ListVirtualClusters -> Rep ListVirtualClusters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListVirtualClusters x -> ListVirtualClusters
$cfrom :: forall x. ListVirtualClusters -> Rep ListVirtualClusters x
Prelude.Generic)

-- |
-- Create a value of 'ListVirtualClusters' 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:
--
-- 'states', 'listVirtualClusters_states' - The states of the requested virtual clusters.
--
-- 'createdAfter', 'listVirtualClusters_createdAfter' - The date and time after which the virtual clusters are created.
--
-- 'containerProviderType', 'listVirtualClusters_containerProviderType' - The container provider type of the virtual cluster. EKS is the only
-- supported type as of now.
--
-- 'nextToken', 'listVirtualClusters_nextToken' - The token for the next set of virtual clusters to return.
--
-- 'containerProviderId', 'listVirtualClusters_containerProviderId' - The container provider ID of the virtual cluster.
--
-- 'maxResults', 'listVirtualClusters_maxResults' - The maximum number of virtual clusters that can be listed.
--
-- 'createdBefore', 'listVirtualClusters_createdBefore' - The date and time before which the virtual clusters are created.
newListVirtualClusters ::
  ListVirtualClusters
newListVirtualClusters :: ListVirtualClusters
newListVirtualClusters =
  ListVirtualClusters' :: Maybe [VirtualClusterState]
-> Maybe POSIX
-> Maybe ContainerProviderType
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe POSIX
-> ListVirtualClusters
ListVirtualClusters'
    { $sel:states:ListVirtualClusters' :: Maybe [VirtualClusterState]
states = Maybe [VirtualClusterState]
forall a. Maybe a
Prelude.Nothing,
      $sel:createdAfter:ListVirtualClusters' :: Maybe POSIX
createdAfter = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:containerProviderType:ListVirtualClusters' :: Maybe ContainerProviderType
containerProviderType = Maybe ContainerProviderType
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListVirtualClusters' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:containerProviderId:ListVirtualClusters' :: Maybe Text
containerProviderId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListVirtualClusters' :: Maybe Int
maxResults = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:createdBefore:ListVirtualClusters' :: Maybe POSIX
createdBefore = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The states of the requested virtual clusters.
listVirtualClusters_states :: Lens.Lens' ListVirtualClusters (Prelude.Maybe [VirtualClusterState])
listVirtualClusters_states :: (Maybe [VirtualClusterState] -> f (Maybe [VirtualClusterState]))
-> ListVirtualClusters -> f ListVirtualClusters
listVirtualClusters_states = (ListVirtualClusters -> Maybe [VirtualClusterState])
-> (ListVirtualClusters
    -> Maybe [VirtualClusterState] -> ListVirtualClusters)
-> Lens
     ListVirtualClusters
     ListVirtualClusters
     (Maybe [VirtualClusterState])
     (Maybe [VirtualClusterState])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListVirtualClusters' {Maybe [VirtualClusterState]
states :: Maybe [VirtualClusterState]
$sel:states:ListVirtualClusters' :: ListVirtualClusters -> Maybe [VirtualClusterState]
states} -> Maybe [VirtualClusterState]
states) (\s :: ListVirtualClusters
s@ListVirtualClusters' {} Maybe [VirtualClusterState]
a -> ListVirtualClusters
s {$sel:states:ListVirtualClusters' :: Maybe [VirtualClusterState]
states = Maybe [VirtualClusterState]
a} :: ListVirtualClusters) ((Maybe [VirtualClusterState] -> f (Maybe [VirtualClusterState]))
 -> ListVirtualClusters -> f ListVirtualClusters)
-> ((Maybe [VirtualClusterState]
     -> f (Maybe [VirtualClusterState]))
    -> Maybe [VirtualClusterState] -> f (Maybe [VirtualClusterState]))
-> (Maybe [VirtualClusterState] -> f (Maybe [VirtualClusterState]))
-> ListVirtualClusters
-> f ListVirtualClusters
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [VirtualClusterState]
  [VirtualClusterState]
  [VirtualClusterState]
  [VirtualClusterState]
-> Iso
     (Maybe [VirtualClusterState])
     (Maybe [VirtualClusterState])
     (Maybe [VirtualClusterState])
     (Maybe [VirtualClusterState])
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
  [VirtualClusterState]
  [VirtualClusterState]
  [VirtualClusterState]
  [VirtualClusterState]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The date and time after which the virtual clusters are created.
listVirtualClusters_createdAfter :: Lens.Lens' ListVirtualClusters (Prelude.Maybe Prelude.UTCTime)
listVirtualClusters_createdAfter :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ListVirtualClusters -> f ListVirtualClusters
listVirtualClusters_createdAfter = (ListVirtualClusters -> Maybe POSIX)
-> (ListVirtualClusters -> Maybe POSIX -> ListVirtualClusters)
-> Lens
     ListVirtualClusters ListVirtualClusters (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListVirtualClusters' {Maybe POSIX
createdAfter :: Maybe POSIX
$sel:createdAfter:ListVirtualClusters' :: ListVirtualClusters -> Maybe POSIX
createdAfter} -> Maybe POSIX
createdAfter) (\s :: ListVirtualClusters
s@ListVirtualClusters' {} Maybe POSIX
a -> ListVirtualClusters
s {$sel:createdAfter:ListVirtualClusters' :: Maybe POSIX
createdAfter = Maybe POSIX
a} :: ListVirtualClusters) ((Maybe POSIX -> f (Maybe POSIX))
 -> ListVirtualClusters -> f ListVirtualClusters)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ListVirtualClusters
-> f ListVirtualClusters
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 container provider type of the virtual cluster. EKS is the only
-- supported type as of now.
listVirtualClusters_containerProviderType :: Lens.Lens' ListVirtualClusters (Prelude.Maybe ContainerProviderType)
listVirtualClusters_containerProviderType :: (Maybe ContainerProviderType -> f (Maybe ContainerProviderType))
-> ListVirtualClusters -> f ListVirtualClusters
listVirtualClusters_containerProviderType = (ListVirtualClusters -> Maybe ContainerProviderType)
-> (ListVirtualClusters
    -> Maybe ContainerProviderType -> ListVirtualClusters)
-> Lens
     ListVirtualClusters
     ListVirtualClusters
     (Maybe ContainerProviderType)
     (Maybe ContainerProviderType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListVirtualClusters' {Maybe ContainerProviderType
containerProviderType :: Maybe ContainerProviderType
$sel:containerProviderType:ListVirtualClusters' :: ListVirtualClusters -> Maybe ContainerProviderType
containerProviderType} -> Maybe ContainerProviderType
containerProviderType) (\s :: ListVirtualClusters
s@ListVirtualClusters' {} Maybe ContainerProviderType
a -> ListVirtualClusters
s {$sel:containerProviderType:ListVirtualClusters' :: Maybe ContainerProviderType
containerProviderType = Maybe ContainerProviderType
a} :: ListVirtualClusters)

-- | The token for the next set of virtual clusters to return.
listVirtualClusters_nextToken :: Lens.Lens' ListVirtualClusters (Prelude.Maybe Prelude.Text)
listVirtualClusters_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListVirtualClusters -> f ListVirtualClusters
listVirtualClusters_nextToken = (ListVirtualClusters -> Maybe Text)
-> (ListVirtualClusters -> Maybe Text -> ListVirtualClusters)
-> Lens
     ListVirtualClusters ListVirtualClusters (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListVirtualClusters' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListVirtualClusters' :: ListVirtualClusters -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListVirtualClusters
s@ListVirtualClusters' {} Maybe Text
a -> ListVirtualClusters
s {$sel:nextToken:ListVirtualClusters' :: Maybe Text
nextToken = Maybe Text
a} :: ListVirtualClusters)

-- | The container provider ID of the virtual cluster.
listVirtualClusters_containerProviderId :: Lens.Lens' ListVirtualClusters (Prelude.Maybe Prelude.Text)
listVirtualClusters_containerProviderId :: (Maybe Text -> f (Maybe Text))
-> ListVirtualClusters -> f ListVirtualClusters
listVirtualClusters_containerProviderId = (ListVirtualClusters -> Maybe Text)
-> (ListVirtualClusters -> Maybe Text -> ListVirtualClusters)
-> Lens
     ListVirtualClusters ListVirtualClusters (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListVirtualClusters' {Maybe Text
containerProviderId :: Maybe Text
$sel:containerProviderId:ListVirtualClusters' :: ListVirtualClusters -> Maybe Text
containerProviderId} -> Maybe Text
containerProviderId) (\s :: ListVirtualClusters
s@ListVirtualClusters' {} Maybe Text
a -> ListVirtualClusters
s {$sel:containerProviderId:ListVirtualClusters' :: Maybe Text
containerProviderId = Maybe Text
a} :: ListVirtualClusters)

-- | The maximum number of virtual clusters that can be listed.
listVirtualClusters_maxResults :: Lens.Lens' ListVirtualClusters (Prelude.Maybe Prelude.Int)
listVirtualClusters_maxResults :: (Maybe Int -> f (Maybe Int))
-> ListVirtualClusters -> f ListVirtualClusters
listVirtualClusters_maxResults = (ListVirtualClusters -> Maybe Int)
-> (ListVirtualClusters -> Maybe Int -> ListVirtualClusters)
-> Lens
     ListVirtualClusters ListVirtualClusters (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListVirtualClusters' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:ListVirtualClusters' :: ListVirtualClusters -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: ListVirtualClusters
s@ListVirtualClusters' {} Maybe Int
a -> ListVirtualClusters
s {$sel:maxResults:ListVirtualClusters' :: Maybe Int
maxResults = Maybe Int
a} :: ListVirtualClusters)

-- | The date and time before which the virtual clusters are created.
listVirtualClusters_createdBefore :: Lens.Lens' ListVirtualClusters (Prelude.Maybe Prelude.UTCTime)
listVirtualClusters_createdBefore :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ListVirtualClusters -> f ListVirtualClusters
listVirtualClusters_createdBefore = (ListVirtualClusters -> Maybe POSIX)
-> (ListVirtualClusters -> Maybe POSIX -> ListVirtualClusters)
-> Lens
     ListVirtualClusters ListVirtualClusters (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListVirtualClusters' {Maybe POSIX
createdBefore :: Maybe POSIX
$sel:createdBefore:ListVirtualClusters' :: ListVirtualClusters -> Maybe POSIX
createdBefore} -> Maybe POSIX
createdBefore) (\s :: ListVirtualClusters
s@ListVirtualClusters' {} Maybe POSIX
a -> ListVirtualClusters
s {$sel:createdBefore:ListVirtualClusters' :: Maybe POSIX
createdBefore = Maybe POSIX
a} :: ListVirtualClusters) ((Maybe POSIX -> f (Maybe POSIX))
 -> ListVirtualClusters -> f ListVirtualClusters)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ListVirtualClusters
-> f ListVirtualClusters
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 ListVirtualClusters where
  page :: ListVirtualClusters
-> AWSResponse ListVirtualClusters -> Maybe ListVirtualClusters
page ListVirtualClusters
rq AWSResponse ListVirtualClusters
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListVirtualClusters
ListVirtualClustersResponse
rs
            ListVirtualClustersResponse
-> Getting (First Text) ListVirtualClustersResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListVirtualClustersResponse
-> Const (First Text) ListVirtualClustersResponse
Lens' ListVirtualClustersResponse (Maybe Text)
listVirtualClustersResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListVirtualClustersResponse
 -> Const (First Text) ListVirtualClustersResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListVirtualClustersResponse 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 ListVirtualClusters
forall a. Maybe a
Prelude.Nothing
    | Maybe [VirtualCluster] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListVirtualClusters
ListVirtualClustersResponse
rs
            ListVirtualClustersResponse
-> Getting
     (First [VirtualCluster])
     ListVirtualClustersResponse
     [VirtualCluster]
-> Maybe [VirtualCluster]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [VirtualCluster]
 -> Const (First [VirtualCluster]) (Maybe [VirtualCluster]))
-> ListVirtualClustersResponse
-> Const (First [VirtualCluster]) ListVirtualClustersResponse
Lens' ListVirtualClustersResponse (Maybe [VirtualCluster])
listVirtualClustersResponse_virtualClusters
              ((Maybe [VirtualCluster]
  -> Const (First [VirtualCluster]) (Maybe [VirtualCluster]))
 -> ListVirtualClustersResponse
 -> Const (First [VirtualCluster]) ListVirtualClustersResponse)
-> (([VirtualCluster]
     -> Const (First [VirtualCluster]) [VirtualCluster])
    -> Maybe [VirtualCluster]
    -> Const (First [VirtualCluster]) (Maybe [VirtualCluster]))
-> Getting
     (First [VirtualCluster])
     ListVirtualClustersResponse
     [VirtualCluster]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([VirtualCluster]
 -> Const (First [VirtualCluster]) [VirtualCluster])
-> Maybe [VirtualCluster]
-> Const (First [VirtualCluster]) (Maybe [VirtualCluster])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListVirtualClusters
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListVirtualClusters -> Maybe ListVirtualClusters
forall a. a -> Maybe a
Prelude.Just (ListVirtualClusters -> Maybe ListVirtualClusters)
-> ListVirtualClusters -> Maybe ListVirtualClusters
forall a b. (a -> b) -> a -> b
Prelude.$
        ListVirtualClusters
rq
          ListVirtualClusters
-> (ListVirtualClusters -> ListVirtualClusters)
-> ListVirtualClusters
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListVirtualClusters -> Identity ListVirtualClusters
Lens
  ListVirtualClusters ListVirtualClusters (Maybe Text) (Maybe Text)
listVirtualClusters_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListVirtualClusters -> Identity ListVirtualClusters)
-> Maybe Text -> ListVirtualClusters -> ListVirtualClusters
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListVirtualClusters
ListVirtualClustersResponse
rs
          ListVirtualClustersResponse
-> Getting (First Text) ListVirtualClustersResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListVirtualClustersResponse
-> Const (First Text) ListVirtualClustersResponse
Lens' ListVirtualClustersResponse (Maybe Text)
listVirtualClustersResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListVirtualClustersResponse
 -> Const (First Text) ListVirtualClustersResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListVirtualClustersResponse 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 ListVirtualClusters where
  type
    AWSResponse ListVirtualClusters =
      ListVirtualClustersResponse
  request :: ListVirtualClusters -> Request ListVirtualClusters
request = Service -> ListVirtualClusters -> Request ListVirtualClusters
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy ListVirtualClusters
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListVirtualClusters)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListVirtualClusters))
-> Logger
-> Service
-> Proxy ListVirtualClusters
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListVirtualClusters)))
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 [VirtualCluster] -> Int -> ListVirtualClustersResponse
ListVirtualClustersResponse'
            (Maybe Text
 -> Maybe [VirtualCluster] -> Int -> ListVirtualClustersResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [VirtualCluster] -> Int -> ListVirtualClustersResponse)
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
"nextToken")
            Either
  String
  (Maybe [VirtualCluster] -> Int -> ListVirtualClustersResponse)
-> Either String (Maybe [VirtualCluster])
-> Either String (Int -> ListVirtualClustersResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Either String (Maybe (Maybe [VirtualCluster]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"virtualClusters"
                            Either String (Maybe (Maybe [VirtualCluster]))
-> Maybe [VirtualCluster] -> Either String (Maybe [VirtualCluster])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [VirtualCluster]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either String (Int -> ListVirtualClustersResponse)
-> Either String Int -> Either String ListVirtualClustersResponse
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 ListVirtualClusters

instance Prelude.NFData ListVirtualClusters

instance Core.ToHeaders ListVirtualClusters where
  toHeaders :: ListVirtualClusters -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListVirtualClusters -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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.ToPath ListVirtualClusters where
  toPath :: ListVirtualClusters -> ByteString
toPath = ByteString -> ListVirtualClusters -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/virtualclusters"

instance Core.ToQuery ListVirtualClusters where
  toQuery :: ListVirtualClusters -> QueryString
toQuery ListVirtualClusters' {Maybe Int
Maybe [VirtualClusterState]
Maybe Text
Maybe POSIX
Maybe ContainerProviderType
createdBefore :: Maybe POSIX
maxResults :: Maybe Int
containerProviderId :: Maybe Text
nextToken :: Maybe Text
containerProviderType :: Maybe ContainerProviderType
createdAfter :: Maybe POSIX
states :: Maybe [VirtualClusterState]
$sel:createdBefore:ListVirtualClusters' :: ListVirtualClusters -> Maybe POSIX
$sel:maxResults:ListVirtualClusters' :: ListVirtualClusters -> Maybe Int
$sel:containerProviderId:ListVirtualClusters' :: ListVirtualClusters -> Maybe Text
$sel:nextToken:ListVirtualClusters' :: ListVirtualClusters -> Maybe Text
$sel:containerProviderType:ListVirtualClusters' :: ListVirtualClusters -> Maybe ContainerProviderType
$sel:createdAfter:ListVirtualClusters' :: ListVirtualClusters -> Maybe POSIX
$sel:states:ListVirtualClusters' :: ListVirtualClusters -> Maybe [VirtualClusterState]
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"states"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            (ByteString -> [VirtualClusterState] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" ([VirtualClusterState] -> QueryString)
-> Maybe [VirtualClusterState] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [VirtualClusterState]
states),
        ByteString
"createdAfter" ByteString -> Maybe POSIX -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe POSIX
createdAfter,
        ByteString
"containerProviderType"
          ByteString -> Maybe ContainerProviderType -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe ContainerProviderType
containerProviderType,
        ByteString
"nextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"containerProviderId" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
containerProviderId,
        ByteString
"maxResults" ByteString -> Maybe Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Int
maxResults,
        ByteString
"createdBefore" ByteString -> Maybe POSIX -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe POSIX
createdBefore
      ]

-- | /See:/ 'newListVirtualClustersResponse' smart constructor.
data ListVirtualClustersResponse = ListVirtualClustersResponse'
  { -- | This output displays the token for the next set of virtual clusters.
    ListVirtualClustersResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | This output lists the specified virtual clusters.
    ListVirtualClustersResponse -> Maybe [VirtualCluster]
virtualClusters :: Prelude.Maybe [VirtualCluster],
    -- | The response's http status code.
    ListVirtualClustersResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListVirtualClustersResponse -> ListVirtualClustersResponse -> Bool
(ListVirtualClustersResponse
 -> ListVirtualClustersResponse -> Bool)
-> (ListVirtualClustersResponse
    -> ListVirtualClustersResponse -> Bool)
-> Eq ListVirtualClustersResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListVirtualClustersResponse -> ListVirtualClustersResponse -> Bool
$c/= :: ListVirtualClustersResponse -> ListVirtualClustersResponse -> Bool
== :: ListVirtualClustersResponse -> ListVirtualClustersResponse -> Bool
$c== :: ListVirtualClustersResponse -> ListVirtualClustersResponse -> Bool
Prelude.Eq, ReadPrec [ListVirtualClustersResponse]
ReadPrec ListVirtualClustersResponse
Int -> ReadS ListVirtualClustersResponse
ReadS [ListVirtualClustersResponse]
(Int -> ReadS ListVirtualClustersResponse)
-> ReadS [ListVirtualClustersResponse]
-> ReadPrec ListVirtualClustersResponse
-> ReadPrec [ListVirtualClustersResponse]
-> Read ListVirtualClustersResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListVirtualClustersResponse]
$creadListPrec :: ReadPrec [ListVirtualClustersResponse]
readPrec :: ReadPrec ListVirtualClustersResponse
$creadPrec :: ReadPrec ListVirtualClustersResponse
readList :: ReadS [ListVirtualClustersResponse]
$creadList :: ReadS [ListVirtualClustersResponse]
readsPrec :: Int -> ReadS ListVirtualClustersResponse
$creadsPrec :: Int -> ReadS ListVirtualClustersResponse
Prelude.Read, Int -> ListVirtualClustersResponse -> ShowS
[ListVirtualClustersResponse] -> ShowS
ListVirtualClustersResponse -> String
(Int -> ListVirtualClustersResponse -> ShowS)
-> (ListVirtualClustersResponse -> String)
-> ([ListVirtualClustersResponse] -> ShowS)
-> Show ListVirtualClustersResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListVirtualClustersResponse] -> ShowS
$cshowList :: [ListVirtualClustersResponse] -> ShowS
show :: ListVirtualClustersResponse -> String
$cshow :: ListVirtualClustersResponse -> String
showsPrec :: Int -> ListVirtualClustersResponse -> ShowS
$cshowsPrec :: Int -> ListVirtualClustersResponse -> ShowS
Prelude.Show, (forall x.
 ListVirtualClustersResponse -> Rep ListVirtualClustersResponse x)
-> (forall x.
    Rep ListVirtualClustersResponse x -> ListVirtualClustersResponse)
-> Generic ListVirtualClustersResponse
forall x.
Rep ListVirtualClustersResponse x -> ListVirtualClustersResponse
forall x.
ListVirtualClustersResponse -> Rep ListVirtualClustersResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListVirtualClustersResponse x -> ListVirtualClustersResponse
$cfrom :: forall x.
ListVirtualClustersResponse -> Rep ListVirtualClustersResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListVirtualClustersResponse' 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:
--
-- 'nextToken', 'listVirtualClustersResponse_nextToken' - This output displays the token for the next set of virtual clusters.
--
-- 'virtualClusters', 'listVirtualClustersResponse_virtualClusters' - This output lists the specified virtual clusters.
--
-- 'httpStatus', 'listVirtualClustersResponse_httpStatus' - The response's http status code.
newListVirtualClustersResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListVirtualClustersResponse
newListVirtualClustersResponse :: Int -> ListVirtualClustersResponse
newListVirtualClustersResponse Int
pHttpStatus_ =
  ListVirtualClustersResponse' :: Maybe Text
-> Maybe [VirtualCluster] -> Int -> ListVirtualClustersResponse
ListVirtualClustersResponse'
    { $sel:nextToken:ListVirtualClustersResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:virtualClusters:ListVirtualClustersResponse' :: Maybe [VirtualCluster]
virtualClusters = Maybe [VirtualCluster]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListVirtualClustersResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | This output displays the token for the next set of virtual clusters.
listVirtualClustersResponse_nextToken :: Lens.Lens' ListVirtualClustersResponse (Prelude.Maybe Prelude.Text)
listVirtualClustersResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListVirtualClustersResponse -> f ListVirtualClustersResponse
listVirtualClustersResponse_nextToken = (ListVirtualClustersResponse -> Maybe Text)
-> (ListVirtualClustersResponse
    -> Maybe Text -> ListVirtualClustersResponse)
-> Lens' ListVirtualClustersResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListVirtualClustersResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListVirtualClustersResponse' :: ListVirtualClustersResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListVirtualClustersResponse
s@ListVirtualClustersResponse' {} Maybe Text
a -> ListVirtualClustersResponse
s {$sel:nextToken:ListVirtualClustersResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListVirtualClustersResponse)

-- | This output lists the specified virtual clusters.
listVirtualClustersResponse_virtualClusters :: Lens.Lens' ListVirtualClustersResponse (Prelude.Maybe [VirtualCluster])
listVirtualClustersResponse_virtualClusters :: (Maybe [VirtualCluster] -> f (Maybe [VirtualCluster]))
-> ListVirtualClustersResponse -> f ListVirtualClustersResponse
listVirtualClustersResponse_virtualClusters = (ListVirtualClustersResponse -> Maybe [VirtualCluster])
-> (ListVirtualClustersResponse
    -> Maybe [VirtualCluster] -> ListVirtualClustersResponse)
-> Lens' ListVirtualClustersResponse (Maybe [VirtualCluster])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListVirtualClustersResponse' {Maybe [VirtualCluster]
virtualClusters :: Maybe [VirtualCluster]
$sel:virtualClusters:ListVirtualClustersResponse' :: ListVirtualClustersResponse -> Maybe [VirtualCluster]
virtualClusters} -> Maybe [VirtualCluster]
virtualClusters) (\s :: ListVirtualClustersResponse
s@ListVirtualClustersResponse' {} Maybe [VirtualCluster]
a -> ListVirtualClustersResponse
s {$sel:virtualClusters:ListVirtualClustersResponse' :: Maybe [VirtualCluster]
virtualClusters = Maybe [VirtualCluster]
a} :: ListVirtualClustersResponse) ((Maybe [VirtualCluster] -> f (Maybe [VirtualCluster]))
 -> ListVirtualClustersResponse -> f ListVirtualClustersResponse)
-> ((Maybe [VirtualCluster] -> f (Maybe [VirtualCluster]))
    -> Maybe [VirtualCluster] -> f (Maybe [VirtualCluster]))
-> (Maybe [VirtualCluster] -> f (Maybe [VirtualCluster]))
-> ListVirtualClustersResponse
-> f ListVirtualClustersResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [VirtualCluster] [VirtualCluster] [VirtualCluster] [VirtualCluster]
-> Iso
     (Maybe [VirtualCluster])
     (Maybe [VirtualCluster])
     (Maybe [VirtualCluster])
     (Maybe [VirtualCluster])
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
  [VirtualCluster] [VirtualCluster] [VirtualCluster] [VirtualCluster]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData ListVirtualClustersResponse