{-# 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.ListTaskDefinitions
-- 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 task definitions that are registered to your account.
-- You can filter the results by family name with the @familyPrefix@
-- parameter or by status with the @status@ parameter.
--
-- This operation returns paginated results.
module Amazonka.ECS.ListTaskDefinitions
  ( -- * Creating a Request
    ListTaskDefinitions (..),
    newListTaskDefinitions,

    -- * Request Lenses
    listTaskDefinitions_status,
    listTaskDefinitions_familyPrefix,
    listTaskDefinitions_nextToken,
    listTaskDefinitions_sort,
    listTaskDefinitions_maxResults,

    -- * Destructuring the Response
    ListTaskDefinitionsResponse (..),
    newListTaskDefinitionsResponse,

    -- * Response Lenses
    listTaskDefinitionsResponse_taskDefinitionArns,
    listTaskDefinitionsResponse_nextToken,
    listTaskDefinitionsResponse_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:/ 'newListTaskDefinitions' smart constructor.
data ListTaskDefinitions = ListTaskDefinitions'
  { -- | The task definition status with which to filter the
    -- @ListTaskDefinitions@ results. By default, only @ACTIVE@ task
    -- definitions are listed. By setting this parameter to @INACTIVE@, you can
    -- view task definitions that are @INACTIVE@ as long as an active task or
    -- service still references them. If you paginate the resulting output, be
    -- sure to keep the @status@ value constant in each subsequent request.
    ListTaskDefinitions -> Maybe TaskDefinitionStatus
status :: Prelude.Maybe TaskDefinitionStatus,
    -- | The full family name with which to filter the @ListTaskDefinitions@
    -- results. Specifying a @familyPrefix@ limits the listed task definitions
    -- to task definition revisions that belong to that family.
    ListTaskDefinitions -> Maybe Text
familyPrefix :: Prelude.Maybe Prelude.Text,
    -- | The @nextToken@ value returned from a @ListTaskDefinitions@ 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.
    ListTaskDefinitions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The order in which to sort the results. Valid values are @ASC@ and
    -- @DESC@. By default (@ASC@), task definitions are listed
    -- lexicographically by family name and in ascending numerical order by
    -- revision so that the newest task definitions in a family are listed
    -- last. Setting this parameter to @DESC@ reverses the sort order on family
    -- name and revision so that the newest task definitions in a family are
    -- listed first.
    ListTaskDefinitions -> Maybe SortOrder
sort :: Prelude.Maybe SortOrder,
    -- | The maximum number of task definition results returned by
    -- @ListTaskDefinitions@ in paginated output. When this parameter is used,
    -- @ListTaskDefinitions@ 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 @ListTaskDefinitions@
    -- request with the returned @nextToken@ value. This value can be between 1
    -- and 100. If this parameter is not used, then @ListTaskDefinitions@
    -- returns up to 100 results and a @nextToken@ value if applicable.
    ListTaskDefinitions -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int
  }
  deriving (ListTaskDefinitions -> ListTaskDefinitions -> Bool
(ListTaskDefinitions -> ListTaskDefinitions -> Bool)
-> (ListTaskDefinitions -> ListTaskDefinitions -> Bool)
-> Eq ListTaskDefinitions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListTaskDefinitions -> ListTaskDefinitions -> Bool
$c/= :: ListTaskDefinitions -> ListTaskDefinitions -> Bool
== :: ListTaskDefinitions -> ListTaskDefinitions -> Bool
$c== :: ListTaskDefinitions -> ListTaskDefinitions -> Bool
Prelude.Eq, ReadPrec [ListTaskDefinitions]
ReadPrec ListTaskDefinitions
Int -> ReadS ListTaskDefinitions
ReadS [ListTaskDefinitions]
(Int -> ReadS ListTaskDefinitions)
-> ReadS [ListTaskDefinitions]
-> ReadPrec ListTaskDefinitions
-> ReadPrec [ListTaskDefinitions]
-> Read ListTaskDefinitions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListTaskDefinitions]
$creadListPrec :: ReadPrec [ListTaskDefinitions]
readPrec :: ReadPrec ListTaskDefinitions
$creadPrec :: ReadPrec ListTaskDefinitions
readList :: ReadS [ListTaskDefinitions]
$creadList :: ReadS [ListTaskDefinitions]
readsPrec :: Int -> ReadS ListTaskDefinitions
$creadsPrec :: Int -> ReadS ListTaskDefinitions
Prelude.Read, Int -> ListTaskDefinitions -> ShowS
[ListTaskDefinitions] -> ShowS
ListTaskDefinitions -> String
(Int -> ListTaskDefinitions -> ShowS)
-> (ListTaskDefinitions -> String)
-> ([ListTaskDefinitions] -> ShowS)
-> Show ListTaskDefinitions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListTaskDefinitions] -> ShowS
$cshowList :: [ListTaskDefinitions] -> ShowS
show :: ListTaskDefinitions -> String
$cshow :: ListTaskDefinitions -> String
showsPrec :: Int -> ListTaskDefinitions -> ShowS
$cshowsPrec :: Int -> ListTaskDefinitions -> ShowS
Prelude.Show, (forall x. ListTaskDefinitions -> Rep ListTaskDefinitions x)
-> (forall x. Rep ListTaskDefinitions x -> ListTaskDefinitions)
-> Generic ListTaskDefinitions
forall x. Rep ListTaskDefinitions x -> ListTaskDefinitions
forall x. ListTaskDefinitions -> Rep ListTaskDefinitions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListTaskDefinitions x -> ListTaskDefinitions
$cfrom :: forall x. ListTaskDefinitions -> Rep ListTaskDefinitions x
Prelude.Generic)

