{-# 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.ListTaskDefinitionFamilies
-- 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 definition families that are registered to your
-- account (which may include task definition families that no longer have
-- any @ACTIVE@ task definition revisions).
--
-- You can filter out task definition families that do not contain any
-- @ACTIVE@ task definition revisions by setting the @status@ parameter to
-- @ACTIVE@. You can also filter the results with the @familyPrefix@
-- parameter.
--
-- This operation returns paginated results.
module Amazonka.ECS.ListTaskDefinitionFamilies
  ( -- * Creating a Request
    ListTaskDefinitionFamilies (..),
    newListTaskDefinitionFamilies,

    -- * Request Lenses
    listTaskDefinitionFamilies_status,
    listTaskDefinitionFamilies_familyPrefix,
    listTaskDefinitionFamilies_nextToken,
    listTaskDefinitionFamilies_maxResults,

    -- * Destructuring the Response
    ListTaskDefinitionFamiliesResponse (..),
    newListTaskDefinitionFamiliesResponse,

    -- * Response Lenses
    listTaskDefinitionFamiliesResponse_families,
    listTaskDefinitionFamiliesResponse_nextToken,
    listTaskDefinitionFamiliesResponse_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:/ 'newListTaskDefinitionFamilies' smart constructor.
data ListTaskDefinitionFamilies = ListTaskDefinitionFamilies'
  { -- | The task definition family status with which to filter the
    -- @ListTaskDefinitionFamilies@ results. By default, both @ACTIVE@ and
    -- @INACTIVE@ task definition families are listed. If this parameter is set
    -- to @ACTIVE@, only task definition families that have an @ACTIVE@ task
    -- definition revision are returned. If this parameter is set to
    -- @INACTIVE@, only task definition families that do not have any @ACTIVE@
    -- task definition revisions are returned. If you paginate the resulting
    -- output, be sure to keep the @status@ value constant in each subsequent
    -- request.
    ListTaskDefinitionFamilies -> Maybe TaskDefinitionFamilyStatus
status :: Prelude.Maybe TaskDefinitionFamilyStatus,
    -- | The @familyPrefix@ is a string that is used to filter the results of
    -- @ListTaskDefinitionFamilies@. If you specify a @familyPrefix@, only task
    -- definition family names that begin with the @familyPrefix@ string are
    -- returned.
    ListTaskDefinitionFamilies -> Maybe Text
familyPrefix :: Prelude.Maybe Prelude.Text,
    -- | The @nextToken@ value returned from a @ListTaskDefinitionFamilies@
    -- 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.
    ListTaskDefinitionFamilies -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of task definition family results returned by
    -- @ListTaskDefinitionFamilies@ 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
    -- @ListTaskDefinitionFamilies@ request with the returned @nextToken@
    -- value. This value can be between 1 and 100. If this parameter is not
    -- used, then @ListTaskDefinitionFamilies@ returns up to 100 results and a
    -- @nextToken@ value if applicable.
    ListTaskDefinitionFamilies -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int
  }
  deriving (ListTaskDefinitionFamilies -> ListTaskDefinitionFamilies -> Bool
(ListTaskDefinitionFamilies -> ListTaskDefinitionFamilies -> Bool)
-> (ListTaskDefinitionFamilies
    -> ListTaskDefinitionFamilies -> Bool)
-> Eq ListTaskDefinitionFamilies
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListTaskDefinitionFamilies -> ListTaskDefinitionFamilies -> Bool
$c/= :: ListTaskDefinitionFamilies -> ListTaskDefinitionFamilies -> Bool
== :: ListTaskDefinitionFamilies -> ListTaskDefinitionFamilies -> Bool
$c== :: ListTaskDefinitionFamilies -> ListTaskDefinitionFamilies -> Bool
Prelude.Eq, ReadPrec [ListTaskDefinitionFamilies]
ReadPrec ListTaskDefinitionFamilies
Int -> ReadS ListTaskDefinitionFamilies
ReadS [ListTaskDefinitionFamilies]
(Int -> ReadS ListTaskDefinitionFamilies)
-> ReadS [ListTaskDefinitionFamilies]
-> ReadPrec ListTaskDefinitionFamilies
-> ReadPrec [ListTaskDefinitionFamilies]
-> Read ListTaskDefinitionFamilies
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListTaskDefinitionFamilies]
$creadListPrec :: ReadPrec [ListTaskDefinitionFamilies]
readPrec :: ReadPrec ListTaskDefinitionFamilies
$creadPrec :: ReadPrec ListTaskDefinitionFamilies
readList :: ReadS [ListTaskDefinitionFamilies]
$creadList :: ReadS [ListTaskDefinitionFamilies]
readsPrec :: Int -> ReadS ListTaskDefinitionFamilies
$creadsPrec :: Int -> ReadS ListTaskDefinitionFamilies
Prelude.Read, Int -> ListTaskDefinitionFamilies -> ShowS
[ListTaskDefinitionFamilies] -> ShowS
ListTaskDefinitionFamilies -> String
(Int -> ListTaskDefinitionFamilies -> ShowS)
-> (ListTaskDefinitionFamilies -> String)
-> ([ListTaskDefinitionFamilies] -> ShowS)
-> Show ListTaskDefinitionFamilies
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListTaskDefinitionFamilies] -> ShowS
$cshowList :: [ListTaskDefinitionFamilies] -> ShowS
show :: ListTaskDefinitionFamilies -> String
$cshow :: ListTaskDefinitionFamilies -> String
showsPrec :: Int -> ListTaskDefinitionFamilies -> ShowS
$cshowsPrec :: Int -> ListTaskDefinitionFamilies -> ShowS
Prelude.Show, (forall x.
 ListTaskDefinitionFamilies -> Rep ListTaskDefinitionFamilies x)
-> (forall x.
    Rep ListTaskDefinitionFamilies x -> ListTaskDefinitionFamilies)
-> Generic ListTaskDefinitionFamilies
forall x.
Rep ListTaskDefinitionFamilies x -> ListTaskDefinitionFamilies
forall x.
ListTaskDefinitionFamilies -> Rep ListTaskDefinitionFamilies x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListTaskDefinitionFamilies x -> ListTaskDefinitionFamilies
$cfrom :: forall x.
ListTaskDefinitionFamilies -> Rep ListTaskDefinitionFamilies x
Prelude.Generic)

