{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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_familyPrefix,
    listTaskDefinitions_maxResults,
    listTaskDefinitions_nextToken,
    listTaskDefinitions_sort,
    listTaskDefinitions_status,

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

    -- * Response Lenses
    listTaskDefinitionsResponse_nextToken,
    listTaskDefinitionsResponse_taskDefinitionArns,
    listTaskDefinitionsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ECS.Types
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 full family name to filter the @ListTaskDefinitions@ results with.
    -- 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 maximum number of task definition results that @ListTaskDefinitions@
    -- returned 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 isn\'t used, then @ListTaskDefinitions@
    -- returns up to 100 results and a @nextToken@ value if applicable.
    ListTaskDefinitions -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int,
    -- | 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 to sort the results in. 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. This is so
    -- that the newest task definitions in a family are listed first.
    ListTaskDefinitions -> Maybe SortOrder
sort :: Prelude.Maybe SortOrder,
    -- | The task definition status to filter the @ListTaskDefinitions@ results
    -- with. 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
  }
  deriving (ListTaskDefinitions -> ListTaskDefinitions -> Bool
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]
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
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. 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:
--
-- 'familyPrefix', 'listTaskDefinitions_familyPrefix' - The full family name to filter the @ListTaskDefinitions@ results with.
-- Specifying a @familyPrefix@ limits the listed task definitions to task
-- definition revisions that belong to that family.
--
-- 'maxResults', 'listTaskDefinitions_maxResults' - The maximum number of task definition results that @ListTaskDefinitions@
-- returned 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 isn\'t used, then @ListTaskDefinitions@
-- returns up to 100 results and a @nextToken@ value if applicable.
--
-- '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 to sort the results in. 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. This is so
-- that the newest task definitions in a family are listed first.
--
-- 'status', 'listTaskDefinitions_status' - The task definition status to filter the @ListTaskDefinitions@ results
-- with. 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.
newListTaskDefinitions ::
  ListTaskDefinitions
newListTaskDefinitions :: ListTaskDefinitions
newListTaskDefinitions =
  ListTaskDefinitions'
    { $sel:familyPrefix:ListTaskDefinitions' :: Maybe Text
familyPrefix =
        forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListTaskDefinitions' :: Maybe Int
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListTaskDefinitions' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:sort:ListTaskDefinitions' :: Maybe SortOrder
sort = forall a. Maybe a
Prelude.Nothing,
      $sel:status:ListTaskDefinitions' :: Maybe TaskDefinitionStatus
status = forall a. Maybe a
Prelude.Nothing
    }

-- | The full family name to filter the @ListTaskDefinitions@ results with.
-- 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 :: Lens' ListTaskDefinitions (Maybe Text)
listTaskDefinitions_familyPrefix = 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 maximum number of task definition results that @ListTaskDefinitions@
-- returned 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 isn\'t 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 :: Lens' ListTaskDefinitions (Maybe Int)
listTaskDefinitions_maxResults = 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)

-- | 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 :: Lens' ListTaskDefinitions (Maybe Text)
listTaskDefinitions_nextToken = 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 to sort the results in. 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. This is so
-- that the newest task definitions in a family are listed first.
listTaskDefinitions_sort :: Lens.Lens' ListTaskDefinitions (Prelude.Maybe SortOrder)
listTaskDefinitions_sort :: Lens' ListTaskDefinitions (Maybe SortOrder)
listTaskDefinitions_sort = 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 task definition status to filter the @ListTaskDefinitions@ results
-- with. 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 :: Lens' ListTaskDefinitions (Maybe TaskDefinitionStatus)
listTaskDefinitions_status = 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)

instance Core.AWSPager ListTaskDefinitions where
  page :: ListTaskDefinitions
-> AWSResponse ListTaskDefinitions -> Maybe ListTaskDefinitions
page ListTaskDefinitions
rq AWSResponse ListTaskDefinitions
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListTaskDefinitions
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListTaskDefinitionsResponse (Maybe Text)
listTaskDefinitionsResponse_nextToken
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListTaskDefinitions
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListTaskDefinitionsResponse (Maybe [Text])
listTaskDefinitionsResponse_taskDefinitionArns
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ ListTaskDefinitions
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListTaskDefinitions (Maybe Text)
listTaskDefinitions_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListTaskDefinitions
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListTaskDefinitionsResponse (Maybe Text)
listTaskDefinitionsResponse_nextToken
          forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListTaskDefinitions where
  type
    AWSResponse ListTaskDefinitions =
      ListTaskDefinitionsResponse
  request :: (Service -> Service)
-> ListTaskDefinitions -> Request ListTaskDefinitions
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListTaskDefinitions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListTaskDefinitions)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Maybe [Text] -> Int -> ListTaskDefinitionsResponse
ListTaskDefinitionsResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"nextToken")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"taskDefinitionArns"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable ListTaskDefinitions where
  hashWithSalt :: Int -> ListTaskDefinitions -> Int
hashWithSalt Int
_salt ListTaskDefinitions' {Maybe Int
Maybe Text
Maybe SortOrder
Maybe TaskDefinitionStatus
status :: Maybe TaskDefinitionStatus
sort :: Maybe SortOrder
nextToken :: Maybe Text
maxResults :: Maybe Int
familyPrefix :: Maybe Text
$sel:status:ListTaskDefinitions' :: ListTaskDefinitions -> Maybe TaskDefinitionStatus
$sel:sort:ListTaskDefinitions' :: ListTaskDefinitions -> Maybe SortOrder
$sel:nextToken:ListTaskDefinitions' :: ListTaskDefinitions -> Maybe Text
$sel:maxResults:ListTaskDefinitions' :: ListTaskDefinitions -> Maybe Int
$sel:familyPrefix:ListTaskDefinitions' :: ListTaskDefinitions -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
familyPrefix
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SortOrder
sort
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TaskDefinitionStatus
status