-- |
-- Create a value of 'ListTaskDefinitions' 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', 'listTaskDefinitions_status' - The task definition status with which to filter the
-- @ListTaskDefinitions@ results. By default, only @ACTIVE@ task
-- definitions are listed. By setting this parameter to @INACTIVE@, you can
-- view task definitions that are @INACTIVE@ as long as an active task or
-- service still references them. If you paginate the resulting output, be
-- sure to keep the @status@ value constant in each subsequent request.
--
-- 'familyPrefix', 'listTaskDefinitions_familyPrefix' - The full family name with which to filter the @ListTaskDefinitions@
-- results. Specifying a @familyPrefix@ limits the listed task definitions
-- to task definition revisions that belong to that family.
--
-- 'nextToken', 'listTaskDefinitions_nextToken' - The @nextToken@ value returned from a @ListTaskDefinitions@ 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.
--
-- 'sort', 'listTaskDefinitions_sort' - The order in which to sort the results. Valid values are @ASC@ and
-- @DESC@. By default (@ASC@), task definitions are listed
-- lexicographically by family name and in ascending numerical order by
-- revision so that the newest task definitions in a family are listed
-- last. Setting this parameter to @DESC@ reverses the sort order on family
-- name and revision so that the newest task definitions in a family are
-- listed first.
--
-- 'maxResults', 'listTaskDefinitions_maxResults' - The maximum number of task definition results returned by
-- @ListTaskDefinitions@ in paginated output. When this parameter is used,
-- @ListTaskDefinitions@ 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 @ListTaskDefinitions@
-- request with the returned @nextToken@ value. This value can be between 1
-- and 100. If this parameter is not used, then @ListTaskDefinitions@
-- returns up to 100 results and a @nextToken@ value if applicable.
newListTaskDefinitions ::
  ListTaskDefinitions
newListTaskDefinitions :: ListTaskDefinitions
newListTaskDefinitions =
  ListTaskDefinitions' :: Maybe TaskDefinitionStatus
-> Maybe Text
-> Maybe Text
-> Maybe SortOrder
-> Maybe Int
-> ListTaskDefinitions
ListTaskDefinitions'
    { $sel:status:ListTaskDefinitions' :: Maybe TaskDefinitionStatus
status = Maybe TaskDefinitionStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:familyPrefix:ListTaskDefinitions' :: Maybe Text
familyPrefix = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListTaskDefinitions' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sort:ListTaskDefinitions' :: Maybe SortOrder
sort = Maybe SortOrder
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListTaskDefinitions' :: Maybe Int
maxResults = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The task definition status with which to filter the
-- @ListTaskDefinitions@ results. By default, only @ACTIVE@ task
-- definitions are listed. By setting this parameter to @INACTIVE@, you can
-- view task definitions that are @INACTIVE@ as long as an active task or
-- service still references them. If you paginate the resulting output, be
-- sure to keep the @status@ value constant in each subsequent request.
listTaskDefinitions_status :: Lens.Lens' ListTaskDefinitions (Prelude.Maybe TaskDefinitionStatus)
listTaskDefinitions_status :: (Maybe TaskDefinitionStatus -> f (Maybe TaskDefinitionStatus))
-> ListTaskDefinitions -> f ListTaskDefinitions
listTaskDefinitions_status = (ListTaskDefinitions -> Maybe TaskDefinitionStatus)
-> (ListTaskDefinitions
    -> Maybe TaskDefinitionStatus -> ListTaskDefinitions)
-> Lens
     ListTaskDefinitions
     ListTaskDefinitions
     (Maybe TaskDefinitionStatus)
     (Maybe TaskDefinitionStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTaskDefinitions' {Maybe TaskDefinitionStatus
status :: Maybe TaskDefinitionStatus
$sel:status:ListTaskDefinitions' :: ListTaskDefinitions -> Maybe TaskDefinitionStatus
status} -> Maybe TaskDefinitionStatus
status) (\s :: ListTaskDefinitions
s@ListTaskDefinitions' {} Maybe TaskDefinitionStatus
a -> ListTaskDefinitions
s {$sel:status:ListTaskDefinitions' :: Maybe TaskDefinitionStatus
status = Maybe TaskDefinitionStatus
a} :: ListTaskDefinitions)

