{-# 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.SageMaker.ListModelPackageGroups
-- 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)
--
-- Gets a list of the model groups in your Amazon Web Services account.
--
-- This operation returns paginated results.
module Amazonka.SageMaker.ListModelPackageGroups
  ( -- * Creating a Request
    ListModelPackageGroups (..),
    newListModelPackageGroups,

    -- * Request Lenses
    listModelPackageGroups_nameContains,
    listModelPackageGroups_creationTimeAfter,
    listModelPackageGroups_nextToken,
    listModelPackageGroups_sortOrder,
    listModelPackageGroups_creationTimeBefore,
    listModelPackageGroups_maxResults,
    listModelPackageGroups_sortBy,

    -- * Destructuring the Response
    ListModelPackageGroupsResponse (..),
    newListModelPackageGroupsResponse,

    -- * Response Lenses
    listModelPackageGroupsResponse_nextToken,
    listModelPackageGroupsResponse_httpStatus,
    listModelPackageGroupsResponse_modelPackageGroupSummaryList,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SageMaker.Types

-- | /See:/ 'newListModelPackageGroups' smart constructor.
data ListModelPackageGroups = ListModelPackageGroups'
  { -- | A string in the model group name. This filter returns only model groups
    -- whose name contains the specified string.
    ListModelPackageGroups -> Maybe Text
nameContains :: Prelude.Maybe Prelude.Text,
    -- | A filter that returns only model groups created after the specified
    -- time.
    ListModelPackageGroups -> Maybe POSIX
creationTimeAfter :: Prelude.Maybe Core.POSIX,
    -- | If the result of the previous @ListModelPackageGroups@ request was
    -- truncated, the response includes a @NextToken@. To retrieve the next set
    -- of model groups, use the token in the next request.
    ListModelPackageGroups -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The sort order for results. The default is @Ascending@.
    ListModelPackageGroups -> Maybe SortOrder
sortOrder :: Prelude.Maybe SortOrder,
    -- | A filter that returns only model groups created before the specified
    -- time.
    ListModelPackageGroups -> Maybe POSIX
creationTimeBefore :: Prelude.Maybe Core.POSIX,
    -- | The maximum number of results to return in the response.
    ListModelPackageGroups -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The field to sort results by. The default is @CreationTime@.
    ListModelPackageGroups -> Maybe ModelPackageGroupSortBy
sortBy :: Prelude.Maybe ModelPackageGroupSortBy
  }
  deriving (ListModelPackageGroups -> ListModelPackageGroups -> Bool
(ListModelPackageGroups -> ListModelPackageGroups -> Bool)
-> (ListModelPackageGroups -> ListModelPackageGroups -> Bool)
-> Eq ListModelPackageGroups
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListModelPackageGroups -> ListModelPackageGroups -> Bool
$c/= :: ListModelPackageGroups -> ListModelPackageGroups -> Bool
== :: ListModelPackageGroups -> ListModelPackageGroups -> Bool
$c== :: ListModelPackageGroups -> ListModelPackageGroups -> Bool
Prelude.Eq, ReadPrec [ListModelPackageGroups]
ReadPrec ListModelPackageGroups
Int -> ReadS ListModelPackageGroups
ReadS [ListModelPackageGroups]
(Int -> ReadS ListModelPackageGroups)
-> ReadS [ListModelPackageGroups]
-> ReadPrec ListModelPackageGroups
-> ReadPrec [ListModelPackageGroups]
-> Read ListModelPackageGroups
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListModelPackageGroups]
$creadListPrec :: ReadPrec [ListModelPackageGroups]
readPrec :: ReadPrec ListModelPackageGroups
$creadPrec :: ReadPrec ListModelPackageGroups
readList :: ReadS [ListModelPackageGroups]
$creadList :: ReadS [ListModelPackageGroups]
readsPrec :: Int -> ReadS ListModelPackageGroups
$creadsPrec :: Int -> ReadS ListModelPackageGroups
Prelude.Read, Int -> ListModelPackageGroups -> ShowS
[ListModelPackageGroups] -> ShowS
ListModelPackageGroups -> String
(Int -> ListModelPackageGroups -> ShowS)
-> (ListModelPackageGroups -> String)
-> ([ListModelPackageGroups] -> ShowS)
-> Show ListModelPackageGroups
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListModelPackageGroups] -> ShowS
$cshowList :: [ListModelPackageGroups] -> ShowS
show :: ListModelPackageGroups -> String
$cshow :: ListModelPackageGroups -> String
showsPrec :: Int -> ListModelPackageGroups -> ShowS
$cshowsPrec :: Int -> ListModelPackageGroups -> ShowS
Prelude.Show, (forall x. ListModelPackageGroups -> Rep ListModelPackageGroups x)
-> (forall x.
    Rep ListModelPackageGroups x -> ListModelPackageGroups)
