{-# 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.ECS.ListContainerInstances
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns a list of container instances in a specified cluster. You can
-- filter the results of a @ListContainerInstances@ operation with cluster
-- query language statements inside the @filter@ parameter. For more
-- information, see
-- <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cluster-query-language.html Cluster Query Language>
-- in the /Amazon Elastic Container Service Developer Guide/.
--
-- This operation returns paginated results.
module Amazonka.ECS.ListContainerInstances
  ( -- * Creating a Request
    ListContainerInstances (..),
    newListContainerInstances,

    -- * Request Lenses
    listContainerInstances_status,
    listContainerInstances_cluster,
    listContainerInstances_nextToken,
    listContainerInstances_filter,
    listContainerInstances_maxResults,

    -- * Destructuring the Response
    ListContainerInstancesResponse (..),
    newListContainerInstancesResponse,

    -- * Response Lenses
    listContainerInstancesResponse_containerInstanceArns,
    listContainerInstancesResponse_nextToken,
    listContainerInstancesResponse_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

-- | /See:/ 'newListContainerInstances' smart constructor.
data ListContainerInstances = ListContainerInstances'
  { -- | Filters the container instances by status. For example, if you specify
    -- the @DRAINING@ status, the results include only container instances that
    -- have been set to @DRAINING@ using UpdateContainerInstancesState. If you
    -- do not specify this parameter, the default is to include container
    -- instances set to all states other than @INACTIVE@.
    ListContainerInstances -> Maybe ContainerInstanceStatus
status :: Prelude.Maybe ContainerInstanceStatus,
    -- | The short name or full Amazon Resource Name (ARN) of the cluster that
    -- hosts the container instances to list. If you do not specify a cluster,
    -- the default cluster is assumed.
    ListContainerInstances -> Maybe Text
cluster :: Prelude.Maybe Prelude.Text,
    -- | The @nextToken@ value returned from a @ListContainerInstances@ request
    -- indicating that more results are available to fulfill the request and
    -- further calls will be needed. If @maxResults@ was provided, it is
    -- possible the number of results to be fewer than @maxResults@.
    --
    -- This token should be treated as an opaque identifier that is only used
    -- to retrieve the next items in a list and not for other programmatic
    -- purposes.
    ListContainerInstances -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | You can filter the results of a @ListContainerInstances@ operation with
    -- cluster query language statements. For more information, see
    -- <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cluster-query-language.html Cluster Query Language>
    -- in the /Amazon Elastic Container Service Developer Guide/.
    ListContainerInstances -> Maybe Text
filter' :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of container instance results returned by
    -- @ListContainerInstances@ in paginated output. When this parameter is
    -- used, @ListContainerInstances@ only returns @maxResults@ results in a
    -- single page along with a @nextToken@ response element. The remaining
    -- results of the initial request can be seen by sending another
    -- @ListContainerInstances@ request with the returned @nextToken@ value.
    -- This value can be between 1 and 100. If this parameter is not used, then
    -- @ListContainerInstances@ returns up to 100 results and a @nextToken@
    -- value if applicable.
    ListContainerInstances -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int
  }
  deriving (ListContainerInstances -> ListContainerInstances -> Bool
(ListContainerInstances -> ListContainerInstances -> Bool)
-> (ListContainerInstances -> ListContainerInstances -> Bool)
-> Eq ListContainerInstances
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListContainerInstances -> ListContainerInstances -> Bool
$c/= :: ListContainerInstances -> ListContainerInstances -> Bool
== :: ListContainerInstances -> ListContainerInstances -> Bool
$c== :: ListContainerInstances -> ListContainerInstances -> Bool
Prelude.Eq, ReadPrec [ListContainerInstances]
ReadPrec ListContainerInstances
Int -> ReadS ListContainerInstances
ReadS [ListContainerInstances]
(Int -> ReadS ListContainerInstances)
-> ReadS [ListContainerInstances]
-> ReadPrec ListContainerInstances
-> ReadPrec [ListContainerInstances]
-> Read ListContainerInstances
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListContainerInstances]
$creadListPrec :: ReadPrec [ListContainerInstances]
readPrec :: ReadPrec ListContainerInstances
$creadPrec :: ReadPrec ListContainerInstances
readList :: ReadS [ListContainerInstances]
$creadList :: ReadS [ListContainerInstances]
readsPrec :: Int -> ReadS ListContainerInstances
$creadsPrec :: Int -> ReadS ListContainerInstances
Prelude.Read, Int -> ListContainerInstances -> ShowS
[ListContainerInstances] -> ShowS
ListContainerInstances -> String
(Int -> ListContainerInstances -> ShowS)
-> (ListContainerInstances -> String)
-> ([ListContainerInstances] -> ShowS)
-> Show ListContainerInstances
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListContainerInstances] -> ShowS
$cshowList :: [ListContainerInstances] -> ShowS
show :: ListContainerInstances -> String
$cshow :: ListContainerInstances -> String
showsPrec :: Int -> ListContainerInstances -> ShowS
$cshowsPrec :: Int -> ListContainerInstances -> ShowS
Prelude.Show, (forall x. ListContainerInstances -> Rep ListContainerInstances x)
-> (forall x.
    Rep ListContainerInstances x -> ListContainerInstances)
-> Generic ListContainerInstances
forall x. Rep ListContainerInstances x -> ListContainerInstances
forall x. ListContainerInstances -> Rep ListContainerInstances x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListContainerInstances x -> ListContainerInstances
$cfrom :: forall x. ListContainerInstances -> Rep ListContainerInstances x
Prelude.Generic)