-- | The full family name with which to filter the @ListTaskDefinitions@
-- results. Specifying a @familyPrefix@ limits the listed task definitions
-- to task definition revisions that belong to that family.
listTaskDefinitions_familyPrefix :: Lens.Lens' ListTaskDefinitions (Prelude.Maybe Prelude.Text)
listTaskDefinitions_familyPrefix :: (Maybe Text -> f (Maybe Text))
-> ListTaskDefinitions -> f ListTaskDefinitions
listTaskDefinitions_familyPrefix = (ListTaskDefinitions -> Maybe Text)
-> (ListTaskDefinitions -> Maybe Text -> ListTaskDefinitions)
-> Lens
     ListTaskDefinitions ListTaskDefinitions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTaskDefinitions' {Maybe Text
familyPrefix :: Maybe Text
$sel:familyPrefix:ListTaskDefinitions' :: ListTaskDefinitions -> Maybe Text
familyPrefix} -> Maybe Text
familyPrefix) (\s :: ListTaskDefinitions
s@ListTaskDefinitions' {} Maybe Text
a -> ListTaskDefinitions
s {$sel:familyPrefix:ListTaskDefinitions' :: Maybe Text
familyPrefix = Maybe Text
a} :: ListTaskDefinitions)

-- | The @nextToken@ value returned from a @ListTaskDefinitions@ 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.
listTaskDefinitions_nextToken :: Lens.Lens' ListTaskDefinitions (Prelude.Maybe Prelude.Text)
listTaskDefinitions_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListTaskDefinitions -> f ListTaskDefinitions
listTaskDefinitions_nextToken = (ListTaskDefinitions -> Maybe Text)
-> (ListTaskDefinitions -> Maybe Text -> ListTaskDefinitions)
-> Lens
     ListTaskDefinitions ListTaskDefinitions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTaskDefinitions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListTaskDefinitions' :: ListTaskDefinitions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListTaskDefinitions
s@ListTaskDefinitions' {} Maybe Text
a -> ListTaskDefinitions
s {$sel:nextToken:ListTaskDefinitions' :: Maybe Text
nextToken = Maybe Text
a} :: ListTaskDefinitions)

-- | The order in which to sort the results. Valid values are @ASC@ and
-- @DESC@. By default (@ASC@), task definitions are listed
-- lexicographically by family name and in ascending numerical order by
-- revision so that the newest task definitions in a family are listed
-- last. Setting this parameter to @DESC@ reverses the sort order on family
-- name and revision so that the newest task definitions in a family are
-- listed first.
listTaskDefinitions_sort :: Lens.Lens' ListTaskDefinitions (Prelude.Maybe SortOrder)
listTaskDefinitions_sort :: (Maybe SortOrder -> f (Maybe SortOrder))
-> ListTaskDefinitions -> f ListTaskDefinitions
listTaskDefinitions_sort = (ListTaskDefinitions -> Maybe SortOrder)
-> (ListTaskDefinitions -> Maybe SortOrder -> ListTaskDefinitions)
-> Lens
     ListTaskDefinitions
     ListTaskDefinitions
     (Maybe SortOrder)
     (Maybe SortOrder)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTaskDefinitions' {Maybe SortOrder
sort :: Maybe SortOrder
$sel:sort:ListTaskDefinitions' :: ListTaskDefinitions -> Maybe SortOrder
sort} -> Maybe SortOrder
sort) (\s :: ListTaskDefinitions
s@ListTaskDefinitions' {} Maybe SortOrder
a -> ListTaskDefinitions
s {$sel:sort:ListTaskDefinitions' :: Maybe SortOrder
sort = Maybe SortOrder
a} :: ListTaskDefinitions)

