{-# 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.SSM.DescribeAutomationStepExecutions
-- 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)
--
-- Information about all active and terminated step executions in an
-- Automation workflow.
--
-- This operation returns paginated results.
module Amazonka.SSM.DescribeAutomationStepExecutions
  ( -- * Creating a Request
    DescribeAutomationStepExecutions (..),
    newDescribeAutomationStepExecutions,

    -- * Request Lenses
    describeAutomationStepExecutions_filters,
    describeAutomationStepExecutions_reverseOrder,
    describeAutomationStepExecutions_nextToken,
    describeAutomationStepExecutions_maxResults,
    describeAutomationStepExecutions_automationExecutionId,

    -- * Destructuring the Response
    DescribeAutomationStepExecutionsResponse (..),
    newDescribeAutomationStepExecutionsResponse,

    -- * Response Lenses
    describeAutomationStepExecutionsResponse_nextToken,
    describeAutomationStepExecutionsResponse_stepExecutions,
    describeAutomationStepExecutionsResponse_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.SSM.Types

-- | /See:/ 'newDescribeAutomationStepExecutions' smart constructor.
data DescribeAutomationStepExecutions = DescribeAutomationStepExecutions'
  { -- | One or more filters to limit the number of step executions returned by
    -- the request.
    DescribeAutomationStepExecutions
-> Maybe (NonEmpty StepExecutionFilter)
filters :: Prelude.Maybe (Prelude.NonEmpty StepExecutionFilter),
    -- | Indicates whether to list step executions in reverse order by start
    -- time. The default value is \'false\'.
    DescribeAutomationStepExecutions -> Maybe Bool
reverseOrder :: Prelude.Maybe Prelude.Bool,
    -- | The token for the next set of items to return. (You received this token
    -- from a previous call.)
    DescribeAutomationStepExecutions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of items to return for this call. The call also
    -- returns a token that you can specify in a subsequent call to get the
    -- next set of results.
    DescribeAutomationStepExecutions -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The Automation execution ID for which you want step execution
    -- descriptions.
    DescribeAutomationStepExecutions -> Text
automationExecutionId :: Prelude.Text
  }
  deriving (DescribeAutomationStepExecutions
-> DescribeAutomationStepExecutions -> Bool
(DescribeAutomationStepExecutions
 -> DescribeAutomationStepExecutions -> Bool)
-> (DescribeAutomationStepExecutions
    -> DescribeAutomationStepExecutions -> Bool)
-> Eq DescribeAutomationStepExecutions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAutomationStepExecutions
-> DescribeAutomationStepExecutions -> Bool
$c/= :: DescribeAutomationStepExecutions
-> DescribeAutomationStepExecutions -> Bool
== :: DescribeAutomationStepExecutions
-> DescribeAutomationStepExecutions -> Bool
$c== :: DescribeAutomationStepExecutions
-> DescribeAutomationStepExecutions -> Bool
Prelude.Eq, ReadPrec [DescribeAutomationStepExecutions]
ReadPrec DescribeAutomationStepExecutions
Int -> ReadS DescribeAutomationStepExecutions
ReadS [DescribeAutomationStepExecutions]
(Int -> ReadS DescribeAutomationStepExecutions)
-> ReadS [DescribeAutomationStepExecutions]
-> ReadPrec DescribeAutomationStepExecutions
-> ReadPrec [DescribeAutomationStepExecutions]
-> Read DescribeAutomationStepExecutions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAutomationStepExecutions]
$creadListPrec :: ReadPrec [DescribeAutomationStepExecutions]
readPrec :: ReadPrec DescribeAutomationStepExecutions
$creadPrec :: ReadPrec DescribeAutomationStepExecutions
readList :: ReadS [DescribeAutomationStepExecutions]
$creadList :: ReadS [DescribeAutomationStepExecutions]
readsPrec :: Int -> ReadS DescribeAutomationStepExecutions
$creadsPrec :: Int -> ReadS DescribeAutomationStepExecutions
Prelude.Read, Int -> DescribeAutomationStepExecutions -> ShowS
[DescribeAutomationStepExecutions] -> ShowS
DescribeAutomationStepExecutions -> String
(Int -> DescribeAutomationStepExecutions -> ShowS)
-> (DescribeAutomationStepExecutions -> String)
-> ([DescribeAutomationStepExecutions] -> ShowS)
-> Show DescribeAutomationStepExecutions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAutomationStepExecutions] -> ShowS
$cshowList :: [DescribeAutomationStepExecutions] -> ShowS
show :: DescribeAutomationStepExecutions -> String
$cshow :: DescribeAutomationStepExecutions -> String
showsPrec :: Int -> DescribeAutomationStepExecutions -> ShowS
$cshowsPrec :: Int -> DescribeAutomationStepExecutions -> ShowS
Prelude.Show, (forall x.
 DescribeAutomationStepExecutions
 -> Rep DescribeAutomationStepExecutions x)