-- |
-- Create a value of 'ListContainerInstances' 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:
--
-- 'status', 'listContainerInstances_status' - Filters the container instances by status. For example, if you specify
-- the @DRAINING@ status, the results include only container instances that
-- have been set to @DRAINING@ using UpdateContainerInstancesState. If you
-- do not specify this parameter, the default is to include container
-- instances set to all states other than @INACTIVE@.
--
-- 'cluster', 'listContainerInstances_cluster' - The short name or full Amazon Resource Name (ARN) of the cluster that
-- hosts the container instances to list. If you do not specify a cluster,
-- the default cluster is assumed.
--
-- 'nextToken', 'listContainerInstances_nextToken' - The @nextToken@ value returned from a @ListContainerInstances@ request
-- indicating that more results are available to fulfill the request and
-- further calls will be needed. If @maxResults@ was provided, it is
-- possible the number of results to be fewer than @maxResults@.
--
-- This token should be treated as an opaque identifier that is only used
-- to retrieve the next items in a list and not for other programmatic
-- purposes.
--
-- 'filter'', 'listContainerInstances_filter' - You can filter the results of a @ListContainerInstances@ operation with
-- cluster query language statements. For more information, see
-- <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cluster-query-language.html Cluster Query Language>
-- in the /Amazon Elastic Container Service Developer Guide/.
--
-- 'maxResults', 'listContainerInstances_maxResults' - The maximum number of container instance results returned by
-- @ListContainerInstances@ in paginated output. When this parameter is
-- used, @ListContainerInstances@ only returns @maxResults@ results in a
-- single page along with a @nextToken@ response element. The remaining
-- results of the initial request can be seen by sending another
-- @ListContainerInstances@ request with the returned @nextToken@ value.
-- This value can be between 1 and 100. If this parameter is not used, then
-- @ListContainerInstances@ returns up to 100 results and a @nextToken@
-- value if applicable.
newListContainerInstances ::
  ListContainerInstances