-- | The maximum number of task definition results returned by
-- @ListTaskDefinitions@ in paginated output. When this parameter is used,
-- @ListTaskDefinitions@ 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 @ListTaskDefinitions@
-- request with the returned @nextToken@ value. This value can be between 1
-- and 100. If this parameter is not used, then @ListTaskDefinitions@
-- returns up to 100 results and a @nextToken@ value if applicable.
listTaskDefinitions_maxResults :: Lens.Lens' ListTaskDefinitions (Prelude.Maybe Prelude.Int)
listTaskDefinitions_maxResults :: (Maybe Int -> f (Maybe Int))
-> ListTaskDefinitions -> f ListTaskDefinitions
listTaskDefinitions_maxResults = (ListTaskDefinitions -> Maybe Int)
-> (ListTaskDefinitions -> Maybe Int -> ListTaskDefinitions)
-> Lens
     ListTaskDefinitions ListTaskDefinitions (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTaskDefinitions' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:ListTaskDefinitions' :: ListTaskDefinitions -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: ListTaskDefinitions
s@ListTaskDefinitions' {} Maybe Int
a -> ListTaskDefinitions
s {$sel:maxResults:ListTaskDefinitions' :: Maybe Int
maxResults = Maybe Int
a} :: ListTaskDefinitions)

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

instance Prelude.NFData ListTaskDefinitions

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

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

-- | /See:/ 'newListTaskDefinitionsResponse' smart constructor.
data ListTaskDefinitionsResponse = ListTaskDefinitionsResponse'
  { -- | The list of task definition Amazon Resource Name (ARN) entries for the
    -- @ListTaskDefinitions@ request.
    ListTaskDefinitionsResponse -> Maybe [Text]
taskDefinitionArns :: Prelude.Maybe [Prelude.Text],
    -- | The @nextToken@ value to include in a future @ListTaskDefinitions@
    -- request. When the results of a @ListTaskDefinitions@ 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.
    ListTaskDefinitionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListTaskDefinitionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListTaskDefinitionsResponse -> ListTaskDefinitionsResponse -> Bool
(ListTaskDefinitionsResponse
 -> ListTaskDefinitionsResponse -> Bool)
-> (ListTaskDefinitionsResponse
    -> ListTaskDefinitionsResponse -> Bool)
-> Eq ListTaskDefinitionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListTaskDefinitionsResponse -> ListTaskDefinitionsResponse -> Bool
$c/= :: ListTaskDefinitionsResponse -> ListTaskDefinitionsResponse -> Bool
== :: ListTaskDefinitionsResponse -> ListTaskDefinitionsResponse -> Bool
$c== :: ListTaskDefinitionsResponse -> ListTaskDefinitionsResponse -> Bool
Prelude.Eq, ReadPrec [ListTaskDefinitionsResponse]
ReadPrec ListTaskDefinitionsResponse
Int -> ReadS ListTaskDefinitionsResponse
ReadS [ListTaskDefinitionsResponse]
(Int -> ReadS ListTaskDefinitionsResponse)
-> ReadS [ListTaskDefinitionsResponse]
-> ReadPrec ListTaskDefinitionsResponse
-> ReadPrec [ListTaskDefinitionsResponse]
-> Read ListTaskDefinitionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListTaskDefinitionsResponse]
$creadListPrec :: ReadPrec [ListTaskDefinitionsResponse]
readPrec :: ReadPrec ListTaskDefinitionsResponse
$creadPrec :: ReadPrec ListTaskDefinitionsResponse
readList :: ReadS [ListTaskDefinitionsResponse]
$creadList :: ReadS [ListTaskDefinitionsResponse]
readsPrec :: Int -> ReadS ListTaskDefinitionsResponse
$creadsPrec :: Int -> ReadS ListTaskDefinitionsResponse
Prelude.Read, Int -> ListTaskDefinitionsResponse -> ShowS
[ListTaskDefinitionsResponse] -> ShowS
ListTaskDefinitionsResponse -> String
(Int -> ListTaskDefinitionsResponse -> ShowS)
-> (ListTaskDefinitionsResponse -> String)
-> ([ListTaskDefinitionsResponse] -> ShowS)
-> Show ListTaskDefinitionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListTaskDefinitionsResponse] -> ShowS
$cshowList :: [ListTaskDefinitionsResponse] -> ShowS
show :: ListTaskDefinitionsResponse -> String
$cshow :: ListTaskDefinitionsResponse -> String
showsPrec :: Int -> ListTaskDefinitionsResponse -> ShowS
$cshowsPrec :: Int -> ListTaskDefinitionsResponse -> ShowS
Prelude.Show, (forall x.
 ListTaskDefinitionsResponse -> Rep ListTaskDefinitionsResponse x)