-> Generic ListModelPackageGroups
forall x. Rep ListModelPackageGroups x -> ListModelPackageGroups
forall x. ListModelPackageGroups -> Rep ListModelPackageGroups x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListModelPackageGroups x -> ListModelPackageGroups
$cfrom :: forall x. ListModelPackageGroups -> Rep ListModelPackageGroups x
Prelude.Generic)

-- |
-- Create a value of 'ListModelPackageGroups' 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:
--
-- 'nameContains', 'listModelPackageGroups_nameContains' - A string in the model group name. This filter returns only model groups
-- whose name contains the specified string.
--
-- 'creationTimeAfter', 'listModelPackageGroups_creationTimeAfter' - A filter that returns only model groups created after the specified
-- time.
--
-- 'nextToken', 'listModelPackageGroups_nextToken' - If the result of the previous @ListModelPackageGroups@ request was
-- truncated, the response includes a @NextToken@. To retrieve the next set
-- of model groups, use the token in the next request.
--
-- 'sortOrder', 'listModelPackageGroups_sortOrder' - The sort order for results. The default is @Ascending@.
--
-- 'creationTimeBefore', 'listModelPackageGroups_creationTimeBefore' - A filter that returns only model groups created before the specified
-- time.
--
-- 'maxResults', 'listModelPackageGroups_maxResults' - The maximum number of results to return in the response.
--
-- 'sortBy', 'listModelPackageGroups_sortBy' - The field to sort results by. The default is @CreationTime@.
newListModelPackageGroups ::
  ListModelPackageGroups
newListModelPackageGroups :: ListModelPackageGroups
newListModelPackageGroups =
  ListModelPackageGroups' :: Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe SortOrder
-> Maybe POSIX
-> Maybe Natural
-> Maybe ModelPackageGroupSortBy
-> ListModelPackageGroups
ListModelPackageGroups'
    { $sel:nameContains:ListModelPackageGroups' :: Maybe Text
nameContains =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:creationTimeAfter:ListModelPackageGroups' :: Maybe POSIX
creationTimeAfter = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListModelPackageGroups' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sortOrder:ListModelPackageGroups' :: Maybe SortOrder
sortOrder = Maybe SortOrder
forall a. Maybe a
Prelude.Nothing,
      $sel:creationTimeBefore:ListModelPackageGroups' :: Maybe POSIX
creationTimeBefore = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListModelPackageGroups' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:sortBy:ListModelPackageGroups' :: Maybe ModelPackageGroupSortBy
sortBy = Maybe ModelPackageGroupSortBy
forall a. Maybe a
Prelude.Nothing
    }