newListContainerInstances :: ListContainerInstances
newListContainerInstances =
  ListContainerInstances' :: Maybe ContainerInstanceStatus
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> ListContainerInstances
ListContainerInstances'
    { $sel:status:ListContainerInstances' :: Maybe ContainerInstanceStatus
status = Maybe ContainerInstanceStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:cluster:ListContainerInstances' :: Maybe Text
cluster = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListContainerInstances' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:filter':ListContainerInstances' :: Maybe Text
filter' = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListContainerInstances' :: Maybe Int
maxResults = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | Filters the container instances by status. For example, if you specify
-- the @DRAINING@ status, the results include only container instances that
-- have been set to @DRAINING@ using UpdateContainerInstancesState. If you
-- do not specify this parameter, the default is to include container
-- instances set to all states other than @INACTIVE@.
listContainerInstances_status :: Lens.Lens' ListContainerInstances (Prelude.Maybe ContainerInstanceStatus)
listContainerInstances_status :: (Maybe ContainerInstanceStatus
 -> f (Maybe ContainerInstanceStatus))
-> ListContainerInstances -> f ListContainerInstances
listContainerInstances_status = (ListContainerInstances -> Maybe ContainerInstanceStatus)
-> (ListContainerInstances
    -> Maybe ContainerInstanceStatus -> ListContainerInstances)
-> Lens
     ListContainerInstances
     ListContainerInstances
     (Maybe ContainerInstanceStatus)
     (Maybe ContainerInstanceStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListContainerInstances' {Maybe ContainerInstanceStatus
status :: Maybe ContainerInstanceStatus
$sel:status:ListContainerInstances' :: ListContainerInstances -> Maybe ContainerInstanceStatus
status} -> Maybe ContainerInstanceStatus
status) (\s :: ListContainerInstances
s@ListContainerInstances' {} Maybe ContainerInstanceStatus
a -> ListContainerInstances
s {$sel:status:ListContainerInstances' :: Maybe ContainerInstanceStatus
status = Maybe ContainerInstanceStatus
a} :: ListContainerInstances)

-- | The short name or full Amazon Resource Name (ARN) of the cluster that
-- hosts the container instances to list. If you do not specify a cluster,
-- the default cluster is assumed.
listContainerInstances_cluster :: Lens.Lens' ListContainerInstances (Prelude.Maybe Prelude.Text)
listContainerInstances_cluster :: (Maybe Text -> f (Maybe Text))
-> ListContainerInstances -> f ListContainerInstances
listContainerInstances_cluster = (ListContainerInstances -> Maybe Text)
-> (ListContainerInstances -> Maybe Text -> ListContainerInstances)
-> Lens
     ListContainerInstances
     ListContainerInstances
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListContainerInstances' {Maybe Text
cluster :: Maybe Text
$sel:cluster:ListContainerInstances' :: ListContainerInstances -> Maybe Text
cluster} -> Maybe Text
cluster) (\s :: ListContainerInstances
s@ListContainerInstances' {} Maybe Text
a -> ListContainerInstances
s {$sel:cluster:ListContainerInstances' :: Maybe Text
cluster = Maybe Text
a} :: ListContainerInstances)

-- | The @nextToken@ value returned from a @ListContainerInstances@ request
-- indicating that more results are available to fulfill the request and
-- further calls will be needed. If @maxResults@ was provided, it is
-- possible the number of results to be fewer than @maxResults@.
--
-- This token should be treated as an opaque identifier that is only used
-- to retrieve the next items in a list and not for other programmatic
-- purposes.
listContainerInstances_nextToken :: Lens.Lens' ListContainerInstances (Prelude.Maybe Prelude.Text)
listContainerInstances_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListContainerInstances -> f ListContainerInstances
listContainerInstances_nextToken = (ListContainerInstances -> Maybe Text)
-> (ListContainerInstances -> Maybe Text -> ListContainerInstances)
-> Lens
     ListContainerInstances
     ListContainerInstances
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListContainerInstances' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListContainerInstances' :: ListContainerInstances -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListContainerInstances
s@ListContainerInstances' {} Maybe Text
a -> ListContainerInstances
s {$sel:nextToken:ListContainerInstances' :: Maybe Text
nextToken = Maybe Text
a} :: ListContainerInstances)

-- | You can filter the results of a @ListContainerInstances@ operation with
-- cluster query language statements. For more information, see
-- <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cluster-query-language.html Cluster Query Language>
-- in the /Amazon Elastic Container Service Developer Guide/.
listContainerInstances_filter :: Lens.Lens' ListContainerInstances (Prelude.Maybe Prelude.Text)
listContainerInstances_filter :: (Maybe Text -> f (Maybe Text))
-> ListContainerInstances -> f ListContainerInstances
listContainerInstances_filter = (ListContainerInstances -> Maybe Text)
-> (ListContainerInstances -> Maybe Text -> ListContainerInstances)
-> Lens
     ListContainerInstances
     ListContainerInstances
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListContainerInstances' {Maybe Text
filter' :: Maybe Text
$sel:filter':ListContainerInstances' :: ListContainerInstances -> Maybe Text
filter'} -> Maybe Text
filter') (\s :: ListContainerInstances
s@ListContainerInstances' {} Maybe Text
a -> ListContainerInstances
s {$sel:filter':ListContainerInstances' :: Maybe Text
filter' = Maybe Text
a} :: ListContainerInstances)

-- | The maximum number of container instance results returned by
-- @ListContainerInstances@ in paginated output. When this parameter is
-- used, @ListContainerInstances@ only returns @maxResults@ results in a
-- single page along with a @nextToken@ response element. The remaining
-- results of the initial request can be seen by sending another
-- @ListContainerInstances@ request with the returned @nextToken@ value.
-- This value can be between 1 and 100. If this parameter is not used, then
-- @ListContainerInstances@ returns up to 100 results and a @nextToken@
-- value if applicable.
listContainerInstances_maxResults :: Lens.Lens' ListContainerInstances (Prelude.Maybe Prelude.Int)
listContainerInstances_maxResults :: (Maybe Int -> f (Maybe Int))
-> ListContainerInstances -> f ListContainerInstances
listContainerInstances_maxResults = (ListContainerInstances -> Maybe Int)
-> (ListContainerInstances -> Maybe Int -> ListContainerInstances)
-> Lens
     ListContainerInstances
     ListContainerInstances
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListContainerInstances' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:ListContainerInstances' :: ListContainerInstances -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: ListContainerInstances
s@ListContainerInstances' {} Maybe Int
a -> ListContainerInstances
s {$sel:maxResults:ListContainerInstances' :: Maybe Int
maxResults = Maybe Int
a} :: ListContainerInstances)

instance Core.AWSPager ListContainerInstances where
  page :: ListContainerInstances
-> AWSResponse ListContainerInstances
-> Maybe ListContainerInstances
page ListContainerInstances
rq AWSResponse ListContainerInstances
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListContainerInstances
ListContainerInstancesResponse
rs
            ListContainerInstancesResponse
-> Getting (First Text) ListContainerInstancesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListContainerInstancesResponse
-> Const (First Text) ListContainerInstancesResponse
Lens' ListContainerInstancesResponse (Maybe Text)
listContainerInstancesResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListContainerInstancesResponse
 -> Const (First Text) ListContainerInstancesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListContainerInstancesResponse 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 ListContainerInstances
forall a. Maybe a
Prelude.Nothing
    | Maybe [Text] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListContainerInstances
ListContainerInstancesResponse
rs
            ListContainerInstancesResponse
-> Getting (First [Text]) ListContainerInstancesResponse [Text]
-> Maybe [Text]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [Text] -> Const (First [Text]) (Maybe [Text]))
-> ListContainerInstancesResponse
-> Const (First [Text]) ListContainerInstancesResponse
Lens' ListContainerInstancesResponse (Maybe [Text])
listContainerInstancesResponse_containerInstanceArns
              ((Maybe [Text] -> Const (First [Text]) (Maybe [Text]))
 -> ListContainerInstancesResponse
 -> Const (First [Text]) ListContainerInstancesResponse)
-> (([Text] -> Const (First [Text]) [Text])
    -> Maybe [Text] -> Const (First [Text]) (Maybe [Text]))
-> Getting (First [Text]) ListContainerInstancesResponse [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 ListContainerInstances
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListContainerInstances -> Maybe ListContainerInstances
forall a. a -> Maybe a
Prelude.Just (ListContainerInstances -> Maybe ListContainerInstances)
-> ListContainerInstances -> Maybe ListContainerInstances
forall a b. (a -> b) -> a -> b
Prelude.$
        ListContainerInstances
rq
          ListContainerInstances
-> (ListContainerInstances -> ListContainerInstances)
-> ListContainerInstances
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListContainerInstances -> Identity ListContainerInstances
Lens
  ListContainerInstances
  ListContainerInstances
  (Maybe Text)
  (Maybe Text)
listContainerInstances_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListContainerInstances -> Identity ListContainerInstances)
-> Maybe Text -> ListContainerInstances -> ListContainerInstances
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListContainerInstances
ListContainerInstancesResponse
rs
          ListContainerInstancesResponse
-> Getting (First Text) ListContainerInstancesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListContainerInstancesResponse
-> Const (First Text) ListContainerInstancesResponse
Lens' ListContainerInstancesResponse (Maybe Text)
listContainerInstancesResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListContainerInstancesResponse
 -> Const (First Text) ListContainerInstancesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListContainerInstancesResponse 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 ListContainerInstances where
  type
    AWSResponse ListContainerInstances =
      ListContainerInstancesResponse
  request :: ListContainerInstances -> Request ListContainerInstances
request = Service -> ListContainerInstances -> Request ListContainerInstances
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListContainerInstances
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListContainerInstances)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListContainerInstances))
-> Logger
-> Service
-> Proxy ListContainerInstances
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListContainerInstances)))
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 -> ListContainerInstancesResponse
ListContainerInstancesResponse'
            (Maybe [Text]
 -> Maybe Text -> Int -> ListContainerInstancesResponse)
-> Either String (Maybe [Text])
-> Either
     String (Maybe Text -> Int -> ListContainerInstancesResponse)
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
"containerInstanceArns"
                            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 -> ListContainerInstancesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListContainerInstancesResponse)
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 -> ListContainerInstancesResponse)
-> Either String Int
-> Either String ListContainerInstancesResponse
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 ListContainerInstances

instance Prelude.NFData ListContainerInstances

instance Core.ToHeaders ListContainerInstances where
  toHeaders :: ListContainerInstances -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListContainerInstances -> 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.ListContainerInstances" ::
                          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 ListContainerInstances where
  toJSON :: ListContainerInstances -> Value