-- |
-- Create a value of 'ListTaskDefinitionFamilies' 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', 'listTaskDefinitionFamilies_status' - The task definition family status with which to filter the
-- @ListTaskDefinitionFamilies@ results. By default, both @ACTIVE@ and
-- @INACTIVE@ task definition families are listed. If this parameter is set
-- to @ACTIVE@, only task definition families that have an @ACTIVE@ task
-- definition revision are returned. If this parameter is set to
-- @INACTIVE@, only task definition families that do not have any @ACTIVE@
-- task definition revisions are returned. If you paginate the resulting
-- output, be sure to keep the @status@ value constant in each subsequent
-- request.
--
-- 'familyPrefix', 'listTaskDefinitionFamilies_familyPrefix' - The @familyPrefix@ is a string that is used to filter the results of
-- @ListTaskDefinitionFamilies@. If you specify a @familyPrefix@, only task
-- definition family names that begin with the @familyPrefix@ string are
-- returned.
--
-- 'nextToken', 'listTaskDefinitionFamilies_nextToken' - The @nextToken@ value returned from a @ListTaskDefinitionFamilies@
-- 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.
--
-- 'maxResults', 'listTaskDefinitionFamilies_maxResults' - The maximum number of task definition family results returned by
-- @ListTaskDefinitionFamilies@ 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
-- @ListTaskDefinitionFamilies@ request with the returned @nextToken@
-- value. This value can be between 1 and 100. If this parameter is not
-- used, then @ListTaskDefinitionFamilies@ returns up to 100 results and a
-- @nextToken@ value if applicable.
newListTaskDefinitionFamilies ::
  ListTaskDefinitionFamilies