-> (forall x.
    Rep ListTaskDefinitionsResponse x -> ListTaskDefinitionsResponse)
-> Generic ListTaskDefinitionsResponse
forall x.
Rep ListTaskDefinitionsResponse x -> ListTaskDefinitionsResponse
forall x.
ListTaskDefinitionsResponse -> Rep ListTaskDefinitionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListTaskDefinitionsResponse x -> ListTaskDefinitionsResponse
$cfrom :: forall x.
ListTaskDefinitionsResponse -> Rep ListTaskDefinitionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListTaskDefinitionsResponse' 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:
--
-- 'taskDefinitionArns', 'listTaskDefinitionsResponse_taskDefinitionArns' - The list of task definition Amazon Resource Name (ARN) entries for the
-- @ListTaskDefinitions@ request.
--
-- 'nextToken', 'listTaskDefinitionsResponse_nextToken' - The @nextToken@ value to include in a future @ListTaskDefinitions@
-- request. When the results of a @ListTaskDefinitions@ 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', 'listTaskDefinitionsResponse_httpStatus' - The response's http status code.
newListTaskDefinitionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListTaskDefinitionsResponse
newListTaskDefinitionsResponse :: Int -> ListTaskDefinitionsResponse
newListTaskDefinitionsResponse Int
pHttpStatus_ =
  ListTaskDefinitionsResponse' :: Maybe [Text] -> Maybe Text -> Int -> ListTaskDefinitionsResponse
ListTaskDefinitionsResponse'
    { $sel:taskDefinitionArns:ListTaskDefinitionsResponse' :: Maybe [Text]
taskDefinitionArns =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListTaskDefinitionsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListTaskDefinitionsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The list of task definition Amazon Resource Name (ARN) entries for the
-- @ListTaskDefinitions@ request.
listTaskDefinitionsResponse_taskDefinitionArns :: Lens.Lens' ListTaskDefinitionsResponse (Prelude.Maybe [Prelude.Text])
listTaskDefinitionsResponse_taskDefinitionArns :: (Maybe [Text] -> f (Maybe [Text]))
-> ListTaskDefinitionsResponse -> f ListTaskDefinitionsResponse
listTaskDefinitionsResponse_taskDefinitionArns = (ListTaskDefinitionsResponse -> Maybe [Text])
-> (ListTaskDefinitionsResponse
    -> Maybe [Text] -> ListTaskDefinitionsResponse)
-> Lens' ListTaskDefinitionsResponse (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTaskDefinitionsResponse' {Maybe [Text]
taskDefinitionArns :: Maybe [Text]
$sel:taskDefinitionArns:ListTaskDefinitionsResponse' :: ListTaskDefinitionsResponse -> Maybe [Text]
taskDefinitionArns} -> Maybe [Text]
taskDefinitionArns) (\s :: ListTaskDefinitionsResponse
s@ListTaskDefinitionsResponse' {} Maybe [Text]
a -> ListTaskDefinitionsResponse
s {$sel:taskDefinitionArns:ListTaskDefinitionsResponse' :: Maybe [Text]
taskDefinitionArns = Maybe [Text]
a} :: ListTaskDefinitionsResponse) ((Maybe [Text] -> f (Maybe [Text]))
 -> ListTaskDefinitionsResponse -> f ListTaskDefinitionsResponse)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ListTaskDefinitionsResponse
-> f ListTaskDefinitionsResponse
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 @ListTaskDefinitions@
-- request. When the results of a @ListTaskDefinitions@ 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.
listTaskDefinitionsResponse_nextToken :: Lens.Lens' ListTaskDefinitionsResponse (Prelude.Maybe Prelude.Text)
listTaskDefinitionsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListTaskDefinitionsResponse -> f ListTaskDefinitionsResponse
listTaskDefinitionsResponse_nextToken = (ListTaskDefinitionsResponse -> Maybe Text)
-> (ListTaskDefinitionsResponse
    -> Maybe Text -> ListTaskDefinitionsResponse)
-> Lens' ListTaskDefinitionsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTaskDefinitionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListTaskDefinitionsResponse' :: ListTaskDefinitionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListTaskDefinitionsResponse
s@ListTaskDefinitionsResponse' {} Maybe Text
a -> ListTaskDefinitionsResponse
s {$sel:nextToken:ListTaskDefinitionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListTaskDefinitionsResponse)

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

instance Prelude.NFData ListTaskDefinitionsResponse