toJSON ListContainerInstances' {Maybe Int
Maybe Text
Maybe ContainerInstanceStatus
maxResults :: Maybe Int
filter' :: Maybe Text
nextToken :: Maybe Text
cluster :: Maybe Text
status :: Maybe ContainerInstanceStatus
$sel:maxResults:ListContainerInstances' :: ListContainerInstances -> Maybe Int
$sel:filter':ListContainerInstances' :: ListContainerInstances -> Maybe Text
$sel:nextToken:ListContainerInstances' :: ListContainerInstances -> Maybe Text
$sel:cluster:ListContainerInstances' :: ListContainerInstances -> Maybe Text
$sel:status:ListContainerInstances' :: ListContainerInstances -> Maybe ContainerInstanceStatus
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"status" Text -> ContainerInstanceStatus -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ContainerInstanceStatus -> Pair)
-> Maybe ContainerInstanceStatus -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ContainerInstanceStatus
status,
            (Text
"cluster" 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
cluster,
            (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
"filter" 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
filter',
            (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 ListContainerInstances where
  toPath :: ListContainerInstances -> ByteString
toPath = ByteString -> ListContainerInstances -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newListContainerInstancesResponse' smart constructor.
data ListContainerInstancesResponse = ListContainerInstancesResponse'
  { -- | The list of container instances with full ARN entries for each container
    -- instance associated with the specified cluster.
    ListContainerInstancesResponse -> Maybe [Text]
containerInstanceArns :: Prelude.Maybe [Prelude.Text],
    -- | The @nextToken@ value to include in a future @ListContainerInstances@
    -- request. When the results of a @ListContainerInstances@ request exceed
    -- @maxResults@, this value can be used to retrieve the next page of
    -- results. This value is @null@ when there are no more results to return.
    ListContainerInstancesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListContainerInstancesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListContainerInstancesResponse
-> ListContainerInstancesResponse -> Bool
(ListContainerInstancesResponse
 -> ListContainerInstancesResponse -> Bool)
-> (ListContainerInstancesResponse
    -> ListContainerInstancesResponse -> Bool)
-> Eq ListContainerInstancesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListContainerInstancesResponse
-> ListContainerInstancesResponse -> Bool
$c/= :: ListContainerInstancesResponse
-> ListContainerInstancesResponse -> Bool
== :: ListContainerInstancesResponse
-> ListContainerInstancesResponse -> Bool
$c== :: ListContainerInstancesResponse
-> ListContainerInstancesResponse -> Bool
Prelude.Eq, ReadPrec [ListContainerInstancesResponse]
ReadPrec ListContainerInstancesResponse
Int -> ReadS ListContainerInstancesResponse
ReadS [ListContainerInstancesResponse]
(Int -> ReadS ListContainerInstancesResponse)
-> ReadS [ListContainerInstancesResponse]
-> ReadPrec ListContainerInstancesResponse
-> ReadPrec [ListContainerInstancesResponse]
-> Read ListContainerInstancesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListContainerInstancesResponse]
$creadListPrec :: ReadPrec [ListContainerInstancesResponse]
readPrec :: ReadPrec ListContainerInstancesResponse
$creadPrec :: ReadPrec ListContainerInstancesResponse
readList :: ReadS [ListContainerInstancesResponse]
$creadList :: ReadS [ListContainerInstancesResponse]
readsPrec :: Int -> ReadS ListContainerInstancesResponse
$creadsPrec :: Int -> ReadS ListContainerInstancesResponse
Prelude.Read, Int -> ListContainerInstancesResponse -> ShowS
[ListContainerInstancesResponse] -> ShowS
ListContainerInstancesResponse -> String
(Int -> ListContainerInstancesResponse -> ShowS)
-> (ListContainerInstancesResponse -> String)
-> ([ListContainerInstancesResponse] -> ShowS)
-> Show ListContainerInstancesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListContainerInstancesResponse] -> ShowS
$cshowList :: [ListContainerInstancesResponse] -> ShowS
show :: ListContainerInstancesResponse -> String
$cshow :: ListContainerInstancesResponse -> String
showsPrec :: Int -> ListContainerInstancesResponse -> ShowS
$cshowsPrec :: Int -> ListContainerInstancesResponse -> ShowS
Prelude.Show, (forall x.
 ListContainerInstancesResponse
 -> Rep ListContainerInstancesResponse x)
-> (forall x.
    Rep ListContainerInstancesResponse x
    -> ListContainerInstancesResponse)
-> Generic ListContainerInstancesResponse
forall x.
Rep ListContainerInstancesResponse x
-> ListContainerInstancesResponse
forall x.
ListContainerInstancesResponse
-> Rep ListContainerInstancesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListContainerInstancesResponse x
-> ListContainerInstancesResponse
$cfrom :: forall x.
ListContainerInstancesResponse
-> Rep ListContainerInstancesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListContainerInstancesResponse' 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:
--
-- 'containerInstanceArns', 'listContainerInstancesResponse_containerInstanceArns' - The list of container instances with full ARN entries for each container
-- instance associated with the specified cluster.
--
-- 'nextToken', 'listContainerInstancesResponse_nextToken' - The @nextToken@ value to include in a future @ListContainerInstances@
-- request. When the results of a @ListContainerInstances@ request exceed
-- @maxResults@, this value can be used to retrieve the next page of
-- results. This value is @null@ when there are no more results to return.
--
-- 'httpStatus', 'listContainerInstancesResponse_httpStatus' - The response's http status code.
newListContainerInstancesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListContainerInstancesResponse
newListContainerInstancesResponse :: Int -> ListContainerInstancesResponse
newListContainerInstancesResponse Int
pHttpStatus_ =
  ListContainerInstancesResponse' :: Maybe [Text] -> Maybe Text -> Int -> ListContainerInstancesResponse
ListContainerInstancesResponse'
    { $sel:containerInstanceArns:ListContainerInstancesResponse' :: Maybe [Text]
containerInstanceArns =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListContainerInstancesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListContainerInstancesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The list of container instances with full ARN entries for each container
-- instance associated with the specified cluster.
listContainerInstancesResponse_containerInstanceArns :: Lens.Lens' ListContainerInstancesResponse (Prelude.Maybe [Prelude.Text])
listContainerInstancesResponse_containerInstanceArns :: (Maybe [Text] -> f (Maybe [Text]))
-> ListContainerInstancesResponse
-> f ListContainerInstancesResponse
listContainerInstancesResponse_containerInstanceArns = (ListContainerInstancesResponse -> Maybe [Text])
-> (ListContainerInstancesResponse
    -> Maybe [Text] -> ListContainerInstancesResponse)
-> Lens' ListContainerInstancesResponse (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListContainerInstancesResponse' {Maybe [Text]
containerInstanceArns :: Maybe [Text]
$sel:containerInstanceArns:ListContainerInstancesResponse' :: ListContainerInstancesResponse -> Maybe [Text]
containerInstanceArns} -> Maybe [Text]
containerInstanceArns) (\s :: ListContainerInstancesResponse
s@ListContainerInstancesResponse' {} Maybe [Text]
a -> ListContainerInstancesResponse
s {$sel:containerInstanceArns:ListContainerInstancesResponse' :: Maybe [Text]
containerInstanceArns = Maybe [Text]
a} :: ListContainerInstancesResponse) ((Maybe [Text] -> f (Maybe [Text]))
 -> ListContainerInstancesResponse
 -> f ListContainerInstancesResponse)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ListContainerInstancesResponse
-> f ListContainerInstancesResponse
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

-- | The @nextToken@ value to include in a future @ListContainerInstances@
-- request. When the results of a @ListContainerInstances@ request exceed
-- @maxResults@, this value can be used to retrieve the next page of
-- results. This value is @null@ when there are no more results to return.
listContainerInstancesResponse_nextToken :: Lens.Lens' ListContainerInstancesResponse (Prelude.Maybe Prelude.Text)
listContainerInstancesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListContainerInstancesResponse
-> f ListContainerInstancesResponse
listContainerInstancesResponse_nextToken = (ListContainerInstancesResponse -> Maybe Text)
-> (ListContainerInstancesResponse
    -> Maybe Text -> ListContainerInstancesResponse)
-> Lens' ListContainerInstancesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListContainerInstancesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListContainerInstancesResponse' :: ListContainerInstancesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListContainerInstancesResponse
s@ListContainerInstancesResponse' {} Maybe Text
a -> ListContainerInstancesResponse
s {$sel:nextToken:ListContainerInstancesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListContainerInstancesResponse)

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

instance
  Prelude.NFData
    ListContainerInstancesResponse