-- | A string in the model group name. This filter returns only model groups
-- whose name contains the specified string.
listModelPackageGroups_nameContains :: Lens.Lens' ListModelPackageGroups (Prelude.Maybe Prelude.Text)
listModelPackageGroups_nameContains :: (Maybe Text -> f (Maybe Text))
-> ListModelPackageGroups -> f ListModelPackageGroups
listModelPackageGroups_nameContains = (ListModelPackageGroups -> Maybe Text)
-> (ListModelPackageGroups -> Maybe Text -> ListModelPackageGroups)
-> Lens
     ListModelPackageGroups
     ListModelPackageGroups
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListModelPackageGroups' {Maybe Text
nameContains :: Maybe Text
$sel:nameContains:ListModelPackageGroups' :: ListModelPackageGroups -> Maybe Text
nameContains} -> Maybe Text
nameContains) (\s :: ListModelPackageGroups
s@ListModelPackageGroups' {} Maybe Text
a -> ListModelPackageGroups
s {$sel:nameContains:ListModelPackageGroups' :: Maybe Text
nameContains = Maybe Text
a} :: ListModelPackageGroups)

-- | A filter that returns only model groups created after the specified
-- time.
listModelPackageGroups_creationTimeAfter :: Lens.Lens' ListModelPackageGroups (Prelude.Maybe Prelude.UTCTime)
listModelPackageGroups_creationTimeAfter :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ListModelPackageGroups -> f ListModelPackageGroups
listModelPackageGroups_creationTimeAfter = (ListModelPackageGroups -> Maybe POSIX)
-> (ListModelPackageGroups
    -> Maybe POSIX -> ListModelPackageGroups)
-> Lens
     ListModelPackageGroups
     ListModelPackageGroups
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListModelPackageGroups' {Maybe POSIX
creationTimeAfter :: Maybe POSIX
$sel:creationTimeAfter:ListModelPackageGroups' :: ListModelPackageGroups -> Maybe POSIX
creationTimeAfter} -> Maybe POSIX
creationTimeAfter) (\s :: ListModelPackageGroups
s@ListModelPackageGroups' {} Maybe POSIX
a -> ListModelPackageGroups
s {$sel:creationTimeAfter:ListModelPackageGroups' :: Maybe POSIX
creationTimeAfter = Maybe POSIX
a} :: ListModelPackageGroups) ((Maybe POSIX -> f (Maybe POSIX))
 -> ListModelPackageGroups -> f ListModelPackageGroups)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ListModelPackageGroups
-> f ListModelPackageGroups
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | If the result of the previous @ListModelPackageGroups@ request was
-- truncated, the response includes a @NextToken@. To retrieve the next set
-- of model groups, use the token in the next request.
listModelPackageGroups_nextToken :: Lens.Lens' ListModelPackageGroups (Prelude.Maybe Prelude.Text)
listModelPackageGroups_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListModelPackageGroups -> f ListModelPackageGroups
listModelPackageGroups_nextToken = (ListModelPackageGroups -> Maybe Text)
-> (ListModelPackageGroups -> Maybe Text -> ListModelPackageGroups)
-> Lens
     ListModelPackageGroups
     ListModelPackageGroups
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListModelPackageGroups' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListModelPackageGroups' :: ListModelPackageGroups -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListModelPackageGroups
s@ListModelPackageGroups' {} Maybe Text
a -> ListModelPackageGroups
s {$sel:nextToken:ListModelPackageGroups' :: Maybe Text
nextToken = Maybe Text
a} :: ListModelPackageGroups)

-- | The sort order for results. The default is @Ascending@.
listModelPackageGroups_sortOrder :: Lens.Lens' ListModelPackageGroups (Prelude.Maybe SortOrder)
listModelPackageGroups_sortOrder :: (Maybe SortOrder -> f (Maybe SortOrder))
-> ListModelPackageGroups -> f ListModelPackageGroups
listModelPackageGroups_sortOrder = (ListModelPackageGroups -> Maybe SortOrder)
-> (ListModelPackageGroups
    -> Maybe SortOrder -> ListModelPackageGroups)
-> Lens
     ListModelPackageGroups
     ListModelPackageGroups
     (Maybe SortOrder)
     (Maybe SortOrder)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListModelPackageGroups' {Maybe SortOrder
