{-# 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.ListArtifacts
-- 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)
--
-- Lists the artifacts in your account and their properties.
--
-- This operation returns paginated results.
module Amazonka.SageMaker.ListArtifacts
  ( -- * Creating a Request
    ListArtifacts (..),
    newListArtifacts,

    -- * Request Lenses
    listArtifacts_createdAfter,
    listArtifacts_nextToken,
    listArtifacts_sortOrder,
    listArtifacts_sourceUri,
    listArtifacts_artifactType,
    listArtifacts_maxResults,
    listArtifacts_createdBefore,
    listArtifacts_sortBy,

    -- * Destructuring the Response
    ListArtifactsResponse (..),
    newListArtifactsResponse,

    -- * Response Lenses
    listArtifactsResponse_artifactSummaries,
    listArtifactsResponse_nextToken,
    listArtifactsResponse_httpStatus,
  )
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:/ 'newListArtifacts' smart constructor.
data ListArtifacts = ListArtifacts'
  { -- | A filter that returns only artifacts created on or after the specified
    -- time.
    ListArtifacts -> Maybe POSIX
createdAfter :: Prelude.Maybe Core.POSIX,
    -- | If the previous call to @ListArtifacts@ didn\'t return the full set of
    -- artifacts, the call returns a token for getting the next set of
    -- artifacts.
    ListArtifacts -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The sort order. The default value is @Descending@.
    ListArtifacts -> Maybe SortOrder
sortOrder :: Prelude.Maybe SortOrder,
    -- | A filter that returns only artifacts with the specified source URI.
    ListArtifacts -> Maybe Text
sourceUri :: Prelude.Maybe Prelude.Text,
    -- | A filter that returns only artifacts of the specified type.
    ListArtifacts -> Maybe Text
artifactType :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of artifacts to return in the response. The default
    -- value is 10.
    ListArtifacts -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | A filter that returns only artifacts created on or before the specified
    -- time.
    ListArtifacts -> Maybe POSIX
createdBefore :: Prelude.Maybe Core.POSIX,
    -- | The property used to sort results. The default value is @CreationTime@.
    ListArtifacts -> Maybe SortArtifactsBy
sortBy :: Prelude.Maybe SortArtifactsBy
  }
  deriving (ListArtifacts -> ListArtifacts -> Bool
(ListArtifacts -> ListArtifacts -> Bool)
-> (ListArtifacts -> ListArtifacts -> Bool) -> Eq ListArtifacts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListArtifacts -> ListArtifacts -> Bool
$c/= :: ListArtifacts -> ListArtifacts -> Bool
== :: ListArtifacts -> ListArtifacts -> Bool
$c== :: ListArtifacts -> ListArtifacts -> Bool
Prelude.Eq, ReadPrec [ListArtifacts]
ReadPrec ListArtifacts
Int -> ReadS ListArtifacts
ReadS [ListArtifacts]
(Int -> ReadS ListArtifacts)
-> ReadS [ListArtifacts]
-> ReadPrec ListArtifacts
-> ReadPrec [ListArtifacts]
-> Read ListArtifacts
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListArtifacts]
$creadListPrec :: ReadPrec [ListArtifacts]
readPrec :: ReadPrec ListArtifacts
$creadPrec :: ReadPrec ListArtifacts
readList :: ReadS [ListArtifacts]
$creadList :: ReadS [ListArtifacts]
readsPrec :: Int -> ReadS ListArtifacts
$creadsPrec :: Int -> ReadS ListArtifacts
Prelude.Read, Int -> ListArtifacts -> ShowS
[ListArtifacts] -> ShowS
ListArtifacts -> String
(Int -> ListArtifacts -> ShowS)
-> (ListArtifacts -> String)
-> ([ListArtifacts] -> ShowS)
-> Show ListArtifacts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListArtifacts] -> ShowS
$cshowList :: [ListArtifacts] -> ShowS
show :: ListArtifacts -> String
$cshow :: ListArtifacts -> String
showsPrec :: Int -> ListArtifacts -> ShowS
$cshowsPrec :: Int -> ListArtifacts -> ShowS
Prelude.Show, (forall x. ListArtifacts -> Rep ListArtifacts x)
-> (forall x. Rep ListArtifacts x -> ListArtifacts)
-> Generic ListArtifacts
forall x. Rep ListArtifacts x -> ListArtifacts
forall x. ListArtifacts -> Rep ListArtifacts x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListArtifacts x -> ListArtifacts
$cfrom :: forall x. ListArtifacts -> Rep ListArtifacts x
Prelude.Generic)

-- |
-- Create a value of 'ListArtifacts' 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:
--
-- 'createdAfter', 'listArtifacts_createdAfter' - A filter that returns only artifacts created on or after the specified
-- time.
--
-- 'nextToken', 'listArtifacts_nextToken' - If the previous call to @ListArtifacts@ didn\'t return the full set of
-- artifacts, the call returns a token for getting the next set of
-- artifacts.
--
-- 'sortOrder', 'listArtifacts_sortOrder' - The sort order. The default value is @Descending@.
--
-- 'sourceUri', 'listArtifacts_sourceUri' - A filter that returns only artifacts with the specified source URI.
--
-- 'artifactType', 'listArtifacts_artifactType' - A filter that returns only artifacts of the specified type.
--
-- 'maxResults', 'listArtifacts_maxResults' - The maximum number of artifacts to return in the response. The default
-- value is 10.
--
-- 'createdBefore', 'listArtifacts_createdBefore' - A filter that returns only artifacts created on or before the specified
-- time.
--
-- 'sortBy', 'listArtifacts_sortBy' - The property used to sort results. The default value is @CreationTime@.
newListArtifacts ::
  ListArtifacts
newListArtifacts :: ListArtifacts
newListArtifacts =
  ListArtifacts' :: Maybe POSIX
-> Maybe Text
-> Maybe SortOrder
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> Maybe POSIX
-> Maybe SortArtifactsBy
-> ListArtifacts
ListArtifacts'
    { $sel:createdAfter:ListArtifacts' :: Maybe POSIX
createdAfter = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListArtifacts' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sortOrder:ListArtifacts' :: Maybe SortOrder
sortOrder = Maybe SortOrder
forall a. Maybe a
Prelude.Nothing,
      $sel:sourceUri:ListArtifacts' :: Maybe Text
sourceUri = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:artifactType:ListArtifacts' :: Maybe Text
artifactType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListArtifacts' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:createdBefore:ListArtifacts' :: Maybe POSIX
createdBefore = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:sortBy:ListArtifacts' :: Maybe SortArtifactsBy
sortBy = Maybe SortArtifactsBy
forall a. Maybe a
Prelude.Nothing
    }

-- | A filter that returns only artifacts created on or after the specified
-- time.
listArtifacts_createdAfter :: Lens.Lens' ListArtifacts (Prelude.Maybe Prelude.UTCTime)
listArtifacts_createdAfter :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ListArtifacts -> f ListArtifacts
listArtifacts_createdAfter = (ListArtifacts -> Maybe POSIX)
-> (ListArtifacts -> Maybe POSIX -> ListArtifacts)
-> Lens ListArtifacts ListArtifacts (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListArtifacts' {Maybe POSIX
createdAfter :: Maybe POSIX
$sel:createdAfter:ListArtifacts' :: ListArtifacts -> Maybe POSIX
createdAfter} -> Maybe POSIX
createdAfter) (\s :: ListArtifacts
s@ListArtifacts' {} Maybe POSIX
a -> ListArtifacts
s {$sel:createdAfter:ListArtifacts' :: Maybe POSIX
createdAfter = Maybe POSIX
a} :: ListArtifacts) ((Maybe POSIX -> f (Maybe POSIX))
 -> ListArtifacts -> f ListArtifacts)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ListArtifacts
-> f ListArtifacts
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 previous call to @ListArtifacts@ didn\'t return the full set of
-- artifacts, the call returns a token for getting the next set of
-- artifacts.
listArtifacts_nextToken :: Lens.Lens' ListArtifacts (Prelude.Maybe Prelude.Text)
listArtifacts_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListArtifacts -> f ListArtifacts
listArtifacts_nextToken = (ListArtifacts -> Maybe Text)
-> (ListArtifacts -> Maybe Text -> ListArtifacts)
-> Lens ListArtifacts ListArtifacts (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListArtifacts' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListArtifacts' :: ListArtifacts -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListArtifacts
s@ListArtifacts' {} Maybe Text
a -> ListArtifacts
s {$sel:nextToken:ListArtifacts' :: Maybe Text
nextToken = Maybe Text
a} :: ListArtifacts)

-- | The sort order. The default value is @Descending@.
listArtifacts_sortOrder :: Lens.Lens' ListArtifacts (Prelude.Maybe SortOrder)
listArtifacts_sortOrder :: (Maybe SortOrder -> f (Maybe SortOrder))
-> ListArtifacts -> f ListArtifacts
listArtifacts_sortOrder = (ListArtifacts -> Maybe SortOrder)
-> (ListArtifacts -> Maybe SortOrder -> ListArtifacts)
-> Lens
     ListArtifacts ListArtifacts (Maybe SortOrder) (Maybe SortOrder)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListArtifacts' {Maybe SortOrder
sortOrder :: Maybe SortOrder
$sel:sortOrder:ListArtifacts' :: ListArtifacts -> Maybe SortOrder
sortOrder} -> Maybe SortOrder
sortOrder) (\s :: ListArtifacts
s@ListArtifacts' {} Maybe SortOrder
a -> ListArtifacts
s {$sel:sortOrder:ListArtifacts' :: Maybe SortOrder
sortOrder = Maybe SortOrder
a} :: ListArtifacts)

-- | A filter that returns only artifacts with the specified source URI.
listArtifacts_sourceUri :: Lens.Lens' ListArtifacts (Prelude.Maybe Prelude.Text)
listArtifacts_sourceUri :: (Maybe Text -> f (Maybe Text)) -> ListArtifacts -> f ListArtifacts
listArtifacts_sourceUri = (ListArtifacts -> Maybe Text)
-> (ListArtifacts -> Maybe Text -> ListArtifacts)
-> Lens ListArtifacts ListArtifacts (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListArtifacts' {Maybe Text
sourceUri :: Maybe Text
$sel:sourceUri:ListArtifacts' :: ListArtifacts -> Maybe Text
sourceUri} -> Maybe Text
sourceUri) (\s :: ListArtifacts
s@ListArtifacts' {} Maybe Text
a -> ListArtifacts
s {$sel:sourceUri:ListArtifacts' :: Maybe Text
sourceUri = Maybe Text
a} :: ListArtifacts)

-- | A filter that returns only artifacts of the specified type.
listArtifacts_artifactType :: Lens.Lens' ListArtifacts (Prelude.Maybe Prelude.Text)
listArtifacts_artifactType :: (Maybe Text -> f (Maybe Text)) -> ListArtifacts -> f ListArtifacts
listArtifacts_artifactType = (ListArtifacts -> Maybe Text)
-> (ListArtifacts -> Maybe Text -> ListArtifacts)
-> Lens ListArtifacts ListArtifacts (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListArtifacts' {Maybe Text
artifactType :: Maybe Text
$sel:artifactType:ListArtifacts' :: ListArtifacts -> Maybe Text
artifactType} -> Maybe Text
artifactType) (\s :: ListArtifacts
s@ListArtifacts' {} Maybe Text
a -> ListArtifacts
s {$sel:artifactType:ListArtifacts' :: Maybe Text
artifactType = Maybe Text
a} :: ListArtifacts)

-- | The maximum number of artifacts to return in the response. The default
-- value is 10.
listArtifacts_maxResults :: Lens.Lens' ListArtifacts (Prelude.Maybe Prelude.Natural)
listArtifacts_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListArtifacts -> f ListArtifacts
listArtifacts_maxResults = (ListArtifacts -> Maybe Natural)
-> (ListArtifacts -> Maybe Natural -> ListArtifacts)
-> Lens ListArtifacts ListArtifacts (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListArtifacts' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListArtifacts' :: ListArtifacts -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListArtifacts
s@ListArtifacts' {} Maybe Natural
a -> ListArtifacts
s {$sel:maxResults:ListArtifacts' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListArtifacts)

-- | A filter that returns only artifacts created on or before the specified
-- time.
listArtifacts_createdBefore :: Lens.Lens' ListArtifacts (Prelude.Maybe Prelude.UTCTime)
listArtifacts_createdBefore :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ListArtifacts -> f ListArtifacts
listArtifacts_createdBefore = (ListArtifacts -> Maybe POSIX)
-> (ListArtifacts -> Maybe POSIX -> ListArtifacts)
-> Lens ListArtifacts ListArtifacts (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListArtifacts' {Maybe POSIX
createdBefore :: Maybe POSIX
$sel:createdBefore:ListArtifacts' :: ListArtifacts -> Maybe POSIX
createdBefore} -> Maybe POSIX
createdBefore) (\s :: ListArtifacts
s@ListArtifacts' {} Maybe POSIX
a -> ListArtifacts
s {$sel:createdBefore:ListArtifacts' :: Maybe POSIX
createdBefore = Maybe POSIX
a} :: ListArtifacts) ((Maybe POSIX -> f (Maybe POSIX))
 -> ListArtifacts -> f ListArtifacts)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ListArtifacts
-> f ListArtifacts
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 property used to sort results. The default value is @CreationTime@.
listArtifacts_sortBy :: Lens.Lens' ListArtifacts (Prelude.Maybe SortArtifactsBy)
listArtifacts_sortBy :: (Maybe SortArtifactsBy -> f (Maybe SortArtifactsBy))
-> ListArtifacts -> f ListArtifacts
listArtifacts_sortBy = (ListArtifacts -> Maybe SortArtifactsBy)
-> (ListArtifacts -> Maybe SortArtifactsBy -> ListArtifacts)
-> Lens
     ListArtifacts
     ListArtifacts
     (Maybe SortArtifactsBy)
     (Maybe SortArtifactsBy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListArtifacts' {Maybe SortArtifactsBy
sortBy :: Maybe SortArtifactsBy
$sel:sortBy:ListArtifacts' :: ListArtifacts -> Maybe SortArtifactsBy
sortBy} -> Maybe SortArtifactsBy
sortBy) (\s :: ListArtifacts
s@ListArtifacts' {} Maybe SortArtifactsBy
a -> ListArtifacts
s {$sel:sortBy:ListArtifacts' :: Maybe SortArtifactsBy
sortBy = Maybe SortArtifactsBy
a} :: ListArtifacts)

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

instance Prelude.NFData ListArtifacts

instance Core.ToHeaders ListArtifacts where
  toHeaders :: ListArtifacts -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListArtifacts -> 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.ListArtifacts" :: 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 ListArtifacts where
  toJSON :: ListArtifacts -> Value
toJSON ListArtifacts' {Maybe Natural
Maybe Text
Maybe POSIX
Maybe SortArtifactsBy
Maybe SortOrder
sortBy :: Maybe SortArtifactsBy
createdBefore :: Maybe POSIX
maxResults :: Maybe Natural
artifactType :: Maybe Text
sourceUri :: Maybe Text
sortOrder :: Maybe SortOrder
nextToken :: Maybe Text
createdAfter :: Maybe POSIX
$sel:sortBy:ListArtifacts' :: ListArtifacts -> Maybe SortArtifactsBy
$sel:createdBefore:ListArtifacts' :: ListArtifacts -> Maybe POSIX
$sel:maxResults:ListArtifacts' :: ListArtifacts -> Maybe Natural
$sel:artifactType:ListArtifacts' :: ListArtifacts -> Maybe Text
$sel:sourceUri:ListArtifacts' :: ListArtifacts -> Maybe Text
$sel:sortOrder:ListArtifacts' :: ListArtifacts -> Maybe SortOrder
$sel:nextToken:ListArtifacts' :: ListArtifacts -> Maybe Text
$sel:createdAfter:ListArtifacts' :: ListArtifacts -> Maybe POSIX
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"CreatedAfter" 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
createdAfter,
            (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
"SourceUri" 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
sourceUri,
            (Text
"ArtifactType" 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
artifactType,
            (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
"CreatedBefore" 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
createdBefore,
            (Text
"SortBy" Text -> SortArtifactsBy -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SortArtifactsBy -> Pair) -> Maybe SortArtifactsBy -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SortArtifactsBy
sortBy
          ]
      )

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

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

-- | /See:/ 'newListArtifactsResponse' smart constructor.
data ListArtifactsResponse = ListArtifactsResponse'
  { -- | A list of artifacts and their properties.
    ListArtifactsResponse -> Maybe [ArtifactSummary]
artifactSummaries :: Prelude.Maybe [ArtifactSummary],
    -- | A token for getting the next set of artifacts, if there are any.
    ListArtifactsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListArtifactsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListArtifactsResponse -> ListArtifactsResponse -> Bool
(ListArtifactsResponse -> ListArtifactsResponse -> Bool)
-> (ListArtifactsResponse -> ListArtifactsResponse -> Bool)
-> Eq ListArtifactsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListArtifactsResponse -> ListArtifactsResponse -> Bool
$c/= :: ListArtifactsResponse -> ListArtifactsResponse -> Bool
== :: ListArtifactsResponse -> ListArtifactsResponse -> Bool
$c== :: ListArtifactsResponse -> ListArtifactsResponse -> Bool
Prelude.Eq, ReadPrec [ListArtifactsResponse]
ReadPrec ListArtifactsResponse
Int -> ReadS ListArtifactsResponse
ReadS [ListArtifactsResponse]
(Int -> ReadS ListArtifactsResponse)
-> ReadS [ListArtifactsResponse]
-> ReadPrec ListArtifactsResponse
-> ReadPrec [ListArtifactsResponse]
-> Read ListArtifactsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListArtifactsResponse]
$creadListPrec :: ReadPrec [ListArtifactsResponse]
readPrec :: ReadPrec ListArtifactsResponse
$creadPrec :: ReadPrec ListArtifactsResponse
readList :: ReadS [ListArtifactsResponse]
$creadList :: ReadS [ListArtifactsResponse]
readsPrec :: Int -> ReadS ListArtifactsResponse
$creadsPrec :: Int -> ReadS ListArtifactsResponse
Prelude.Read, Int -> ListArtifactsResponse -> ShowS
[ListArtifactsResponse] -> ShowS
ListArtifactsResponse -> String
(Int -> ListArtifactsResponse -> ShowS)
-> (ListArtifactsResponse -> String)
-> ([ListArtifactsResponse] -> ShowS)
-> Show ListArtifactsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListArtifactsResponse] -> ShowS
$cshowList :: [ListArtifactsResponse] -> ShowS
show :: ListArtifactsResponse -> String
$cshow :: ListArtifactsResponse -> String
showsPrec :: Int -> ListArtifactsResponse -> ShowS
$cshowsPrec :: Int -> ListArtifactsResponse -> ShowS
Prelude.Show, (forall x. ListArtifactsResponse -> Rep ListArtifactsResponse x)
-> (forall x. Rep ListArtifactsResponse x -> ListArtifactsResponse)
-> Generic ListArtifactsResponse
forall x. Rep ListArtifactsResponse x -> ListArtifactsResponse
forall x. ListArtifactsResponse -> Rep ListArtifactsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListArtifactsResponse x -> ListArtifactsResponse
$cfrom :: forall x. ListArtifactsResponse -> Rep ListArtifactsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListArtifactsResponse' 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:
--
-- 'artifactSummaries', 'listArtifactsResponse_artifactSummaries' - A list of artifacts and their properties.
--
-- 'nextToken', 'listArtifactsResponse_nextToken' - A token for getting the next set of artifacts, if there are any.
--
-- 'httpStatus', 'listArtifactsResponse_httpStatus' - The response's http status code.
newListArtifactsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListArtifactsResponse
newListArtifactsResponse :: Int -> ListArtifactsResponse
newListArtifactsResponse Int
pHttpStatus_ =
  ListArtifactsResponse' :: Maybe [ArtifactSummary]
-> Maybe Text -> Int -> ListArtifactsResponse
ListArtifactsResponse'
    { $sel:artifactSummaries:ListArtifactsResponse' :: Maybe [ArtifactSummary]
artifactSummaries =
        Maybe [ArtifactSummary]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListArtifactsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListArtifactsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of artifacts and their properties.
listArtifactsResponse_artifactSummaries :: Lens.Lens' ListArtifactsResponse (Prelude.Maybe [ArtifactSummary])
listArtifactsResponse_artifactSummaries :: (Maybe [ArtifactSummary] -> f (Maybe [ArtifactSummary]))
-> ListArtifactsResponse -> f ListArtifactsResponse
listArtifactsResponse_artifactSummaries = (ListArtifactsResponse -> Maybe [ArtifactSummary])
-> (ListArtifactsResponse
    -> Maybe [ArtifactSummary] -> ListArtifactsResponse)
-> Lens' ListArtifactsResponse (Maybe [ArtifactSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListArtifactsResponse' {Maybe [ArtifactSummary]
artifactSummaries :: Maybe [ArtifactSummary]
$sel:artifactSummaries:ListArtifactsResponse' :: ListArtifactsResponse -> Maybe [ArtifactSummary]
artifactSummaries} -> Maybe [ArtifactSummary]
artifactSummaries) (\s :: ListArtifactsResponse
s@ListArtifactsResponse' {} Maybe [ArtifactSummary]
a -> ListArtifactsResponse
s {$sel:artifactSummaries:ListArtifactsResponse' :: Maybe [ArtifactSummary]
artifactSummaries = Maybe [ArtifactSummary]
a} :: ListArtifactsResponse) ((Maybe [ArtifactSummary] -> f (Maybe [ArtifactSummary]))
 -> ListArtifactsResponse -> f ListArtifactsResponse)
-> ((Maybe [ArtifactSummary] -> f (Maybe [ArtifactSummary]))
    -> Maybe [ArtifactSummary] -> f (Maybe [ArtifactSummary]))
-> (Maybe [ArtifactSummary] -> f (Maybe [ArtifactSummary]))
-> ListArtifactsResponse
-> f ListArtifactsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ArtifactSummary]
  [ArtifactSummary]
  [ArtifactSummary]
  [ArtifactSummary]
-> Iso
     (Maybe [ArtifactSummary])
     (Maybe [ArtifactSummary])
     (Maybe [ArtifactSummary])
     (Maybe [ArtifactSummary])
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
  [ArtifactSummary]
  [ArtifactSummary]
  [ArtifactSummary]
  [ArtifactSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A token for getting the next set of artifacts, if there are any.
listArtifactsResponse_nextToken :: Lens.Lens' ListArtifactsResponse (Prelude.Maybe Prelude.Text)
listArtifactsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListArtifactsResponse -> f ListArtifactsResponse
listArtifactsResponse_nextToken = (ListArtifactsResponse -> Maybe Text)
-> (ListArtifactsResponse -> Maybe Text -> ListArtifactsResponse)
-> Lens' ListArtifactsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListArtifactsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListArtifactsResponse' :: ListArtifactsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListArtifactsResponse
s@ListArtifactsResponse' {} Maybe Text
a -> ListArtifactsResponse
s {$sel:nextToken:ListArtifactsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListArtifactsResponse)

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

instance Prelude.NFData ListArtifactsResponse