{-# 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.ECS.ListClusters
(
ListClusters (..),
newListClusters,
listClusters_nextToken,
listClusters_maxResults,
ListClustersResponse (..),
newListClustersResponse,
listClustersResponse_clusterArns,
listClustersResponse_nextToken,
listClustersResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.ECS.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
data ListClusters = ListClusters'
{
ListClusters -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListClusters -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int
}
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)
newListClusters ::
ListClusters
newListClusters :: ListClusters
newListClusters =
ListClusters' :: Maybe Text -> Maybe Int -> ListClusters
ListClusters'
{ $sel:nextToken:ListClusters' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListClusters' :: Maybe Int
maxResults = Maybe Int
forall a. Maybe a
Prelude.Nothing
}
listClusters_nextToken :: Lens.Lens' ListClusters (Prelude.Maybe Prelude.Text)
listClusters_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListClusters -> f ListClusters
listClusters_nextToken = (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
nextToken :: Maybe Text
$sel:nextToken:ListClusters' :: ListClusters -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListClusters
s@ListClusters' {} Maybe Text
a -> ListClusters
s {$sel:nextToken:ListClusters' :: Maybe Text
nextToken = Maybe Text
a} :: ListClusters)
listClusters_maxResults :: Lens.Lens' ListClusters (Prelude.Maybe Prelude.Int)
listClusters_maxResults :: (Maybe Int -> f (Maybe Int)) -> ListClusters -> f ListClusters
listClusters_maxResults = (ListClusters -> Maybe Int)
-> (ListClusters -> Maybe Int -> ListClusters)
-> Lens ListClusters ListClusters (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListClusters' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:ListClusters' :: ListClusters -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: ListClusters
s@ListClusters' {} Maybe Int
a -> ListClusters
s {$sel:maxResults:ListClusters' :: Maybe Int
maxResults = Maybe Int
a} :: ListClusters)
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_nextToken ((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 [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_clusterArns
((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
| 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_nextToken
((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_nextToken ((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 Text -> Int -> ListClustersResponse
ListClustersResponse'
(Maybe [Text] -> Maybe Text -> Int -> ListClustersResponse)
-> Either String (Maybe [Text])
-> Either String (Maybe Text -> Int -> ListClustersResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"clusterArns" Either String (Maybe (Maybe [Text]))
-> Maybe [Text] -> Either String (Maybe [Text])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
Either String (Maybe Text -> Int -> ListClustersResponse)
-> Either String (Maybe Text)
-> 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 Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"nextToken")
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
"AmazonEC2ContainerServiceV20141113.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 Int
Maybe Text
maxResults :: Maybe Int
nextToken :: Maybe Text
$sel:maxResults:ListClusters' :: ListClusters -> Maybe Int
$sel:nextToken:ListClusters' :: ListClusters -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"nextToken" 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
nextToken,
(Text
"maxResults" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
maxResults
]
)
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
data ListClustersResponse = ListClustersResponse'
{
ListClustersResponse -> Maybe [Text]
clusterArns :: Prelude.Maybe [Prelude.Text],
ListClustersResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
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)
newListClustersResponse ::
Prelude.Int ->
ListClustersResponse
newListClustersResponse :: Int -> ListClustersResponse
newListClustersResponse Int
pHttpStatus_ =
ListClustersResponse' :: Maybe [Text] -> Maybe Text -> Int -> ListClustersResponse
ListClustersResponse'
{ $sel:clusterArns:ListClustersResponse' :: Maybe [Text]
clusterArns =
Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListClustersResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListClustersResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listClustersResponse_clusterArns :: Lens.Lens' ListClustersResponse (Prelude.Maybe [Prelude.Text])
listClustersResponse_clusterArns :: (Maybe [Text] -> f (Maybe [Text]))
-> ListClustersResponse -> f ListClustersResponse
listClustersResponse_clusterArns = (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]
clusterArns :: Maybe [Text]
$sel:clusterArns:ListClustersResponse' :: ListClustersResponse -> Maybe [Text]
clusterArns} -> Maybe [Text]
clusterArns) (\s :: ListClustersResponse
s@ListClustersResponse' {} Maybe [Text]
a -> ListClustersResponse
s {$sel:clusterArns:ListClustersResponse' :: Maybe [Text]
clusterArns = Maybe [Text]
a} :: ListClustersResponse) ((Maybe [Text] -> f (Maybe [Text]))
-> ListClustersResponse -> f ListClustersResponse)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ListClustersResponse
-> f ListClustersResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listClustersResponse_nextToken :: Lens.Lens' ListClustersResponse (Prelude.Maybe Prelude.Text)
listClustersResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListClustersResponse -> f ListClustersResponse
listClustersResponse_nextToken = (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
nextToken :: Maybe Text
$sel:nextToken:ListClustersResponse' :: ListClustersResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListClustersResponse
s@ListClustersResponse' {} Maybe Text
a -> ListClustersResponse
s {$sel:nextToken:ListClustersResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListClustersResponse)
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