sortOrder :: Maybe SortOrder
$sel:sortOrder:ListModelPackageGroups' :: ListModelPackageGroups -> Maybe SortOrder
sortOrder} -> Maybe SortOrder
sortOrder) (\s :: ListModelPackageGroups
s@ListModelPackageGroups' {} Maybe SortOrder
a -> ListModelPackageGroups
s {$sel:sortOrder:ListModelPackageGroups' :: Maybe SortOrder
sortOrder = Maybe SortOrder
a} :: ListModelPackageGroups)

-- | A filter that returns only model groups created before the specified
-- time.
listModelPackageGroups_creationTimeBefore :: Lens.Lens' ListModelPackageGroups (Prelude.Maybe Prelude.UTCTime)
listModelPackageGroups_creationTimeBefore :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ListModelPackageGroups -> f ListModelPackageGroups
listModelPackageGroups_creationTimeBefore = (ListModelPackageGroups -> Maybe POSIX)
-> (ListModelPackageGroups
    -> Maybe POSIX -> ListModelPackageGroups)
-> Lens
     ListModelPackageGroups
     ListModelPackageGroups
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListModelPackageGroups' {Maybe POSIX
creationTimeBefore :: Maybe POSIX
$sel:creationTimeBefore:ListModelPackageGroups' :: ListModelPackageGroups -> Maybe POSIX
creationTimeBefore} -> Maybe POSIX
creationTimeBefore) (\s :: ListModelPackageGroups
s@ListModelPackageGroups' {} Maybe POSIX
a -> ListModelPackageGroups
s {$sel:creationTimeBefore:ListModelPackageGroups' :: Maybe POSIX
creationTimeBefore = Maybe POSIX
a} :: ListModelPackageGroups) ((Maybe POSIX -> f (Maybe POSIX))
 -> ListModelPackageGroups -> f ListModelPackageGroups)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ListModelPackageGroups
-> f ListModelPackageGroups
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The maximum number of results to return in the response.
listModelPackageGroups_maxResults :: Lens.Lens' ListModelPackageGroups (Prelude.Maybe Prelude.Natural)
listModelPackageGroups_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListModelPackageGroups -> f ListModelPackageGroups
listModelPackageGroups_maxResults = (ListModelPackageGroups -> Maybe Natural)
-> (ListModelPackageGroups
    -> Maybe Natural -> ListModelPackageGroups)
-> Lens
     ListModelPackageGroups
     ListModelPackageGroups
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListModelPackageGroups' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListModelPackageGroups' :: ListModelPackageGroups -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListModelPackageGroups
s@ListModelPackageGroups' {} Maybe Natural
a -> ListModelPackageGroups
s {$sel:maxResults:ListModelPackageGroups' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListModelPackageGroups)

-- | The field to sort results by. The default is @CreationTime@.
listModelPackageGroups_sortBy :: Lens.Lens' ListModelPackageGroups (Prelude.Maybe ModelPackageGroupSortBy)
listModelPackageGroups_sortBy :: (Maybe ModelPackageGroupSortBy
 -> f (Maybe ModelPackageGroupSortBy))
-> ListModelPackageGroups -> f ListModelPackageGroups
listModelPackageGroups_sortBy = (ListModelPackageGroups -> Maybe ModelPackageGroupSortBy)
-> (ListModelPackageGroups
    -> Maybe ModelPackageGroupSortBy -> ListModelPackageGroups)
-> Lens
     ListModelPackageGroups
     ListModelPackageGroups
     (Maybe ModelPackageGroupSortBy)
     (Maybe ModelPackageGroupSortBy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListModelPackageGroups' {Maybe ModelPackageGroupSortBy
sortBy :: Maybe ModelPackageGroupSortBy
$sel:sortBy:ListModelPackageGroups' :: ListModelPackageGroups -> Maybe ModelPackageGroupSortBy
sortBy} -> Maybe ModelPackageGroupSortBy
sortBy) (\s :: ListModelPackageGroups
s@ListModelPackageGroups' {} Maybe ModelPackageGroupSortBy
a -> ListModelPackageGroups
s {$sel:sortBy:ListModelPackageGroups' :: Maybe ModelPackageGroupSortBy
sortBy = Maybe ModelPackageGroupSortBy
a} :: ListModelPackageGroups)

instance Core.AWSPager ListModelPackageGroups where
  page :: ListModelPackageGroups
-> AWSResponse ListModelPackageGroups
-> Maybe ListModelPackageGroups
page ListModelPackageGroups
rq AWSResponse ListModelPackageGroups
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListModelPackageGroups
ListModelPackageGroupsResponse
rs
            ListModelPackageGroupsResponse
-> Getting (First Text) ListModelPackageGroupsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListModelPackageGroupsResponse
-> Const (First Text) ListModelPackageGroupsResponse
Lens' ListModelPackageGroupsResponse (Maybe Text)
listModelPackageGroupsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListModelPackageGroupsResponse
 -> Const (First Text) ListModelPackageGroupsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListModelPackageGroupsResponse 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 ListModelPackageGroups
forall a. Maybe a
Prelude.Nothing
    | [ModelPackageGroupSummary] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListModelPackageGroups
ListModelPackageGroupsResponse
rs
            ListModelPackageGroupsResponse
-> Getting
     [ModelPackageGroupSummary]
     ListModelPackageGroupsResponse
     [ModelPackageGroupSummary]
-> [ModelPackageGroupSummary]
forall s a. s -> Getting a s a -> a
Lens.^. Getting
  [ModelPackageGroupSummary]
  ListModelPackageGroupsResponse
  [ModelPackageGroupSummary]
Lens' ListModelPackageGroupsResponse [ModelPackageGroupSummary]
listModelPackageGroupsResponse_modelPackageGroupSummaryList
        ) =
      Maybe ListModelPackageGroups
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListModelPackageGroups -> Maybe ListModelPackageGroups
forall a. a -> Maybe a
Prelude.Just (ListModelPackageGroups -> Maybe ListModelPackageGroups)
-> ListModelPackageGroups -> Maybe ListModelPackageGroups
forall a b. (a -> b) -> a -> b
Prelude.$
        ListModelPackageGroups
rq
          ListModelPackageGroups
-> (ListModelPackageGroups -> ListModelPackageGroups)
-> ListModelPackageGroups
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListModelPackageGroups -> Identity ListModelPackageGroups
Lens
  ListModelPackageGroups
  ListModelPackageGroups
  (Maybe Text)
  (Maybe Text)
listModelPackageGroups_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListModelPackageGroups -> Identity ListModelPackageGroups)
-> Maybe Text -> ListModelPackageGroups -> ListModelPackageGroups
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListModelPackageGroups
ListModelPackageGroupsResponse
rs
          ListModelPackageGroupsResponse
-> Getting (First Text) ListModelPackageGroupsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListModelPackageGroupsResponse
-> Const (First Text) ListModelPackageGroupsResponse
Lens' ListModelPackageGroupsResponse (Maybe Text)
listModelPackageGroupsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListModelPackageGroupsResponse
 -> Const (First Text) ListModelPackageGroupsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListModelPackageGroupsResponse 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 ListModelPackageGroups where
  type
    AWSResponse ListModelPackageGroups =
      ListModelPackageGroupsResponse
  request :: ListModelPackageGroups -> Request ListModelPackageGroups
request = Service -> ListModelPackageGroups -> Request ListModelPackageGroups
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListModelPackageGroups
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListModelPackageGroups)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListModelPackageGroups))
-> Logger
-> Service
-> Proxy ListModelPackageGroups
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListModelPackageGroups)))
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
-> Int
-> [ModelPackageGroupSummary]
-> ListModelPackageGroupsResponse
ListModelPackageGroupsResponse'
            (Maybe Text
 -> Int
 -> [ModelPackageGroupSummary]
 -> ListModelPackageGroupsResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Int
      -> [ModelPackageGroupSummary] -> ListModelPackageGroupsResponse)
forall (f :: * -> *) a b. Functor 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
   -> [ModelPackageGroupSummary] -> ListModelPackageGroupsResponse)
-> Either String Int
-> Either
     String
     ([ModelPackageGroupSummary] -> ListModelPackageGroupsResponse)
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))
            Either
  String
  ([ModelPackageGroupSummary] -> ListModelPackageGroupsResponse)
-> Either String [ModelPackageGroupSummary]
-> Either String ListModelPackageGroupsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Either String (Maybe [ModelPackageGroupSummary])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ModelPackageGroupSummaryList"
                            Either String (Maybe [ModelPackageGroupSummary])
-> [ModelPackageGroupSummary]
-> Either String [ModelPackageGroupSummary]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [ModelPackageGroupSummary]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable ListModelPackageGroups

instance Prelude.NFData ListModelPackageGroups

instance Core.ToHeaders ListModelPackageGroups where
  toHeaders :: ListModelPackageGroups -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListModelPackageGroups -> 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
"SageMaker.ListModelPackageGroups" ::
                          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 ListModelPackageGroups where
  toJSON :: ListModelPackageGroups -> Value
toJSON ListModelPackageGroups' {Maybe Natural
Maybe Text
Maybe POSIX
Maybe ModelPackageGroupSortBy
Maybe SortOrder
sortBy :: Maybe ModelPackageGroupSortBy
maxResults :: Maybe Natural
creationTimeBefore :: Maybe POSIX
sortOrder :: Maybe SortOrder
nextToken :: Maybe Text
creationTimeAfter :: Maybe POSIX
nameContains :: Maybe Text
$sel:sortBy:ListModelPackageGroups' :: ListModelPackageGroups -> Maybe ModelPackageGroupSortBy
$sel:maxResults:ListModelPackageGroups' :: ListModelPackageGroups -> Maybe Natural
$sel:creationTimeBefore:ListModelPackageGroups' :: ListModelPackageGroups -> Maybe POSIX
$sel:sortOrder:ListModelPackageGroups' :: ListModelPackageGroups -> Maybe SortOrder
$sel:nextToken:ListModelPackageGroups' :: ListModelPackageGroups -> Maybe Text
$sel:creationTimeAfter:ListModelPackageGroups' :: ListModelPackageGroups -> Maybe POSIX
$sel:nameContains:ListModelPackageGroups' :: ListModelPackageGroups -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"NameContains" 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
nameContains,
            (Text
"CreationTimeAfter" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
creationTimeAfter,
            (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
"SortOrder" 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
sortOrder,
            (Text
"CreationTimeBefore" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
creationTimeBefore,
            (Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            (Text
"SortBy" Text -> ModelPackageGroupSortBy -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ModelPackageGroupSortBy -> Pair)
-> Maybe ModelPackageGroupSortBy -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ModelPackageGroupSortBy
sortBy
          ]
      )

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

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

-- | /See:/ 'newListModelPackageGroupsResponse' smart constructor.
data ListModelPackageGroupsResponse = ListModelPackageGroupsResponse'
  { -- | If the response is truncated, SageMaker returns this token. To retrieve
    -- the next set of model groups, use it in the subsequent request.
    ListModelPackageGroupsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListModelPackageGroupsResponse -> Int
httpStatus :: Prelude.Int,
    -- | A list of summaries of the model groups in your Amazon Web Services
    -- account.
    ListModelPackageGroupsResponse -> [ModelPackageGroupSummary]
modelPackageGroupSummaryList :: [ModelPackageGroupSummary]
  }
  deriving (ListModelPackageGroupsResponse
-> ListModelPackageGroupsResponse -> Bool
(ListModelPackageGroupsResponse
 -> ListModelPackageGroupsResponse -> Bool)
-> (ListModelPackageGroupsResponse
    -> ListModelPackageGroupsResponse -> Bool)
-> Eq ListModelPackageGroupsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListModelPackageGroupsResponse
-> ListModelPackageGroupsResponse -> Bool
$c/= :: ListModelPackageGroupsResponse
-> ListModelPackageGroupsResponse -> Bool
== :: ListModelPackageGroupsResponse
-> ListModelPackageGroupsResponse -> Bool
$c== :: ListModelPackageGroupsResponse
-> ListModelPackageGroupsResponse -> Bool
Prelude.Eq, ReadPrec [ListModelPackageGroupsResponse]
ReadPrec ListModelPackageGroupsResponse
Int -> ReadS ListModelPackageGroupsResponse
ReadS [ListModelPackageGroupsResponse]
(Int -> ReadS ListModelPackageGroupsResponse)
-> ReadS [ListModelPackageGroupsResponse]
-> ReadPrec ListModelPackageGroupsResponse
-> ReadPrec [ListModelPackageGroupsResponse]
-> Read ListModelPackageGroupsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListModelPackageGroupsResponse]
$creadListPrec :: ReadPrec [ListModelPackageGroupsResponse]
readPrec :: ReadPrec ListModelPackageGroupsResponse
$creadPrec :: ReadPrec ListModelPackageGroupsResponse
readList :: ReadS [ListModelPackageGroupsResponse]
$creadList :: ReadS [ListModelPackageGroupsResponse]
readsPrec :: Int -> ReadS ListModelPackageGroupsResponse
$creadsPrec :: Int -> ReadS ListModelPackageGroupsResponse
Prelude.Read, Int -> ListModelPackageGroupsResponse -> ShowS
[ListModelPackageGroupsResponse] -> ShowS
ListModelPackageGroupsResponse -> String
(Int -> ListModelPackageGroupsResponse -> ShowS)
-> (ListModelPackageGroupsResponse -> String)
-> ([ListModelPackageGroupsResponse] -> ShowS)
-> Show ListModelPackageGroupsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListModelPackageGroupsResponse] -> ShowS
$cshowList :: [ListModelPackageGroupsResponse] -> ShowS
show :: ListModelPackageGroupsResponse -> String
$cshow :: ListModelPackageGroupsResponse -> String
showsPrec :: Int -> ListModelPackageGroupsResponse -> ShowS
$cshowsPrec :: Int -> ListModelPackageGroupsResponse -> ShowS
Prelude.Show, (forall x.
 ListModelPackageGroupsResponse
 -> Rep ListModelPackageGroupsResponse x)
-> (forall x.
    Rep ListModelPackageGroupsResponse x
    -> ListModelPackageGroupsResponse)
-> Generic ListModelPackageGroupsResponse
forall x.
Rep ListModelPackageGroupsResponse x
-> ListModelPackageGroupsResponse
forall x.
ListModelPackageGroupsResponse
-> Rep ListModelPackageGroupsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListModelPackageGroupsResponse x
-> ListModelPackageGroupsResponse
$cfrom :: forall x.
ListModelPackageGroupsResponse
-> Rep ListModelPackageGroupsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListModelPackageGroupsResponse' 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', 'listModelPackageGroupsResponse_nextToken' - If the response is truncated, SageMaker returns this token. To retrieve
-- the next set of model groups, use it in the subsequent request.
--
-- 'httpStatus', 'listModelPackageGroupsResponse_httpStatus' - The response's http status code.
--
-- 'modelPackageGroupSummaryList', 'listModelPackageGroupsResponse_modelPackageGroupSummaryList' - A list of summaries of the model groups in your Amazon Web Services
-- account.
newListModelPackageGroupsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListModelPackageGroupsResponse
newListModelPackageGroupsResponse :: Int -> ListModelPackageGroupsResponse
newListModelPackageGroupsResponse Int
pHttpStatus_ =
  ListModelPackageGroupsResponse' :: Maybe Text
-> Int
-> [ModelPackageGroupSummary]
-> ListModelPackageGroupsResponse
ListModelPackageGroupsResponse'
    { $sel:nextToken:ListModelPackageGroupsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListModelPackageGroupsResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:modelPackageGroupSummaryList:ListModelPackageGroupsResponse' :: [ModelPackageGroupSummary]
modelPackageGroupSummaryList =
        [ModelPackageGroupSummary]
forall a. Monoid a => a
Prelude.mempty
    }

-- | If the response is truncated, SageMaker returns this token. To retrieve
-- the next set of model groups, use it in the subsequent request.
listModelPackageGroupsResponse_nextToken :: Lens.Lens' ListModelPackageGroupsResponse (Prelude.Maybe Prelude.Text)
listModelPackageGroupsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListModelPackageGroupsResponse
-> f ListModelPackageGroupsResponse
listModelPackageGroupsResponse_nextToken = (ListModelPackageGroupsResponse -> Maybe Text)
-> (ListModelPackageGroupsResponse
    -> Maybe Text -> ListModelPackageGroupsResponse)
-> Lens' ListModelPackageGroupsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListModelPackageGroupsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListModelPackageGroupsResponse' :: ListModelPackageGroupsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListModelPackageGroupsResponse
s@ListModelPackageGroupsResponse' {} Maybe Text
a -> ListModelPackageGroupsResponse
s {$sel:nextToken:ListModelPackageGroupsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListModelPackageGroupsResponse)

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

-- | A list of summaries of the model groups in your Amazon Web Services
-- account.
listModelPackageGroupsResponse_modelPackageGroupSummaryList :: Lens.Lens' ListModelPackageGroupsResponse [ModelPackageGroupSummary]
listModelPackageGroupsResponse_modelPackageGroupSummaryList :: ([ModelPackageGroupSummary] -> f [ModelPackageGroupSummary])
-> ListModelPackageGroupsResponse
-> f ListModelPackageGroupsResponse
listModelPackageGroupsResponse_modelPackageGroupSummaryList = (ListModelPackageGroupsResponse -> [ModelPackageGroupSummary])
-> (ListModelPackageGroupsResponse
    -> [ModelPackageGroupSummary] -> ListModelPackageGroupsResponse)
-> Lens' ListModelPackageGroupsResponse [ModelPackageGroupSummary]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListModelPackageGroupsResponse' {[ModelPackageGroupSummary]
modelPackageGroupSummaryList :: [ModelPackageGroupSummary]
$sel:modelPackageGroupSummaryList:ListModelPackageGroupsResponse' :: ListModelPackageGroupsResponse -> [ModelPackageGroupSummary]
modelPackageGroupSummaryList} -> [ModelPackageGroupSummary]
modelPackageGroupSummaryList) (\s :: ListModelPackageGroupsResponse
s@ListModelPackageGroupsResponse' {} [ModelPackageGroupSummary]
a -> ListModelPackageGroupsResponse
s {$sel:modelPackageGroupSummaryList:ListModelPackageGroupsResponse' :: [ModelPackageGroupSummary]
modelPackageGroupSummaryList = [ModelPackageGroupSummary]
a} :: ListModelPackageGroupsResponse) (([ModelPackageGroupSummary] -> f [ModelPackageGroupSummary])
 -> ListModelPackageGroupsResponse
 -> f ListModelPackageGroupsResponse)
-> (([ModelPackageGroupSummary] -> f [ModelPackageGroupSummary])
    -> [ModelPackageGroupSummary] -> f [ModelPackageGroupSummary])
-> ([ModelPackageGroupSummary] -> f [ModelPackageGroupSummary])
-> ListModelPackageGroupsResponse
-> f ListModelPackageGroupsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ModelPackageGroupSummary] -> f [ModelPackageGroupSummary])
-> [ModelPackageGroupSummary] -> f [ModelPackageGroupSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Prelude.NFData
    ListModelPackageGroupsResponse