{-# 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 #-}
module Amazonka.EMR.ListClusters
(
ListClusters (..),
newListClusters,
listClusters_clusterStates,
listClusters_createdAfter,
listClusters_createdBefore,
listClusters_marker,
ListClustersResponse (..),
newListClustersResponse,
listClustersResponse_clusters,
listClustersResponse_marker,
listClustersResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EMR.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListClusters = ListClusters'
{
ListClusters -> Maybe [ClusterState]
clusterStates :: Prelude.Maybe [ClusterState],
ListClusters -> Maybe POSIX
createdAfter :: Prelude.Maybe Data.POSIX,
ListClusters -> Maybe POSIX
createdBefore :: Prelude.Maybe Data.POSIX,
ListClusters -> Maybe Text
marker :: Prelude.Maybe Prelude.Text
}
deriving (ListClusters -> ListClusters -> Bool
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]
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
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. 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)
newListClusters ::
ListClusters
newListClusters :: ListClusters
newListClusters =
ListClusters'
{ $sel:clusterStates:ListClusters' :: Maybe [ClusterState]
clusterStates = forall a. Maybe a
Prelude.Nothing,
$sel:createdAfter:ListClusters' :: Maybe POSIX
createdAfter = forall a. Maybe a
Prelude.Nothing,
$sel:createdBefore:ListClusters' :: Maybe POSIX
createdBefore = forall a. Maybe a
Prelude.Nothing,
$sel:marker:ListClusters' :: Maybe Text
marker = forall a. Maybe a
Prelude.Nothing
}
listClusters_clusterStates :: Lens.Lens' ListClusters (Prelude.Maybe [ClusterState])
listClusters_clusterStates :: Lens' ListClusters (Maybe [ClusterState])
listClusters_clusterStates = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listClusters_createdAfter :: Lens.Lens' ListClusters (Prelude.Maybe Prelude.UTCTime)
listClusters_createdAfter :: Lens' ListClusters (Maybe UTCTime)
listClusters_createdAfter = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time
listClusters_createdBefore :: Lens.Lens' ListClusters (Prelude.Maybe Prelude.UTCTime)
listClusters_createdBefore :: Lens' ListClusters (Maybe UTCTime)
listClusters_createdBefore = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time
listClusters_marker :: Lens.Lens' ListClusters (Prelude.Maybe Prelude.Text)
listClusters_marker :: Lens' ListClusters (Maybe Text)
listClusters_marker = 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)
instance Core.AWSPager ListClusters where
page :: ListClusters -> AWSResponse ListClusters -> Maybe ListClusters
page ListClusters
rq AWSResponse ListClusters
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListClusters
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListClustersResponse (Maybe Text)
listClustersResponse_marker
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListClusters
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListClustersResponse (Maybe [ClusterSummary])
listClustersResponse_clusters
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListClusters
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListClusters (Maybe Text)
listClusters_marker
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListClusters
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListClustersResponse (Maybe Text)
listClustersResponse_marker
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest ListClusters where
type AWSResponse ListClusters = ListClustersResponse
request :: (Service -> Service) -> ListClusters -> Request ListClusters
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListClusters
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListClusters)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [ClusterSummary] -> Maybe Text -> Int -> ListClustersResponse
ListClustersResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Clusters" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Marker")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable ListClusters where
hashWithSalt :: Int -> ListClusters -> Int
hashWithSalt Int
_salt ListClusters' {Maybe [ClusterState]
Maybe Text
Maybe POSIX
marker :: Maybe Text
createdBefore :: Maybe POSIX
createdAfter :: Maybe POSIX
clusterStates :: Maybe [ClusterState]
$sel:marker:ListClusters' :: ListClusters -> Maybe Text
$sel:createdBefore:ListClusters' :: ListClusters -> Maybe POSIX
$sel:createdAfter:ListClusters' :: ListClusters -> Maybe POSIX
$sel:clusterStates:ListClusters' :: ListClusters -> Maybe [ClusterState]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ClusterState]
clusterStates
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdAfter
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdBefore
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
marker
instance Prelude.NFData ListClusters where
rnf :: ListClusters -> ()
rnf ListClusters' {Maybe [ClusterState]
Maybe Text
Maybe POSIX
marker :: Maybe Text
createdBefore :: Maybe POSIX
createdAfter :: Maybe POSIX
clusterStates :: Maybe [ClusterState]
$sel:marker:ListClusters' :: ListClusters -> Maybe Text
$sel:createdBefore:ListClusters' :: ListClusters -> Maybe POSIX
$sel:createdAfter:ListClusters' :: ListClusters -> Maybe POSIX
$sel:clusterStates:ListClusters' :: ListClusters -> Maybe [ClusterState]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [ClusterState]
clusterStates
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdAfter
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdBefore
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
marker
instance Data.ToHeaders ListClusters where
toHeaders :: ListClusters -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"ElasticMapReduce.ListClusters" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON ListClusters where
toJSON :: ListClusters -> Value
toJSON ListClusters' {Maybe [ClusterState]
Maybe Text
Maybe POSIX
marker :: Maybe Text
createdBefore :: Maybe POSIX
createdAfter :: Maybe POSIX
clusterStates :: Maybe [ClusterState]
$sel:marker:ListClusters' :: ListClusters -> Maybe Text
$sel:createdBefore:ListClusters' :: ListClusters -> Maybe POSIX
$sel:createdAfter:ListClusters' :: ListClusters -> Maybe POSIX
$sel:clusterStates:ListClusters' :: ListClusters -> Maybe [ClusterState]
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"ClusterStates" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [ClusterState]
clusterStates,
(Key
"CreatedAfter" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
createdAfter,
(Key
"CreatedBefore" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
createdBefore,
(Key
"Marker" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
marker
]
)
instance Data.ToPath ListClusters where
toPath :: ListClusters -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListClusters where
toQuery :: ListClusters -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListClustersResponse = ListClustersResponse'
{
ListClustersResponse -> Maybe [ClusterSummary]
clusters :: Prelude.Maybe [ClusterSummary],
ListClustersResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
ListClustersResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListClustersResponse -> ListClustersResponse -> Bool
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]
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
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. 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)
newListClustersResponse ::
Prelude.Int ->
ListClustersResponse
newListClustersResponse :: Int -> ListClustersResponse
newListClustersResponse Int
pHttpStatus_ =
ListClustersResponse'
{ $sel:clusters:ListClustersResponse' :: Maybe [ClusterSummary]
clusters = forall a. Maybe a
Prelude.Nothing,
$sel:marker:ListClustersResponse' :: Maybe Text
marker = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListClustersResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listClustersResponse_clusters :: Lens.Lens' ListClustersResponse (Prelude.Maybe [ClusterSummary])
listClustersResponse_clusters :: Lens' ListClustersResponse (Maybe [ClusterSummary])
listClustersResponse_clusters = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listClustersResponse_marker :: Lens.Lens' ListClustersResponse (Prelude.Maybe Prelude.Text)
listClustersResponse_marker :: Lens' ListClustersResponse (Maybe Text)
listClustersResponse_marker = 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)
listClustersResponse_httpStatus :: Lens.Lens' ListClustersResponse Prelude.Int
listClustersResponse_httpStatus :: Lens' ListClustersResponse Int
listClustersResponse_httpStatus = 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 where
rnf :: ListClustersResponse -> ()
rnf ListClustersResponse' {Int
Maybe [ClusterSummary]
Maybe Text
httpStatus :: Int
marker :: Maybe Text
clusters :: Maybe [ClusterSummary]
$sel:httpStatus:ListClustersResponse' :: ListClustersResponse -> Int
$sel:marker:ListClustersResponse' :: ListClustersResponse -> Maybe Text
$sel:clusters:ListClustersResponse' :: ListClustersResponse -> Maybe [ClusterSummary]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [ClusterSummary]
clusters
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
marker
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus