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

    -- * Request Lenses
    listActions_createdAfter,
    listActions_nextToken,
    listActions_sortOrder,
    listActions_sourceUri,
    listActions_actionType,
    listActions_maxResults,
    listActions_createdBefore,
    listActions_sortBy,

    -- * Destructuring the Response
    ListActionsResponse (..),
    newListActionsResponse,

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

-- |
-- Create a value of 'ListActions' 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', 'listActions_createdAfter' - A filter that returns only actions created on or after the specified
-- time.
--
-- 'nextToken', 'listActions_nextToken' - If the previous call to @ListActions@ didn\'t return the full set of
-- actions, the call returns a token for getting the next set of actions.
--
-- 'sortOrder', 'listActions_sortOrder' - The sort order. The default value is @Descending@.
--
-- 'sourceUri', 'listActions_sourceUri' - A filter that returns only actions with the specified source URI.
--
-- 'actionType', 'listActions_actionType' - A filter that returns only actions of the specified type.
--
-- 'maxResults', 'listActions_maxResults' - The maximum number of actions to return in the response. The default
-- value is 10.
--
-- 'createdBefore', 'listActions_createdBefore' - A filter that returns only actions created on or before the specified
-- time.
--
-- 'sortBy', 'listActions_sortBy' - The property used to sort results. The default value is @CreationTime@.
newListActions ::
  ListActions
newListActions :: ListActions
newListActions =
  ListActions' :: Maybe POSIX
-> Maybe Text
-> Maybe SortOrder
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> Maybe POSIX
-> Maybe SortActionsBy
-> ListActions
ListActions'
    { $sel:createdAfter:ListActions' :: Maybe POSIX
createdAfter = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListActions' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sortOrder:ListActions' :: Maybe SortOrder
sortOrder = Maybe SortOrder
forall a. Maybe a
Prelude.Nothing,
      $sel:sourceUri:ListActions' :: Maybe Text
sourceUri = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:actionType:ListActions' :: Maybe Text
actionType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListActions' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:createdBefore:ListActions' :: Maybe POSIX
createdBefore = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:sortBy:ListActions' :: Maybe SortActionsBy
sortBy = Maybe SortActionsBy
forall a. Maybe a
Prelude.Nothing
    }

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

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

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

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

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

-- | A filter that returns only actions created on or before the specified
-- time.
listActions_createdBefore :: Lens.Lens' ListActions (Prelude.Maybe Prelude.UTCTime)
listActions_createdBefore :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ListActions -> f ListActions
listActions_createdBefore = (ListActions -> Maybe POSIX)
-> (ListActions -> Maybe POSIX -> ListActions)
-> Lens ListActions ListActions (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListActions' {Maybe POSIX
createdBefore :: Maybe POSIX
$sel:createdBefore:ListActions' :: ListActions -> Maybe POSIX
createdBefore} -> Maybe POSIX
createdBefore) (\s :: ListActions
s@ListActions' {} Maybe POSIX
a -> ListActions
s {$sel:createdBefore:ListActions' :: Maybe POSIX
createdBefore = Maybe POSIX
a} :: ListActions) ((Maybe POSIX -> f (Maybe POSIX)) -> ListActions -> f ListActions)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ListActions
-> f ListActions
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@.
listActions_sortBy :: Lens.Lens' ListActions (Prelude.Maybe SortActionsBy)
listActions_sortBy :: (Maybe SortActionsBy -> f (Maybe SortActionsBy))
-> ListActions -> f ListActions
listActions_sortBy = (ListActions -> Maybe SortActionsBy)
-> (ListActions -> Maybe SortActionsBy -> ListActions)
-> Lens
     ListActions ListActions (Maybe SortActionsBy) (Maybe SortActionsBy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListActions' {Maybe SortActionsBy
sortBy :: Maybe SortActionsBy
$sel:sortBy:ListActions' :: ListActions -> Maybe SortActionsBy
sortBy} -> Maybe SortActionsBy
sortBy) (\s :: ListActions
s@ListActions' {} Maybe SortActionsBy
a -> ListActions
s {$sel:sortBy:ListActions' :: Maybe SortActionsBy
sortBy = Maybe SortActionsBy
a} :: ListActions)

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

instance Prelude.NFData ListActions

instance Core.ToHeaders ListActions where
  toHeaders :: ListActions -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListActions -> 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.ListActions" :: 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 ListActions where
  toJSON :: ListActions -> Value
toJSON ListActions' {Maybe Natural
Maybe Text
Maybe POSIX
Maybe SortActionsBy
Maybe SortOrder
sortBy :: Maybe SortActionsBy
createdBefore :: Maybe POSIX
maxResults :: Maybe Natural
actionType :: Maybe Text
sourceUri :: Maybe Text
sortOrder :: Maybe SortOrder
nextToken :: Maybe Text
createdAfter :: Maybe POSIX
$sel:sortBy:ListActions' :: ListActions -> Maybe SortActionsBy
$sel:createdBefore:ListActions' :: ListActions -> Maybe POSIX
$sel:maxResults:ListActions' :: ListActions -> Maybe Natural
$sel:actionType:ListActions' :: ListActions -> Maybe Text
$sel:sourceUri:ListActions' :: ListActions -> Maybe Text
$sel:sortOrder:ListActions' :: ListActions -> Maybe SortOrder
$sel:nextToken:ListActions' :: ListActions -> Maybe Text
$sel:createdAfter:ListActions' :: ListActions -> 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
"ActionType" 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
actionType,
            (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 -> SortActionsBy -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SortActionsBy -> Pair) -> Maybe SortActionsBy -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SortActionsBy
sortBy
          ]
      )

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

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

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

-- |
-- Create a value of 'ListActionsResponse' 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:
--
-- 'actionSummaries', 'listActionsResponse_actionSummaries' - A list of actions and their properties.
--
-- 'nextToken', 'listActionsResponse_nextToken' - A token for getting the next set of actions, if there are any.
--
-- 'httpStatus', 'listActionsResponse_httpStatus' - The response's http status code.
newListActionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListActionsResponse
newListActionsResponse :: Int -> ListActionsResponse
newListActionsResponse Int
pHttpStatus_ =
  ListActionsResponse' :: Maybe [ActionSummary] -> Maybe Text -> Int -> ListActionsResponse
ListActionsResponse'
    { $sel:actionSummaries:ListActionsResponse' :: Maybe [ActionSummary]
actionSummaries =
        Maybe [ActionSummary]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListActionsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListActionsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of actions and their properties.
listActionsResponse_actionSummaries :: Lens.Lens' ListActionsResponse (Prelude.Maybe [ActionSummary])
listActionsResponse_actionSummaries :: (Maybe [ActionSummary] -> f (Maybe [ActionSummary]))
-> ListActionsResponse -> f ListActionsResponse
listActionsResponse_actionSummaries = (ListActionsResponse -> Maybe [ActionSummary])
-> (ListActionsResponse
    -> Maybe [ActionSummary] -> ListActionsResponse)
-> Lens' ListActionsResponse (Maybe [ActionSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListActionsResponse' {Maybe [ActionSummary]
actionSummaries :: Maybe [ActionSummary]
$sel:actionSummaries:ListActionsResponse' :: ListActionsResponse -> Maybe [ActionSummary]
actionSummaries} -> Maybe [ActionSummary]
actionSummaries) (\s :: ListActionsResponse
s@ListActionsResponse' {} Maybe [ActionSummary]
a -> ListActionsResponse
s {$sel:actionSummaries:ListActionsResponse' :: Maybe [ActionSummary]
actionSummaries = Maybe [ActionSummary]
a} :: ListActionsResponse) ((Maybe [ActionSummary] -> f (Maybe [ActionSummary]))
 -> ListActionsResponse -> f ListActionsResponse)
-> ((Maybe [ActionSummary] -> f (Maybe [ActionSummary]))
    -> Maybe [ActionSummary] -> f (Maybe [ActionSummary]))
-> (Maybe [ActionSummary] -> f (Maybe [ActionSummary]))
-> ListActionsResponse
-> f ListActionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ActionSummary] [ActionSummary] [ActionSummary] [ActionSummary]
-> Iso
     (Maybe [ActionSummary])
     (Maybe [ActionSummary])
     (Maybe [ActionSummary])
     (Maybe [ActionSummary])
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
  [ActionSummary] [ActionSummary] [ActionSummary] [ActionSummary]
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 actions, if there are any.
listActionsResponse_nextToken :: Lens.Lens' ListActionsResponse (Prelude.Maybe Prelude.Text)
listActionsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListActionsResponse -> f ListActionsResponse
listActionsResponse_nextToken = (ListActionsResponse -> Maybe Text)
-> (ListActionsResponse -> Maybe Text -> ListActionsResponse)
-> Lens' ListActionsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListActionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListActionsResponse' :: ListActionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListActionsResponse
s@ListActionsResponse' {} Maybe Text
a -> ListActionsResponse
s {$sel:nextToken:ListActionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListActionsResponse)

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

instance Prelude.NFData ListActionsResponse