-> (forall x.
    Rep DescribeAutomationStepExecutions x
    -> DescribeAutomationStepExecutions)
-> Generic DescribeAutomationStepExecutions
forall x.
Rep DescribeAutomationStepExecutions x
-> DescribeAutomationStepExecutions
forall x.
DescribeAutomationStepExecutions
-> Rep DescribeAutomationStepExecutions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeAutomationStepExecutions x
-> DescribeAutomationStepExecutions
$cfrom :: forall x.
DescribeAutomationStepExecutions
-> Rep DescribeAutomationStepExecutions x
Prelude.Generic)

-- |
-- Create a value of 'DescribeAutomationStepExecutions' 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:
--
-- 'filters', 'describeAutomationStepExecutions_filters' - One or more filters to limit the number of step executions returned by
-- the request.
--
-- 'reverseOrder', 'describeAutomationStepExecutions_reverseOrder' - Indicates whether to list step executions in reverse order by start
-- time. The default value is \'false\'.
--
-- 'nextToken', 'describeAutomationStepExecutions_nextToken' - The token for the next set of items to return. (You received this token
-- from a previous call.)
--
-- 'maxResults', 'describeAutomationStepExecutions_maxResults' - The maximum number of items to return for this call. The call also
-- returns a token that you can specify in a subsequent call to get the
-- next set of results.
--
-- 'automationExecutionId', 'describeAutomationStepExecutions_automationExecutionId' - The Automation execution ID for which you want step execution
-- descriptions.
newDescribeAutomationStepExecutions ::
  -- | 'automationExecutionId'
  Prelude.Text ->
  DescribeAutomationStepExecutions
newDescribeAutomationStepExecutions :: Text -> DescribeAutomationStepExecutions
newDescribeAutomationStepExecutions
  Text
pAutomationExecutionId_ =
    DescribeAutomationStepExecutions' :: Maybe (NonEmpty StepExecutionFilter)
-> Maybe Bool
-> Maybe Text
-> Maybe Natural
-> Text
-> DescribeAutomationStepExecutions
DescribeAutomationStepExecutions'
      { $sel:filters:DescribeAutomationStepExecutions' :: Maybe (NonEmpty StepExecutionFilter)
filters =
          Maybe (NonEmpty StepExecutionFilter)
forall a. Maybe a
Prelude.Nothing,
        $sel:reverseOrder:DescribeAutomationStepExecutions' :: Maybe Bool
reverseOrder = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:DescribeAutomationStepExecutions' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:maxResults:DescribeAutomationStepExecutions' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:automationExecutionId:DescribeAutomationStepExecutions' :: Text
automationExecutionId =
          Text
pAutomationExecutionId_
      }

-- | One or more filters to limit the number of step executions returned by
-- the request.
describeAutomationStepExecutions_filters :: Lens.Lens' DescribeAutomationStepExecutions (Prelude.Maybe (Prelude.NonEmpty StepExecutionFilter))
describeAutomationStepExecutions_filters :: (Maybe (NonEmpty StepExecutionFilter)
 -> f (Maybe (NonEmpty StepExecutionFilter)))
-> DescribeAutomationStepExecutions
-> f DescribeAutomationStepExecutions
describeAutomationStepExecutions_filters = (DescribeAutomationStepExecutions
 -> Maybe (NonEmpty StepExecutionFilter))
-> (DescribeAutomationStepExecutions
    -> Maybe (NonEmpty StepExecutionFilter)
    -> DescribeAutomationStepExecutions)
-> Lens
     DescribeAutomationStepExecutions
     DescribeAutomationStepExecutions
     (Maybe (NonEmpty StepExecutionFilter))
     (Maybe (NonEmpty StepExecutionFilter))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAutomationStepExecutions' {Maybe (NonEmpty StepExecutionFilter)
filters :: Maybe (NonEmpty StepExecutionFilter)
$sel:filters:DescribeAutomationStepExecutions' :: DescribeAutomationStepExecutions
-> Maybe (NonEmpty StepExecutionFilter)
filters} -> Maybe (NonEmpty StepExecutionFilter)
filters) (\s :: DescribeAutomationStepExecutions
s@DescribeAutomationStepExecutions' {} Maybe (NonEmpty StepExecutionFilter)
a -> DescribeAutomationStepExecutions
s {$sel:filters:DescribeAutomationStepExecutions' :: Maybe (NonEmpty StepExecutionFilter)
filters = Maybe (NonEmpty StepExecutionFilter)
a} :: DescribeAutomationStepExecutions) ((Maybe (NonEmpty StepExecutionFilter)
  -> f (Maybe (NonEmpty StepExecutionFilter)))
 -> DescribeAutomationStepExecutions
 -> f DescribeAutomationStepExecutions)
-> ((Maybe (NonEmpty StepExecutionFilter)
     -> f (Maybe (NonEmpty StepExecutionFilter)))
    -> Maybe (NonEmpty StepExecutionFilter)
    -> f (Maybe (NonEmpty StepExecutionFilter)))
-> (Maybe (NonEmpty StepExecutionFilter)
    -> f (Maybe (NonEmpty StepExecutionFilter)))
-> DescribeAutomationStepExecutions
-> f DescribeAutomationStepExecutions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty StepExecutionFilter)
  (NonEmpty StepExecutionFilter)
  (NonEmpty StepExecutionFilter)
  (NonEmpty StepExecutionFilter)
-> Iso
     (Maybe (NonEmpty StepExecutionFilter))
     (Maybe (NonEmpty StepExecutionFilter))
     (Maybe (NonEmpty StepExecutionFilter))
     (Maybe (NonEmpty StepExecutionFilter))
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
  (NonEmpty StepExecutionFilter)
  (NonEmpty StepExecutionFilter)
  (NonEmpty StepExecutionFilter)
  (NonEmpty StepExecutionFilter)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Indicates whether to list step executions in reverse order by start
-- time. The default value is \'false\'.
describeAutomationStepExecutions_reverseOrder :: Lens.Lens' DescribeAutomationStepExecutions (Prelude.Maybe Prelude.Bool)
describeAutomationStepExecutions_reverseOrder :: (Maybe Bool -> f (Maybe Bool))
-> DescribeAutomationStepExecutions
-> f DescribeAutomationStepExecutions
describeAutomationStepExecutions_reverseOrder = (DescribeAutomationStepExecutions -> Maybe Bool)
-> (DescribeAutomationStepExecutions
    -> Maybe Bool -> DescribeAutomationStepExecutions)
-> Lens
     DescribeAutomationStepExecutions
     DescribeAutomationStepExecutions
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAutomationStepExecutions' {Maybe Bool
reverseOrder :: Maybe Bool
$sel:reverseOrder:DescribeAutomationStepExecutions' :: DescribeAutomationStepExecutions -> Maybe Bool
reverseOrder} -> Maybe Bool
reverseOrder) (\s :: DescribeAutomationStepExecutions
s@DescribeAutomationStepExecutions' {} Maybe Bool
a -> DescribeAutomationStepExecutions
s {$sel:reverseOrder:DescribeAutomationStepExecutions' :: Maybe Bool
reverseOrder = Maybe Bool
a} :: DescribeAutomationStepExecutions)

-- | The token for the next set of items to return. (You received this token
-- from a previous call.)
describeAutomationStepExecutions_nextToken :: Lens.Lens' DescribeAutomationStepExecutions (Prelude.Maybe Prelude.Text)
describeAutomationStepExecutions_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeAutomationStepExecutions
-> f DescribeAutomationStepExecutions
describeAutomationStepExecutions_nextToken = (DescribeAutomationStepExecutions -> Maybe Text)
-> (DescribeAutomationStepExecutions
    -> Maybe Text -> DescribeAutomationStepExecutions)
-> Lens
     DescribeAutomationStepExecutions
     DescribeAutomationStepExecutions
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAutomationStepExecutions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeAutomationStepExecutions' :: DescribeAutomationStepExecutions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeAutomationStepExecutions
s@DescribeAutomationStepExecutions' {} Maybe Text
a -> DescribeAutomationStepExecutions
s {$sel:nextToken:DescribeAutomationStepExecutions' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeAutomationStepExecutions)

-- | The maximum number of items to return for this call. The call also
-- returns a token that you can specify in a subsequent call to get the
-- next set of results.
describeAutomationStepExecutions_maxResults :: Lens.Lens' DescribeAutomationStepExecutions (Prelude.Maybe Prelude.Natural)
describeAutomationStepExecutions_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> DescribeAutomationStepExecutions
-> f DescribeAutomationStepExecutions
describeAutomationStepExecutions_maxResults = (DescribeAutomationStepExecutions -> Maybe Natural)
-> (DescribeAutomationStepExecutions
    -> Maybe Natural -> DescribeAutomationStepExecutions)
-> Lens
     DescribeAutomationStepExecutions
     DescribeAutomationStepExecutions
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAutomationStepExecutions' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:DescribeAutomationStepExecutions' :: DescribeAutomationStepExecutions -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: DescribeAutomationStepExecutions
s@DescribeAutomationStepExecutions' {} Maybe Natural
a -> DescribeAutomationStepExecutions
s {$sel:maxResults:DescribeAutomationStepExecutions' :: Maybe Natural
maxResults = Maybe Natural
a} :: DescribeAutomationStepExecutions)

-- | The Automation execution ID for which you want step execution
-- descriptions.
describeAutomationStepExecutions_automationExecutionId :: Lens.Lens' DescribeAutomationStepExecutions Prelude.Text
describeAutomationStepExecutions_automationExecutionId :: (Text -> f Text)
-> DescribeAutomationStepExecutions
-> f DescribeAutomationStepExecutions
describeAutomationStepExecutions_automationExecutionId = (DescribeAutomationStepExecutions -> Text)
-> (DescribeAutomationStepExecutions
    -> Text -> DescribeAutomationStepExecutions)
-> Lens
     DescribeAutomationStepExecutions
     DescribeAutomationStepExecutions
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAutomationStepExecutions' {Text
automationExecutionId :: Text
$sel:automationExecutionId:DescribeAutomationStepExecutions' :: DescribeAutomationStepExecutions -> Text
automationExecutionId} -> Text
automationExecutionId) (\s :: DescribeAutomationStepExecutions
s@DescribeAutomationStepExecutions' {} Text
a -> DescribeAutomationStepExecutions
s {$sel:automationExecutionId:DescribeAutomationStepExecutions' :: Text
automationExecutionId = Text
a} :: DescribeAutomationStepExecutions)

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

instance
  Prelude.NFData
    DescribeAutomationStepExecutions

instance
  Core.ToHeaders
    DescribeAutomationStepExecutions
  where
  toHeaders :: DescribeAutomationStepExecutions -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> DescribeAutomationStepExecutions -> 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
"AmazonSSM.DescribeAutomationStepExecutions" ::
                          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 DescribeAutomationStepExecutions where
  toJSON :: DescribeAutomationStepExecutions -> Value
toJSON DescribeAutomationStepExecutions' {Maybe Bool
Maybe Natural
Maybe (NonEmpty StepExecutionFilter)
Maybe Text
Text
automationExecutionId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
reverseOrder :: Maybe Bool
filters :: Maybe (NonEmpty StepExecutionFilter)
$sel:automationExecutionId:DescribeAutomationStepExecutions' :: DescribeAutomationStepExecutions -> Text
$sel:maxResults:DescribeAutomationStepExecutions' :: DescribeAutomationStepExecutions -> Maybe Natural
$sel:nextToken:DescribeAutomationStepExecutions' :: DescribeAutomationStepExecutions -> Maybe Text
$sel:reverseOrder:DescribeAutomationStepExecutions' :: DescribeAutomationStepExecutions -> Maybe Bool
$sel:filters:DescribeAutomationStepExecutions' :: DescribeAutomationStepExecutions
-> Maybe (NonEmpty StepExecutionFilter)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Filters" Text -> NonEmpty StepExecutionFilter -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty StepExecutionFilter -> Pair)
-> Maybe (NonEmpty StepExecutionFilter) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty StepExecutionFilter)
filters,
            (Text
"ReverseOrder" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
reverseOrder,
            (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"MaxResults" Text -> 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,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"AutomationExecutionId"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
automationExecutionId
              )
          ]
      )

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

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

-- | /See:/ 'newDescribeAutomationStepExecutionsResponse' smart constructor.
data DescribeAutomationStepExecutionsResponse = DescribeAutomationStepExecutionsResponse'
  { -- | The token to use when requesting the next set of items. If there are no
    -- additional items to return, the string is empty.
    DescribeAutomationStepExecutionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A list of details about the current state of all steps that make up an
    -- execution.
    DescribeAutomationStepExecutionsResponse -> Maybe [StepExecution]
stepExecutions :: Prelude.Maybe [StepExecution],
    -- | The response's http status code.
    DescribeAutomationStepExecutionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeAutomationStepExecutionsResponse
-> DescribeAutomationStepExecutionsResponse -> Bool
(DescribeAutomationStepExecutionsResponse
 -> DescribeAutomationStepExecutionsResponse -> Bool)
-> (DescribeAutomationStepExecutionsResponse
    -> DescribeAutomationStepExecutionsResponse -> Bool)
-> Eq DescribeAutomationStepExecutionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAutomationStepExecutionsResponse
-> DescribeAutomationStepExecutionsResponse -> Bool
$c/= :: DescribeAutomationStepExecutionsResponse
-> DescribeAutomationStepExecutionsResponse -> Bool
== :: DescribeAutomationStepExecutionsResponse
-> DescribeAutomationStepExecutionsResponse -> Bool
$c== :: DescribeAutomationStepExecutionsResponse
-> DescribeAutomationStepExecutionsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeAutomationStepExecutionsResponse]
ReadPrec DescribeAutomationStepExecutionsResponse
Int -> ReadS DescribeAutomationStepExecutionsResponse
ReadS [DescribeAutomationStepExecutionsResponse]
(Int -> ReadS DescribeAutomationStepExecutionsResponse)
-> ReadS [DescribeAutomationStepExecutionsResponse]
-> ReadPrec DescribeAutomationStepExecutionsResponse
-> ReadPrec [DescribeAutomationStepExecutionsResponse]
-> Read DescribeAutomationStepExecutionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAutomationStepExecutionsResponse]
$creadListPrec :: ReadPrec [DescribeAutomationStepExecutionsResponse]
readPrec :: ReadPrec DescribeAutomationStepExecutionsResponse
$creadPrec :: ReadPrec DescribeAutomationStepExecutionsResponse
readList :: ReadS [DescribeAutomationStepExecutionsResponse]
$creadList :: ReadS [DescribeAutomationStepExecutionsResponse]
readsPrec :: Int -> ReadS DescribeAutomationStepExecutionsResponse
$creadsPrec :: Int -> ReadS DescribeAutomationStepExecutionsResponse
Prelude.Read, Int -> DescribeAutomationStepExecutionsResponse -> ShowS
[DescribeAutomationStepExecutionsResponse] -> ShowS
DescribeAutomationStepExecutionsResponse -> String
(Int -> DescribeAutomationStepExecutionsResponse -> ShowS)
-> (DescribeAutomationStepExecutionsResponse -> String)
-> ([DescribeAutomationStepExecutionsResponse] -> ShowS)
-> Show DescribeAutomationStepExecutionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAutomationStepExecutionsResponse] -> ShowS
$cshowList :: [DescribeAutomationStepExecutionsResponse] -> ShowS
show :: DescribeAutomationStepExecutionsResponse -> String
$cshow :: DescribeAutomationStepExecutionsResponse -> String
showsPrec :: Int -> DescribeAutomationStepExecutionsResponse -> ShowS
$cshowsPrec :: Int -> DescribeAutomationStepExecutionsResponse -> ShowS
Prelude.Show, (forall x.
 DescribeAutomationStepExecutionsResponse
 -> Rep DescribeAutomationStepExecutionsResponse x)
-> (forall x.
    Rep DescribeAutomationStepExecutionsResponse x
    -> DescribeAutomationStepExecutionsResponse)
-> Generic DescribeAutomationStepExecutionsResponse
forall x.
Rep DescribeAutomationStepExecutionsResponse x
-> DescribeAutomationStepExecutionsResponse
forall x.
DescribeAutomationStepExecutionsResponse
-> Rep DescribeAutomationStepExecutionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeAutomationStepExecutionsResponse x
-> DescribeAutomationStepExecutionsResponse
$cfrom :: forall x.
DescribeAutomationStepExecutionsResponse
-> Rep DescribeAutomationStepExecutionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeAutomationStepExecutionsResponse' 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', 'describeAutomationStepExecutionsResponse_nextToken' - The token to use when requesting the next set of items. If there are no
-- additional items to return, the string is empty.
--
-- 'stepExecutions', 'describeAutomationStepExecutionsResponse_stepExecutions' - A list of details about the current state of all steps that make up an
-- execution.
--
-- 'httpStatus', 'describeAutomationStepExecutionsResponse_httpStatus' - The response's http status code.
newDescribeAutomationStepExecutionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeAutomationStepExecutionsResponse
newDescribeAutomationStepExecutionsResponse :: Int -> DescribeAutomationStepExecutionsResponse
newDescribeAutomationStepExecutionsResponse
  Int
pHttpStatus_ =
    DescribeAutomationStepExecutionsResponse' :: Maybe Text
-> Maybe [StepExecution]
-> Int
-> DescribeAutomationStepExecutionsResponse
DescribeAutomationStepExecutionsResponse'
      { $sel:nextToken:DescribeAutomationStepExecutionsResponse' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:stepExecutions:DescribeAutomationStepExecutionsResponse' :: Maybe [StepExecution]
stepExecutions = Maybe [StepExecution]
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:DescribeAutomationStepExecutionsResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | The token to use when requesting the next set of items. If there are no
-- additional items to return, the string is empty.
describeAutomationStepExecutionsResponse_nextToken :: Lens.Lens' DescribeAutomationStepExecutionsResponse (Prelude.Maybe Prelude.Text)
describeAutomationStepExecutionsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeAutomationStepExecutionsResponse
-> f DescribeAutomationStepExecutionsResponse
describeAutomationStepExecutionsResponse_nextToken = (DescribeAutomationStepExecutionsResponse -> Maybe Text)
-> (DescribeAutomationStepExecutionsResponse
    -> Maybe Text -> DescribeAutomationStepExecutionsResponse)
-> Lens' DescribeAutomationStepExecutionsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAutomationStepExecutionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeAutomationStepExecutionsResponse' :: DescribeAutomationStepExecutionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeAutomationStepExecutionsResponse
s@DescribeAutomationStepExecutionsResponse' {} Maybe Text
a -> DescribeAutomationStepExecutionsResponse
s {$sel:nextToken:DescribeAutomationStepExecutionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeAutomationStepExecutionsResponse)

-- | A list of details about the current state of all steps that make up an
-- execution.
describeAutomationStepExecutionsResponse_stepExecutions :: Lens.Lens' DescribeAutomationStepExecutionsResponse (Prelude.Maybe [StepExecution])
describeAutomationStepExecutionsResponse_stepExecutions :: (Maybe [StepExecution] -> f (Maybe [StepExecution]))
-> DescribeAutomationStepExecutionsResponse
-> f DescribeAutomationStepExecutionsResponse
describeAutomationStepExecutionsResponse_stepExecutions = (DescribeAutomationStepExecutionsResponse -> Maybe [StepExecution])
-> (DescribeAutomationStepExecutionsResponse
    -> Maybe [StepExecution]
    -> DescribeAutomationStepExecutionsResponse)
-> Lens'
     DescribeAutomationStepExecutionsResponse (Maybe [StepExecution])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAutomationStepExecutionsResponse' {Maybe [StepExecution]
stepExecutions :: Maybe [StepExecution]
$sel:stepExecutions:DescribeAutomationStepExecutionsResponse' :: DescribeAutomationStepExecutionsResponse -> Maybe [StepExecution]
stepExecutions} -> Maybe [StepExecution]
stepExecutions) (\s :: DescribeAutomationStepExecutionsResponse
s@DescribeAutomationStepExecutionsResponse' {} Maybe [StepExecution]
a -> DescribeAutomationStepExecutionsResponse
s {$sel:stepExecutions:DescribeAutomationStepExecutionsResponse' :: Maybe [StepExecution]
stepExecutions = Maybe [StepExecution]
a} :: DescribeAutomationStepExecutionsResponse) ((Maybe [StepExecution] -> f (Maybe [StepExecution]))
 -> DescribeAutomationStepExecutionsResponse
 -> f DescribeAutomationStepExecutionsResponse)
-> ((Maybe [StepExecution] -> f (Maybe [StepExecution]))
    -> Maybe [StepExecution] -> f (Maybe [StepExecution]))
-> (Maybe [StepExecution] -> f (Maybe [StepExecution]))
-> DescribeAutomationStepExecutionsResponse
-> f DescribeAutomationStepExecutionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [StepExecution] [StepExecution] [StepExecution] [StepExecution]
-> Iso
     (Maybe [StepExecution])
     (Maybe [StepExecution])
     (Maybe [StepExecution])
     (Maybe [StepExecution])
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
  [StepExecution] [StepExecution] [StepExecution] [StepExecution]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    DescribeAutomationStepExecutionsResponse