newListTaskDefinitionFamilies :: ListTaskDefinitionFamilies
newListTaskDefinitionFamilies =
  ListTaskDefinitionFamilies' :: Maybe TaskDefinitionFamilyStatus
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> ListTaskDefinitionFamilies
ListTaskDefinitionFamilies'
    { $sel:status:ListTaskDefinitionFamilies' :: Maybe TaskDefinitionFamilyStatus
status =
        Maybe TaskDefinitionFamilyStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:familyPrefix:ListTaskDefinitionFamilies' :: Maybe Text
familyPrefix = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListTaskDefinitionFamilies' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListTaskDefinitionFamilies' :: Maybe Int
maxResults = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The task definition family status with which to filter the
-- @ListTaskDefinitionFamilies@ results. By default, both @ACTIVE@ and
-- @INACTIVE@ task definition families are listed. If this parameter is set
-- to @ACTIVE@, only task definition families that have an @ACTIVE@ task
-- definition revision are returned. If this parameter is set to
-- @INACTIVE@, only task definition families that do not have any @ACTIVE@
-- task definition revisions are returned. If you paginate the resulting
-- output, be sure to keep the @status@ value constant in each subsequent
-- request.
listTaskDefinitionFamilies_status :: Lens.Lens' ListTaskDefinitionFamilies (Prelude.Maybe TaskDefinitionFamilyStatus)
listTaskDefinitionFamilies_status :: (Maybe TaskDefinitionFamilyStatus
 -> f (Maybe TaskDefinitionFamilyStatus))
-> ListTaskDefinitionFamilies -> f ListTaskDefinitionFamilies
listTaskDefinitionFamilies_status = (ListTaskDefinitionFamilies -> Maybe TaskDefinitionFamilyStatus)
-> (ListTaskDefinitionFamilies
    -> Maybe TaskDefinitionFamilyStatus -> ListTaskDefinitionFamilies)
-> Lens
     ListTaskDefinitionFamilies
     ListTaskDefinitionFamilies
     (Maybe TaskDefinitionFamilyStatus)
     (Maybe TaskDefinitionFamilyStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTaskDefinitionFamilies' {Maybe TaskDefinitionFamilyStatus
status :: Maybe TaskDefinitionFamilyStatus
$sel:status:ListTaskDefinitionFamilies' :: ListTaskDefinitionFamilies -> Maybe TaskDefinitionFamilyStatus
status} -> Maybe TaskDefinitionFamilyStatus
status) (\s :: ListTaskDefinitionFamilies
s@ListTaskDefinitionFamilies' {} Maybe TaskDefinitionFamilyStatus
a -> ListTaskDefinitionFamilies
s {$sel:status:ListTaskDefinitionFamilies' :: Maybe TaskDefinitionFamilyStatus
status = Maybe TaskDefinitionFamilyStatus
a} :: ListTaskDefinitionFamilies)

-- | The @familyPrefix@ is a string that is used to filter the results of
-- @ListTaskDefinitionFamilies@. If you specify a @familyPrefix@, only task
-- definition family names that begin with the @familyPrefix@ string are
-- returned.
listTaskDefinitionFamilies_familyPrefix :: Lens.Lens' ListTaskDefinitionFamilies (Prelude.Maybe Prelude.Text)
listTaskDefinitionFamilies_familyPrefix :: (Maybe Text -> f (Maybe Text))
-> ListTaskDefinitionFamilies -> f ListTaskDefinitionFamilies
listTaskDefinitionFamilies_familyPrefix = (ListTaskDefinitionFamilies -> Maybe Text)
-> (ListTaskDefinitionFamilies
    -> Maybe Text -> ListTaskDefinitionFamilies)
-> Lens
     ListTaskDefinitionFamilies
     ListTaskDefinitionFamilies
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTaskDefinitionFamilies' {Maybe Text
familyPrefix :: Maybe Text
$sel:familyPrefix:ListTaskDefinitionFamilies' :: ListTaskDefinitionFamilies -> Maybe Text
familyPrefix} -> Maybe Text
familyPrefix) (\s :: ListTaskDefinitionFamilies
s@ListTaskDefinitionFamilies' {} Maybe Text
a -> ListTaskDefinitionFamilies
s {$sel:familyPrefix:ListTaskDefinitionFamilies' :: Maybe Text
familyPrefix = Maybe Text
a} :: ListTaskDefinitionFamilies)

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

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

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

instance Prelude.NFData ListTaskDefinitionFamilies

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

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

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

-- |
-- Create a value of 'ListTaskDefinitionFamiliesResponse' 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:
--
-- 'families', 'listTaskDefinitionFamiliesResponse_families' - The list of task definition family names that match the
-- @ListTaskDefinitionFamilies@ request.
--
-- 'nextToken', 'listTaskDefinitionFamiliesResponse_nextToken' - The @nextToken@ value to include in a future
-- @ListTaskDefinitionFamilies@ request. When the results of a
-- @ListTaskDefinitionFamilies@ 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', 'listTaskDefinitionFamiliesResponse_httpStatus' - The response's http status code.
newListTaskDefinitionFamiliesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListTaskDefinitionFamiliesResponse
newListTaskDefinitionFamiliesResponse :: Int -> ListTaskDefinitionFamiliesResponse
newListTaskDefinitionFamiliesResponse Int
pHttpStatus_ =
  ListTaskDefinitionFamiliesResponse' :: Maybe [Text]
-> Maybe Text -> Int -> ListTaskDefinitionFamiliesResponse
ListTaskDefinitionFamiliesResponse'
    { $sel:families:ListTaskDefinitionFamiliesResponse' :: Maybe [Text]
families =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListTaskDefinitionFamiliesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListTaskDefinitionFamiliesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The list of task definition family names that match the
-- @ListTaskDefinitionFamilies@ request.
listTaskDefinitionFamiliesResponse_families :: Lens.Lens' ListTaskDefinitionFamiliesResponse (Prelude.Maybe [Prelude.Text])
listTaskDefinitionFamiliesResponse_families :: (Maybe [Text] -> f (Maybe [Text]))
-> ListTaskDefinitionFamiliesResponse
-> f ListTaskDefinitionFamiliesResponse
listTaskDefinitionFamiliesResponse_families = (ListTaskDefinitionFamiliesResponse -> Maybe [Text])
-> (ListTaskDefinitionFamiliesResponse
    -> Maybe [Text] -> ListTaskDefinitionFamiliesResponse)
-> Lens' ListTaskDefinitionFamiliesResponse (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTaskDefinitionFamiliesResponse' {Maybe [Text]
families :: Maybe [Text]
$sel:families:ListTaskDefinitionFamiliesResponse' :: ListTaskDefinitionFamiliesResponse -> Maybe [Text]
families} -> Maybe [Text]
families) (\s :: ListTaskDefinitionFamiliesResponse
s@ListTaskDefinitionFamiliesResponse' {} Maybe [Text]
a -> ListTaskDefinitionFamiliesResponse
s {$sel:families:ListTaskDefinitionFamiliesResponse' :: Maybe [Text]
families = Maybe [Text]
a} :: ListTaskDefinitionFamiliesResponse) ((Maybe [Text] -> f (Maybe [Text]))
 -> ListTaskDefinitionFamiliesResponse
 -> f ListTaskDefinitionFamiliesResponse)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ListTaskDefinitionFamiliesResponse
-> f ListTaskDefinitionFamiliesResponse
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
-- @ListTaskDefinitionFamilies@ request. When the results of a
-- @ListTaskDefinitionFamilies@ 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.
listTaskDefinitionFamiliesResponse_nextToken :: Lens.Lens' ListTaskDefinitionFamiliesResponse (Prelude.Maybe Prelude.Text)
listTaskDefinitionFamiliesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListTaskDefinitionFamiliesResponse
-> f ListTaskDefinitionFamiliesResponse
listTaskDefinitionFamiliesResponse_nextToken = (ListTaskDefinitionFamiliesResponse -> Maybe Text)
-> (ListTaskDefinitionFamiliesResponse
    -> Maybe Text -> ListTaskDefinitionFamiliesResponse)
-> Lens' ListTaskDefinitionFamiliesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTaskDefinitionFamiliesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListTaskDefinitionFamiliesResponse' :: ListTaskDefinitionFamiliesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListTaskDefinitionFamiliesResponse
s@ListTaskDefinitionFamiliesResponse' {} Maybe Text
a -> ListTaskDefinitionFamiliesResponse
s {$sel:nextToken:ListTaskDefinitionFamiliesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListTaskDefinitionFamiliesResponse)

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

instance
  Prelude.NFData
    ListTaskDefinitionFamiliesResponse