instance Prelude.NFData ListTaskDefinitions where
  rnf :: ListTaskDefinitions -> ()
rnf ListTaskDefinitions' {Maybe Int
Maybe Text
Maybe SortOrder
Maybe TaskDefinitionStatus
status :: Maybe TaskDefinitionStatus
sort :: Maybe SortOrder
nextToken :: Maybe Text
maxResults :: Maybe Int
familyPrefix :: Maybe Text
$sel:status:ListTaskDefinitions' :: ListTaskDefinitions -> Maybe TaskDefinitionStatus
$sel:sort:ListTaskDefinitions' :: ListTaskDefinitions -> Maybe SortOrder
$sel:nextToken:ListTaskDefinitions' :: ListTaskDefinitions -> Maybe Text
$sel:maxResults:ListTaskDefinitions' :: ListTaskDefinitions -> Maybe Int
$sel:familyPrefix:ListTaskDefinitions' :: ListTaskDefinitions -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
familyPrefix
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
maxResults
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SortOrder
sort
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TaskDefinitionStatus
status

instance Data.ToHeaders ListTaskDefinitions where
  toHeaders :: ListTaskDefinitions -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AmazonEC2ContainerServiceV20141113.ListTaskDefinitions" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON ListTaskDefinitions where
  toJSON :: ListTaskDefinitions -> Value
toJSON ListTaskDefinitions' {Maybe Int
Maybe Text
Maybe SortOrder
Maybe TaskDefinitionStatus
status :: Maybe TaskDefinitionStatus
sort :: Maybe SortOrder
nextToken :: Maybe Text
maxResults :: Maybe Int
familyPrefix :: Maybe Text
$sel:status:ListTaskDefinitions' :: ListTaskDefinitions -> Maybe TaskDefinitionStatus
$sel:sort:ListTaskDefinitions' :: ListTaskDefinitions -> Maybe SortOrder
$sel:nextToken:ListTaskDefinitions' :: ListTaskDefinitions -> Maybe Text
$sel:maxResults:ListTaskDefinitions' :: ListTaskDefinitions -> Maybe Int
$sel:familyPrefix:ListTaskDefinitions' :: ListTaskDefinitions -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"familyPrefix" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
familyPrefix,
            (Key
"maxResults" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
maxResults,
            (Key
"nextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Key
"sort" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SortOrder
sort,
            (Key
"status" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TaskDefinitionStatus
status
          ]
      )

instance Data.ToPath ListTaskDefinitions where
  toPath :: ListTaskDefinitions -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newListTaskDefinitionsResponse' smart constructor.
data ListTaskDefinitionsResponse = ListTaskDefinitionsResponse'
  { -- | 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 list of task definition Amazon Resource Name (ARN) entries for the
    -- @ListTaskDefinitions@ request.
    ListTaskDefinitionsResponse -> Maybe [Text]
taskDefinitionArns :: Prelude.Maybe [Prelude.Text],
    -- | The response's http status code.
    ListTaskDefinitionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListTaskDefinitionsResponse -> ListTaskDefinitionsResponse -> Bool
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]
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
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.
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:
--
-- '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.
--
-- 'taskDefinitionArns', 'listTaskDefinitionsResponse_taskDefinitionArns' - The list of task definition Amazon Resource Name (ARN) entries for the
-- @ListTaskDefinitions@ request.
--
-- 'httpStatus', 'listTaskDefinitionsResponse_httpStatus' - The response's http status code.
newListTaskDefinitionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListTaskDefinitionsResponse
newListTaskDefinitionsResponse :: Int -> ListTaskDefinitionsResponse
newListTaskDefinitionsResponse Int
pHttpStatus_ =
  ListTaskDefinitionsResponse'
    { $sel:nextToken:ListTaskDefinitionsResponse' :: Maybe Text
nextToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:taskDefinitionArns:ListTaskDefinitionsResponse' :: Maybe [Text]
taskDefinitionArns = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListTaskDefinitionsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | 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 :: Lens' ListTaskDefinitionsResponse (Maybe Text)
listTaskDefinitionsResponse_nextToken = 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 list of task definition Amazon Resource Name (ARN) entries for the
-- @ListTaskDefinitions@ request.
listTaskDefinitionsResponse_taskDefinitionArns :: Lens.Lens' ListTaskDefinitionsResponse (Prelude.Maybe [Prelude.Text])
listTaskDefinitionsResponse_taskDefinitionArns :: Lens' ListTaskDefinitionsResponse (Maybe [Text])
listTaskDefinitionsResponse_taskDefinitionArns = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The response's http status code.
listTaskDefinitionsResponse_httpStatus :: Lens.Lens' ListTaskDefinitionsResponse Prelude.Int
listTaskDefinitionsResponse_httpStatus :: Lens' ListTaskDefinitionsResponse Int
listTaskDefinitionsResponse_httpStatus = 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 where
  rnf :: ListTaskDefinitionsResponse -> ()
rnf ListTaskDefinitionsResponse' {Int
Maybe [Text]
Maybe Text
httpStatus :: Int
taskDefinitionArns :: Maybe [Text]
nextToken :: Maybe Text
$sel:httpStatus:ListTaskDefinitionsResponse' :: ListTaskDefinitionsResponse -> Int
$sel:taskDefinitionArns:ListTaskDefinitionsResponse' :: ListTaskDefinitionsResponse -> Maybe [Text]
$sel:nextToken:ListTaskDefinitionsResponse' :: ListTaskDefinitionsResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
taskDefinitionArns
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus